Shop OBEX P1 Docs P2 Docs Learn Events
Shift Registers — Parallax Forums

Shift Registers

GiuseppeGiuseppe Posts: 51
edited 2009-11-16 03:13 in BASIC Stamp
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 [noparse][[/noparse]0000]

The 1011 is the data "waiting" to be shifted into the blank slots of the register. So one clock pulse will have [noparse][[/noparse]1000], another one after that will become [noparse][[/noparse]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.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-11-16 03:10
    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.
  • GiuseppeGiuseppe Posts: 51
    edited 2009-11-16 03:13
    Thank you mike.
Sign In or Register to comment.