tvey
Lifetime Supporting Member
The help file for RSLogix 5000 v16 mentions several instructions that cannot be used within a custom Add-On:
That being said, I created a test Add-On to convert Gray code to Binary using a structured text 'For' loop. It seems to work (using the emulator):
So why does this work? I don't have a chassis handy at the moment so I'm unable to test on an actual processor.
I have a couple of Add-Ons in mind that could make good use of the occasional For-loop. I'm a bit leery of proceeding unless I can be sure of consistent operation.
Attached is an exported copy of the test Add-On (remove the .txt extension to import).
-Trevor
Code:
JSR Jump to Subroutine
SBR Subroutine
RET Return
JXR Jump to External Routine
FOR For (For/Next Loop)
BRK Break
SFR SFC Reset
SFP SFC Pause
IOT Immediate Output
EVENT Event Task Trigger
Code:
Binary.15 := Gray.15;
for i:=14 to 0 by -1 do
Binary.[i] := Binary.[i+1] XOR Gray.[i];
end_for;
So why does this work? I don't have a chassis handy at the moment so I'm unable to test on an actual processor.
I have a couple of Add-Ons in mind that could make good use of the occasional For-loop. I'm a bit leery of proceeding unless I can be sure of consistent operation.
Attached is an exported copy of the test Add-On (remove the .txt extension to import).
-Trevor