So, you want to put a bunch of LED’s on you killer bot. But oh no! You only have 3 I/O pins! What do you do?
The 74HC595 is a simple chip that receives serial data and puts that data on to the 8 I/O pins.
It’s 8 for the price of 3!
Here is a pin diagram:
http://www.syntax.com.tw/proddata/IC/IC-74595.JPG
Lets go through the pins. Pins 1-7 and 15 are the outputs. Pins 14, 11, and 12 are what we will use to communicate with the chip. Pins 10 and 13 basically enable the chip. 16 and 8 should be self explanatory. Pin 9 is used for cascading multiple 74HC595’s. It is not used in this tutorial.
This is how you need to wire up the 74HC595:
Pin 8 (GND) needs to be connected to ground.
Pin 16 (Vcc) needs to be connected to 5v.
Pin 13 (Output Enable) needs to be connected to ground.
Pin 10 (Shift Register Clear) needs to be connected to 5v.
Pin 14 (Serial Data in) needs to be connected to the
microcontroller (Digital/Analog pin 1).
Pin 11 (Shift Register Clock) needs to be connected to the microcontroller (Digital/Analog pin 2).
Pin 12 (Latch) needs to be connected to the
microcontroller (Digital/Analog pin 3).
Note: Connecting the 74HC595’s SRCLR and OE pins directly to ground and 5v may cause random data to be displayed, the only solution would be to connect those pins to the microcontroller.
The output pins can be connected to anything really, I recommend that you connect them to LED’s for this tutorial though.
What you do to get data on the output pins is as follows:
Set all data pins low.
Repeat this 8 times:
Set the data pin(Pin 14) to the state that you want output 8(the data is reversed on the output pins) to be at.
Set the clock (Pin 11) high.
Wait a ms so the 74HC595 can catch up.
Set the clock (Pin 11) low.
Stop repeating.
Set the latch(Pin 12) high.
The code for this is rather simple to. You can download it at the bottom of this page. Note: You must remember to plug in everything like I did above for this code to work.
The results:
https://vexforum.com/gallery/files/7/6/9/6/74hc595_with_vex_micro.jpg
https://vexforum.com/gallery/files/7/6/9/6/100_3030.jpg
74HC595 with Vex Microcontroller.zip (1.27 KB)