Shop OBEX P1 Docs P2 Docs Learn Events
How do I work with shift registers with Propeller GCC? — Parallax Forums

How do I work with shift registers with Propeller GCC?

iamericminiamericmin Posts: 4
edited 2019-10-22 14:24 in Propeller 1
Hi,

I'm trying to control 6 16-segment LEDs on the Propeller chip with two shift registers. The shift registers will be connected to the display segments and 6 pins on the propeller will refresh the display. However, after many days of google searching I can't find a single tutorial/guide on how to work with shift registers with Propeller-GCC. If there is a library of some sort I would greatly appreciate it. I want to work with GCC simply because I have more experience on it.

Thanks.

Comments

  • Are you attempting to clock an external hardware shift register, or are you trying to shift an internal variable?

    In the case of an external hardware device, its just a matter of setting the data into the device and wiggling a pin to do the shift. How you do that will depend on the device you are using.

    If you are trying to shift using an variable, then the standard GCC shift operators (<< >>) should work just fine. Or am I misunderstanding the question?
  • Hi JRoark,

    I was talking about an external hardware shift register. Specifically the 74HC595 SIPO chip.

    I was asking if there was a library that simplified working with shift registers. Is there one for the Propeller C language?

    Cheers!
  • It might be enough to write a simple function as most of the work can be handled with shift_out(). You'll need to latch the outputs after.
  • Hi JonnyMac,

    is shift_out() a built in function in Propeller C? Or do I have to include an external library?
  • kwinnkwinn Posts: 8,697
    Shifting data to one or more shift registers is fairly straight forward. There are 5 signals that control a ‘595 or similar shift register. Three are always required, SER (serial data), SRCLK (serial clock) and RCLK (register clock). The /OE (output enable) can be tied low and /SCLR (serial clear) pulled high in many cases.

    The steps to output the data to the registers are:

    1. Initialize SRCLK and RCLK to 0
    2. output data bit to the SER pin
    3. output 1 to SRCLK
    4. output 0 to SRCLK
    5. repeat 2 to 4 for number of bits required
    6. output 1 to RCLK
    7. output 0 to RCLK

    The typical display module I used this for would be a 6 or 8 digit 7 segment + dp with a TPIC6595 for digit select and 74HC595 for the segments. The data connections were in series so I could shift out 16 bits that controlled both the segments and digit select with 3 pins.
  • JonnyMacJonnyMac Posts: 9,102
    edited 2019-10-23 13:05
    iamericmin wrote: »
    Hi JonnyMac,

    is shift_out() a built in function in Propeller C? Or do I have to include an external library?

    It's part of the simpletools library. You can find details in the online help.
Sign In or Register to comment.