74HC595 with Vex Microcontroller

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)

Very nice display! I used a MAX7219 LED Display driver for my Numeric LED Display shown in the gallery, which can drive up to 10 digits or 64 independent LEDs.

Thanks!
I am working on creating my own portable game system with an LED matrix so I figured it would be great to use a Vex Micro before I used a raw AVR because it is so easy to program.

An Excellent Hack…

If you use 3 or 4 of the 74HC595’s, you could control many Digital Devices.

So 9 of the Vex Controller’s Digital Outputs would let you control 24 Outputs.

Here are some Data Sheets for the 74HC595:

HITACHI HD74HC595 Datasheet from page, Renesas Technology, Home / Products / Standard IC / General-Purpose Logics / 5V Standard Logic / HD74HC Series /
Documentation
.

NXP (Phillps) 74HC595 Data Sheet from page, 74HC595; 74HCT595.

You need to include both the “74HC595 with Vex Microcontroller.BDS” file and the “74HC595 with Vex Microcontroller.ECP” file. IF you only include one file, make it the “74HC595 with Vex Microcontroller.BDS” file…

Thanks MarkO!

Should be fixed now. Thanks for telling me.

Actually it wouldn’t matter how many 74HC595’s you used it would still take 3 I/O pins. Pin 9 is like the “over flow” you connect this pin to the serial input of the next and connect the clock and latch of the other one to the same pins on the first one. The code stays the same accept you shift out 16 bits instead of 8.

You can also use a 74HC166 to receive parallel data and output serial.

Aha Right!! They can be Cascaded… I forgot you mentioned that… :wink:

I need to see if the Local Radio Shack has any in stock…

I don’t think Radioshack sells them. I got mine from Sparkfun.

Just so you guys know in easyC you can re-define all the I/O pins as digital outputs.

https://vexforum.com/attachment.php?attachmentid=2106&d=1251919771

Can you change the interrupt ports on the Vex Controller to be general input or outputs using Easy C or Easy C Pro?

I don’t know about EasyC Pro but with EasyC you cannot.