Sign in to follow this  
Followers 0
DJSauce

PLS and RST command

8 posts in this topic

I haveabasic question that is not clearly explained in the prog manual.... (at least where I looked) -|Y8A|-----------------------------[PLS M155]- Pulse Bit -|M155|------[< D34 K32000]---[+ K1 D34 D34]-- Increment counter -|/Y8A|----------------------------[RST M155]- Reset pulsed bit I am pulsing an internal bit (M155) based on and output going on (Y8A) then increment a roll counter. Do i need the last line to RST the bit or will the PLS reset the bit (M155) after the next PLC scan? thanks Edited by DJSauce

Share this post


Link to post
Share on other sites
No, you don't. The PLS generates one scan pulse.

Share this post


Link to post
Share on other sites
There are a couple of ways to do this with only 1 line of code. Your increment instruction could be a pulsed instruction or you could use Y8A in place of -|M155|- in a pulsed mode as well (NO contact with an UP arrow in the contact). I would code that as: -|Y8A|------[< D34 K32000]---[iNCP D34]-- Increment counter D34 This would increment D34 by 1 on the leading edge of input Y8A - Y8A would have to go false and then true again to do another increment (notice the 'P' appended to the INC instruction). The INC instruction is also more efficient than the ADD instruction. Good luck. Edited by mjrx

Share this post


Link to post
Share on other sites
pls. note that when d34 exceeds k32000 it will stop counting. Maybe you reset D34 to 0, so immediately after reseting prev. code counts d34 +1 again (second time) without waiting y8a=low. I am trying to say that it is not only rising y8a, follow the whole line before that incp. In this case it maybe doesn't matter, but some cases, I would use I/O edges or pls. Tmu

Share this post


Link to post
Share on other sites
With the 'P' appended to the INC instruction it is in effect only looking for the one shot of input Y8A. It will NOT continue to increment if Y8A stays true - it must go false and then true again to make a single increment of 1.

Share this post


Link to post
Share on other sites
OK, You mean then like this |Y8A|-----------------------------[incp d34] Note that there is also cmp |< d34 k32000|, which affects to that incp d34. D34 could be more and less than k32000 while Y8A=high. We do not know what will happen to d34 when [> d34 k32000]?? I'd use |Y8A|---|P|----[< d34 k32000]----------[inc d34] What actually happens when d34 is above 32000?? Just rst d34? Or? Tmu

Share this post


Link to post
Share on other sites
I would still code it as: -|Y8A|------[< D34 K32000]---[iNCP D34]-- The compare statement is just a limit - he doesn't want to increment any further past 32000. It doesn't matter if Y8A stays high or not - nor does it matter if you make the compare statement every scan. If D34 is greater than or equal to 32000, no increment will take place, period. As for bringing D34 back in range, I am assuming D34 is manipulated elsewhere in the program, either reset or written with a value. Like I said earlier, changing LD Y8A instruction to LDP Y8A essentially does the same thing, but the comparison is done on a one shot basis, which doesn't matter (in this example).

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
Sign in to follow this  
Followers 0