Instruction Execution and Tag Atomicity - Lesson Learned!

JeremyM

Lifetime Supporting Member
Join Date
May 2014
Location
Dallas, Texas
Posts
1,233
As a small part of some machinery I'm working on, I needed to obtain some temperature readings from an RTD probe in a vessel. I derived a function to convert raw input from the signal conditioner to the actual temperature, then created this rung to compute it for each scan:

-----------------------------[MUL(RAW * SCALE)]---[SUB(Temp - OFFSET)]---

Mathematically, this *should* work, but the HMI polling for the tag containing the temperature revealed a spike in the value, leading me to think there was intermittent noise somewhere. Scoping the line revealed no issue, so I eventually figured out that the polling request was occasionally being answered by the PLC after the MUL, but before the SUB instruction, was executed (both instructions referenced the same temperature tag), thus revealing a "spike" of precisely the value of the offset. :eek:

I rolled the expression "(RAW * SCALE) - OFFSET" into a CPT instruction, guaranteeing an atomic value for the temperature. The PLC is a CompactLogix L33ER, running firmware 21.11. Also, I'm not sure how the LADDER tags work yet, so forgive me. :)
 
Last edited:
I'm not 100% sure that I know how your system is set up (Task Priorities, etc.) but you might be interested in the discussion and the experiments covered in the following thread ...

http://www.plctalk.net/qanda/showthread.php?p=376167&postcount=61

basic idea: the system can (under certain conditions) interrupt the logic execution RIGHT SMACK DAB IN THE MIDDLE of a math instruction ...

this might not be important to your particular situation – but it's something that you should at least be aware of ...

and welcome to the forum ...
 

Similar Topics

Hello Team, Can anyone tell me/ give a link to understand the scan time/ execution sequence of difference instructions in SCL. E.g...
Replies
0
Views
871
Hello Team, Can anyone tell me/ give a link to understand the scan time/ execution sequence of difference instructions in SCL. E.g...
Replies
1
Views
1,098
Hi all, Just wondering if anyone knows enough about the inner workings of an add-on instruction to answer this question for me: Does the AOI...
Replies
5
Views
2,636
I have a CNC machine with an AB L33ERM and two K350 servos with AB MPM motors. On occasion the MCCM instruction executes but the physical motion...
Replies
1
Views
2,116
HI guys! Will a FOR instruction execute every scan or does it need to see a transition like a counter? My gut says the former, but it never...
Replies
2
Views
1,264
Back
Top Bottom