Sending data to external shift register

I have a control panel that uses shift registers to display the given status. The shift register requires three outputs to function. Latch displays what is in the shift register, the Clock which indicates the storage location and data to say if the storage location is On/Off. I've created a test program to try and work through this. I've attached it here.

 

The Shift Register sub-routine is what I'm trying to get working.

 

The Latch (Y702) should fire at the end of 24 clock cycles to tell the shift register to display the stored data. The clock (Y701) fires every 1 second (testing) to change the data location. The Data (Y703) tells the shift register if it is On/Off.

 

This is my second program in click PLC so I'm very new and trying to understand this type of logic. I normally code in C so I have a backwards brain for working with ladder logic.

 

Thank you in advance


kewakl likes this.
  • bcarlton (Customer)

    Y701 will be on continuously for TD1 equaling 1 through 9. Your external shift register probably needs some off time for it to see separate pulses.

     

    Y702 will only be on for one scan (on the order of milliseconds) every 24 seconds. Is that enough?

     

    Can you post a link to information on the external shift register?

  • Hour To Midnight (Customer)

    https://www.ti.com/lit/ds/symlink/sn74hc595.pdf

     

    This is the shift register I'm talking to. It is three in line so 24 bits total (8 bits per register). I'm looking at for next loops but yes there will need to be a downtime for each pulse as it needs a rise and fall to move to the next bit.

     

    Thank you for attempting to help. PLC's are really nice devices I just need to learn Ladder logic better.

    Expand Post
  • bcarlton (Customer)

    This. Is an interesting project. Simplify your development by focusing on one signal at a time. Start by focusing on the output to SRCLK. It needs to be a square wave as shown in the chip timing diagram. Then work on the data output. This will be in quadrature with the SRCLK. It needs to be valid before the SRCLK rises. I will discuss others as you go.

  • Tinker (Customer)

    A difference between programing PLC Relay Ladder Logic and programing in languages like C is how the PLC scan works and when inputs and outputs are (normally) updated. If more than one "OUT" targeting the same physical output is used, "the last one wins".

    So for example, the physical output Y702 will only turn on when when TD1 = 9, while the internal register for Y702 will briefly be on for the other rungs if TD1 equals the given constant, if TD1 is not 9 the register will be turned back off before the physical outputs are updated at the end of the scan.

     

     

    The CLCIK does have a shift register instruction, by itself it won't really do what you want, but with some additional code it might be helpful?

    The 74HC595 does need the data to be valid before the clock, but that time is measured in nanoseconds while a CLICK scan will be measured in milliseconds, I'm not sure that will be an issue but one might want to turn on the data one scan before the clock which might somewhat complicate things. I don't know if I've ever used SC3 _SCAN_Clock, but it does exist

    Expand Post
  • Hour To Midnight (Customer)

    The 74HC595 can be set by pulses at any rate which I think it where I need to go. I just need to understand how to set a clock pulse every MS and evaluate X001, x002 etc. to determine what data is passed on the clock correct clock pulse. On the 24th pulse, I would assume to pulse the latch to commit the changes on the shift register. So I've thought about rolling all the events into one rung but as stated earlier they won't have a low to allow a correct clock pulse.