Common anode is common posotive. Connect the common positive to +5V. Then get the proper resistors for each segment. Connect the cathode of each segment to a resistor. You will also need a ULN2803A because the 74HC595 can only supply posotive voltage. Conenct the Q0-7 of the shift register to the bases of the transistors (Pins 1-8 on the ULN2803A.). Then connect 0V to pin 9, and +5V to pin 10. Pins 18-11 go to the other side of the resistors on the display.
Then you turn a pin high on the 74HC595, and the according segment turns on.
Me and richard are basically saying the same thing... the only thing is that the ULN2803A is basically 8 NPN transistors in one package...
My only other idea would be to hook the cathodes directly to Q0-7, and then turning the pin high means it's off and turning it low tuens the segment on...? It's worth a try... If not, use my above idea.
You hook each segment to a resistor. You hook the anode to +5V. The other side of each resistor goes to
A. Directly to the Q0-7 of the 74HC595 chip.
B. To the collectors on a ULN2803A, and the bases of that same chip go to the Q0-7 on the 74HC595
For A: To light up a segment on the display, you turn the corresponding Q pin LOW.
For B: To light up a segment on the display, you turn the corresponding Q pin HIGH.
For A: To light up a segment on the display, you turn the corresponding Q pin LOW.
For B: To light up a segment on the display, you turn the corresponding Q pin HIGH.
Yep.
How can i address the pins to create digits? are there any libraries so i can use int values?
Here's an example of a lookup table for getting the segment values (not written for Arduino but should work the same).
Abviously the actual values may be different for your application.
Then grab the values using something like this.
void mainLEDout (uint_16 val) {
uint_16 tx_word;
// get lower nibble bit pattern from table
tx_word = (LED_data[(val & 0x00f0)>>4]) ;
// get upper nibble bit pattern from table then OR into upper byte
tx_word |= LED_data[val & 0x000f] << 8;
your_output_value_function (tx_word);
}
hey guys. i just ordered a bunch of 595's and a common anode display. im a total neewbie to electronics but could i use a hex inverter like the 4069(or a NOT gate) to change the polarity of the 595's output. thanks in advanced
You could but it's much easier to just invert the data you send to the 595, bit low = led on, bit high = led off.
As mentioned above the 595 is not really a LED driver but for playing around it should work. One of the high-current equivelants like a TPIC6B595 would be better.
You're right, that's the neat way to do it. I posted something similar in post #14, it takes a uint_16 and turns it into two 8-bit patterns suitable for shifting out.
As it can only print up to FF it didn't need a uint_16, I think I was allowing for shifting 3-4 bytes in future.
The inversion/non inversion can be handled statically by having the correct values in the LED_data array, or dynamically buy XORing the data before transmitting.
ya that would be easier to just have high=led of and vice versa. although remember im a really total neewbie to arduino and electronics so doing the whole 16 bit ->2 8-bit thing sounds really confusing. thanks for the replies