JiM_cz

"Unusual" use of a shift register

7 posts in this topic

Could someone please help me to understand how this particular SFT works please? (See the pic please). The first 3 parallel contacts ensure that 16.08 will be OFF (for 1 program scan) if there is a NG product that needs to be rejected. I'm confused with the part that follows. If 16.08 is OFF the H2.00 will be set to "1". H2.00 is also the rightmost bit of the shift register. However, at the same time the data input of the SFT is always off.

My understanding was that when 16.01 is ON the SFT checks what is on its data input and puts it into its rightmost bit. In this case it should be always zero. But I must be wrong because I saw this code working and there were "1" as well (when the "not good" product needed to be rejected).

Untitled.jpg

Edited by JiM_cz

Share this post


Link to post
Share on other sites

This is a bit different, but I can see where it would work.

Instead of using the top input for the data for the shift register, if H2.00 is on when 16.01 initiates the shift, a 1 would be moved into the shift register.

Not understanding the entire system, not really sure why it was done this way.

Hope this will help.

Share this post


Link to post
Share on other sites

Yeah, you're probably right. That's how it works. But why? The help file describes the SFT function like this:

"When the execution condition on the shift input changes from OFF to ON, all the data from St to E is shifted to the left by one bit (from the rightmost bit to the leftmost bit), and the ON/OFF status of the data input is placed in the rightmost bit."

According to this, it should place the the status of the Always OFF (0) of the data input line to the the rightmost bit and never "1"

Edited by JiM_cz

Share this post


Link to post
Share on other sites

Best way to see what is happening would be to use the Watch window and monitor H2 in binary.

This should help you see what is going on.  H2.00 is set in the rung above the SFT.

When the shift input is turned on, H2.00 value is moved to H2.01 and a zero condition would be moved into H2.00 in the shift register.

However, if H2.00 is still SET on, you may not see the zero value at that position.  Much depends on the rest of the program.

 

Edited by gtsuport

Share this post


Link to post
Share on other sites

This is not very intuitive but it does work. As gtsuport says, use the watch window. In addition, copy this section into a new program and run the simulator. The picture below shows the program in Step mode. It is paused  just before executing the Shift.

The key point to understand is that the Always OFF does NOT turn H2.00 OFF. It only supplies the data to be shifted in at the Rising Edge of 16.01 which will always be zero.

On ‎11‎/‎6‎/‎2018 at 7:15 AM, gtsuport said:

When the shift input is turned on, H2.00 value is moved to H2.01 and a zero condition would be moved into H2.00 in the shift register.

Because 16.01 Sets the data and shifts it, you will not see H2.00 turn ON in real time.

MrPLC_Shift2.thumb.jpg.b086e468a3a9ae781

 

Edited by IO_Rack

Share this post


Link to post
Share on other sites

Thanks. I think I got it.

I tried to run that particular part in a simulator as you advise me to but my CX-programmer freezes every time. There is the hourglass icon hanging forever. Do I need to be connected to a physical PLC for the simulator to work?

Share this post


Link to post
Share on other sites

You do not need a physical PLC for simulation.

I've heard of some simulator issues in the past. Make sure you have the latest CX One updates.

There are a few methods for running the simulator. With the program open in CX Programmer, choose Simulation from the menu then Work Online Simulator. This is the simplest method to test PLC code only.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now