greetings drbitboy ...
well, I'll admit to being an old dog – but I'm always eager to learn a new trick ... but still I'm pretty sure (as in willing to bet substantially more than pocket change) that the program I posted above works exactly the way it was intended ...
history: the guy who contacted me about this project (both on and off the forum boards) was working at a hospital – and he was quite desperate to get these pumps working correctly ... after I put the program together, I sent it to him and he downloaded it to his processor ... I am quite sure that it worked correctly right out of the box ... specifically, if he had to make any onsite tweaks to it – I never heard about them ...
anyway ... I'm quite interested in why you say the program wouldn't work ... can you fill me in with some details, please ...
first things first ...
This came up in another thread; I am posting this in case someone finds this thread e.g. in a search.
can you please provide a link to that "other thread" ... maybe that context would help me see where any misunderstanding is coming from ...
now to your statement ...
if N7:0 is 3 and bit PUMP_C_BYPASSED is 1, then none of the *_IS_1ST_PUMP bits will be set to 1 after Rung 0006.
let's suppose that N7:0 is indeed equal to 3 – then the EQU statement on rung 6 would be evaluated as TRUE ...
suppose that bit B3:0/3 has the value of ONE – then the XIC for that bit – which is located in the lower branch of rung 6 – would be evaluated as TRUE ...
TRUE logic would cause the MOV instruction on rung 6 to write a value of ONE into the POINTER addressed as N7:0 ...
I think (and hope) that we're both together so far ...
now on to this statement that you made ...
It will only be that way for one scan.
I'm really not sure exactly what "it" you were referring to ...
note that the CTU (Count Up) instruction C5:0 that you've shown is not actually used in my original program ... in fact, I didn't use any CTU instructions at all ...
so I'm going to GUESS that you have installed your CTU on your new rung 7 as a "testing" device ... probably to see if those three XIO instructions all became evaluated as TRUE at one time – and if so – for how long they remained TRUE ...
if I'm correct in that GUESS, then that might be the reason that we're not fully understanding each other ...
SECRET HANDSHAKE: there's a "trick" with using a CTU counter as a "testing" device when debugging a program ... try using an ADD instruction instead ... something like this:
Source A ... F8:0
Source B ... 1
Destination ... F8:0
try exchanging this little "debugging" tool for your CTU and see if your test results are any different ...
WARNING ... fight the natural impulse to use an Integer location ... instead use a Floating Point address for this purpose ... the reason is that if the value in the Integer ever increases to 32,767 then your RSLogix500 platform will set its Overload Trap bit when it tries to increment the value again ... this can fault the processor if it's not properly handled ... on the other hand, a Floating Point location won't generate an overflow ...
anyway ... if indeed it does turn out that there is a bug in the program that I posted, then I'll sincerely thank you for bringing it to my attention ... anyone who knows me will attest that I have ZERO ego issues ... I wash the dishes ... I do my own laundry ... and I get a $20 allowance once a week – if I behave myself ... I have found it impossible to develop an ego problem on a foundation like that ...
in closing ... the program that I wrote and posted was not a student "lab exercise" ... indeed it was a real-world program – written for real-world equipment ... I did my best to test it out before I sent it to my customer ... and to the best of my knowledge, it worked perfectly right out of the box ...
if I have made a mistake somewhere, then I'll humbly admit it – and I'll sincerely thank you for pointing it out ...
and incidentally, now that I've retired, I no longer have access to any PLC processors ... otherwise, I'd gladly fire this turkey up and give it another chance to surprise me ...
stay safe ... stay well ...