zeke 693 Posted April 5, 2011 Share Posted April 5, 2011 Is anyone using the TPIC6595for their LED projects? I'm about to do a digikey run and I'm looking a decent drive circuit for my 7-segment LED displays. Thoughts or ideas? Quote Link to post Share on other sites
RobG 1,892 Posted April 5, 2011 Share Posted April 5, 2011 I am using TPIC6C595 here and in another project (up to 8 digits/7 segment) which I didn't post here, but I am including the code below. It pretty much functions like 595 so you can connect in series. Not sure if you are aware, but TI makes several types of this chip: A (TPIC6A595) with 350-mA outputs, B with 150-mA, and C with 100-mA. This is a simple up counter with reset, first chip is 74hc595, second TPIC6C595. As you can see, there's nothing special about it. #include #define DATAPIN BIT4 #define CLOCKPIN BIT5 #define LATCHPIN BIT0 #define UPSWITCH BIT2 #define CLEARSWITCH BIT1 #define SWITCHPINS (UPSWITCH + CLEARSWITCH) #define NUMOFDIGITS 8 unsigned long counter = 0; // Counter variable unsigned int digitCounter = 0; // Digit counter unsigned char digit = 0; // Single digit to be displayed unsigned char bcd7digit[10] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F}; // BCD to 7 digit map unsigned char digitSelector[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80}; // Digit selector map unsigned int displayData = 0; unsigned char shiftCounter = 0; void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT P1DIR &= ~SWITCHPINS; // port P1.2 and P1.1 input P1IE |= SWITCHPINS;// P1.2 and P1.1 interrupt enabled P1IES &= ~SWITCHPINS;// P1.2 and P1.1 lo/high edge //P1IES |= SWITCHPINS;// P1.2 and P1.1 high/lo edge P1IFG &= ~SWITCHPINS;// P1.2 and P1.1 IFG cleared P1REN |= SWITCHPINS;// resistor enable P1OUT &= ~SWITCHPINS;// pull down, since the switch will be active high //P1OUT |= SWITCHPINS;// pull up, since the switch will be active high P1OUT &= ~(CLOCKPIN + DATAPIN); P1OUT |= LATCHPIN; P1DIR |= LATCHPIN + CLOCKPIN + DATAPIN; CCTL0 = CCIE; // CCR0 interrupt enabled CCR0 = 250; // TACTL = TASSEL_2 + MC_1 + ID_3; // SMCLK, upmode _bis_SR_register(LPM0_bits + GIE); // Enter LPM0 w/ interrupt } // Timer A0 interrupt service routine #pragma vector = TIMERA0_VECTOR __interrupt void Timer_A (void) { digitCounter++; // Increase digit counter if(digitCounter == NUMOFDIGITS) digitCounter = 0; // Mask, counter range digit = counter>>(4 * digitCounter); // Shift digits right digit &= 0x0F; // Mask, we need first digit only displayData = digitSelector[digitCounter]; displayData <<= 8; displayData |= bcd7digit[digit]; shiftCounter = 0; while(shiftCounter < 16) { (displayData & BITF) ? (P1OUT |= DATAPIN) : (P1OUT &= ~DATAPIN); displayData <<= 1; P1OUT |= CLOCKPIN; P1OUT &= ~CLOCKPIN; shiftCounter++; } P1OUT &= ~LATCHPIN; // Latch data P1OUT |= LATCHPIN; } // Port 1 interrupt service routine #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { P1IE &= ~SWITCHPINS; // disable P1.2 and P1.1 interrupt WDTCTL = WDT_MDLY_32; IFG1 &= ~WDTIFG; IE1 |= WDTIE; if(P1IFG & UPSWITCH) { counter = _bcd_add_long(counter, 0x01); } else if(P1IFG & CLEARSWITCH) { counter = 0; } } #pragma vector=WDT_VECTOR __interrupt void WDT_ISR(void) { IE1 &= ~WDTIE; IFG1 &= ~WDTIFG; WDTCTL = WDTPW + WDTHOLD; P1IFG &= ~SWITCHPINS; P1IE |= SWITCHPINS; // enable P1.2 and P1.1 interrupt } Quote Link to post Share on other sites
Mac 67 Posted April 6, 2011 Share Posted April 6, 2011 I use them too Zeke. Nice chip. Similar to other serial-to-parallel 8-bit sinking drivers like the Micrel MIC5821 (500-ma). There are also a number of very nice 8-bit and 16-bit serial-to-parallel "constant current" sinking drivers you might look at (no current limiting resistors needed). Cheerful regards, Mike Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.