View Full Version : Shift Registers

11-16-2009, 09:50 AM
Hey guys. I have been looking into the functions of shift register and I am confused about one detail, how would a BS2 send a bit of data after each clock pulse? I am interested in connecting a bs2 to a shift register (8 bit, SIPO) and then connect the data out to the LEDs of a seven segment display to show numbers. Now correct me if I am wrong, shift registers basically just take one bit after one clock pulse.

My understanding of a SIPO 4 bit. I dont want to use a 8 bit example since its more typing.

1011 [0000]

The 1011 is the data "waiting" to be shifted into the blank slots of the register. So one clock pulse will have [1000], another one after that will become [1100] and so on right? But how hows the bs2 send the 1011 in this example to the data in pin? Does it send it to the register through a SEROUT command in 4 bit strings and the register "holds" onto it until it is shifted? Or do I simply have to change the state of a general bs2 output pin to LOW of HIGH? If it is just switching from LOW to HIGH, wouldn't that be a pain to code?

Simple example code would be cool to show either concept.

Mike Green
11-16-2009, 10:10 AM
The StampWorks Manual (search Parallax's website for a link) has examples for the use of both a 74HC165 parallel to serial shift register and a 74HC595 serial to parallel shift register. The statements to use are the SHIFTIN and SHIFTOUT statements. Read the corresponding chapters in the Stamp Syntax and Reference Manual for details and examples.

SHIFTOUT is used with a SIPO shift register and this does shift in the data one bit at a time. The statement uses 2 I/O pins, one for data and the other for the clock. Again, read the explanation in the Manual. It should be clear.

The BS1 doesn't have the SHIFTIN or SHIFTOUT statements and has to do the work using simple statements like LOW and HIGH. It is a pain to code, but does work. Fortunately, the BS2 takes care of the details automatically.

11-16-2009, 10:13 AM
Thank you mike.