Sequence programming in Cx-programmer by changing register value

sehonn

Member
Join Date
May 2017
Location
Aalborg
Posts
23
Hello,

I am trying to make a sequence program by using MOV function to change the value of a register. So far I have always used SET and RSET for sequencing but sometimes it happened that 2 steps were active in the same time even though they were not supposed to. To avoid this problem, I want to make the sequencing by changing the value of a register. Since it can only have 1 value at a time, it can never happen that 2 steps will be active in the same time.

I wrote a small test program but it is not working on they way I want it to work.

When the PLC turns on, &0 is moved to D0, lamp0 is on to indicate that step 0 is active. When I give the condition for step 1 (push button1), &1 will be moved to D0. When D0=&1, lamp1 turns on indicates that step 1 is active and lamp0 should turn off because step 0 is not active anymore. When D0=&1 and I give the condition for step2 (push button2), &2 will be moved to D0 and lamp2 turns on to indicate that step 2 is active and lamp1 should turn off. Until that point it works just fine, but when step 2 is active and I turn button 1 off, which is the condition for step 1, step 0 activates again. When step2 is active, it should be active regardless of the conditions of the previous steps. What can be the problem?

I upload my program and if you have time, you can take a look at it.

Thanks!
 
Last edited:
Using a register value for sequence programs is definitely the best approach, particularly for complex sequences where you may need to skip (or repeat) steps. It would be a good idea to add a range check to insure that the value in the sequence register is legitimate.
 
Part of what you're describing is inaccurate. You' said that Step two
should be active regardless of the conditions of the previous steps.
Which this is not accurate because you're conditioning step two to only be active IF your D0 is = &1 and the I:0.02 switch is on. So clearly it can't stay active once activated regardless of the previous steps, because it literally takes a previous step to be True every single time the run is scanned in order for IT to be True.

Because you have an unconditioned MOV &0 to D0 at the begging of your Rungs you're basically resetting your memories of the steps you've done already and you're re examining each step every single scan. I would condition the first rung to have NOT instructions of all the other switches in series before you move &0 into D0.

So in plain English. Move &0 to D0 only if all the switches (buttons) are off.

Try that and report your findings. Also for such a strange phenomenon maybe a Video would help?
 
The conditions of the moves to determine steps are not incorporating all of the conditions.
If switches 1 and 2 are on during the transition from program to run then &2 will be in D0.
I would set up the conditions for all four of the switches.

Here is a post on using indirect addressing to do sequencing. The same programming can be implemented in the Omron controller. (*D) for BCD indirect Omron. (@D) for Binary indirect Omron.
Building a PLC Program That You Can Be Proud Of
Part 1 / 2 / 3 / 4 / 5 / 6
(This series takes you through using discrete inputs and outputs to control traffic lights and cylinders. As we progress we introduce additional methods to solve logic. We look at sequencers in a new way and learn how to write programs to allow users to teach the new sequence.)

Hope this helps you out.
Regards,
 
Thanks for the advise guys.

Timryder, you were right, I set conditions for step 0 and the problem is solved.

Gclshortt, thanks for the link.
 

Similar Topics

Hello, i have a machine with 3 axis that can run simultaneously controlled by other software but sometimes this goes wrong due operator fault. So...
Replies
9
Views
2,844
I am taking my first attempt at modifying a program on our little bottling machine. We need to automate a sequence to purge the tank on the...
Replies
2
Views
4,806
hello all experts. i'd like to know your experiences about sequence programming. i use positive or negative edge detection(|p|or |n| elements)...
Replies
1
Views
6,569
hello i am currently working on my program. i have some problem where i need some guidance. i have a question where when i do the next network...
Replies
2
Views
1,544
Hi again, Here is the situation..... I have now created function blocks for all my equippment in my Robot cell.. Pick and placer, Magazine...
Replies
54
Views
48,441
Back
Top Bottom