Control Logix FOR instruction/ SLC 500

scanner42

Member
Join Date
Jan 2008
Location
Washington
Posts
10
I'm wanting to build a FOR loop array in RSLOGIX 500. Control Logix has the FOR command that works swell. Is there anything in the 500 comparable to it?
 
Use JMP and LBL to repeat code within one scan but BE CAREFUL. Don't let it repeat endlessly or even too long or other processes will suffer. You may even get watchdog timeouts.
 
scanner42,

i used indexed addressing.

i had a for next loop for the word and another for next
loop for the bit inside the word loop.

i compared the word value to zero, if equal i incremented the index and skipped the bit logic.
if not equal to zero, i went to the bit compare loop.

this eliminates the possibility of a watchdog timeout.

works great for displaying machine status messages on a pv terminal.

regards,
james
 
Here is an example of For-Next loops in a sorting program. Rung 003 is "For J = 2 to N, Step 1". Rung 007 is "For I = J-1 to 1, Step -1.
 
Last edited:
I had two files, N7:0 and N7:1. If any bit came true, I would display it on a readerboard. Like if N7:0/5 =1 I would display that alarm. I wanted to just scan for the high bits in those registers, If any registers were zero, I would leave the readerboard dark. I could have 3 to 4 alarms at a time that i would display one after another with ascii. i use the N7:0 and N7:1 to trigger them. Tht's what i think i need a for/next loop for.
 
We use something similar, though we use an 'L' register (let's say L10:0 for example) to hold 32 possible alarm bits.

Another thing we do is just 1 test per scan. Since you will be displaying for reading that is pleanty fast. There is no need to do more than 1 test per scan.

We have an 'N' register (let's say N7:11) set aside as the display's reference register. A zero in it is translated as 'No Fault'

On each scan we first test if the L register is zero. If so we place a zero into the N7:11 register.

If the L register wasn't zero we then test if a 'displaying alarm' is ON. If so we test a 'Time To Display Alarm' timer is done. If it is we reset the timer (don't leave this out. If not done adjacent simultaneous alrms won't display properly), reset the 'displaying alarm' bit and increment another N register (let's say N7:10) for use as an indirect value. If it is greater than 31 we reset it to zero.

We then test if L10:0/[N7:10] is ON. If so we set the 'displaying bit'. That bit being on enables the 'Time To Display Alarm' timer. We also add '1' to N7:10 and place it in N7:11 (thus alarm L10:0/0 triggers the value '1' in N7:11 etc.)

If this isn't clear I'll look for the code and post it.
 

Similar Topics

In studio 5000, is there a way to write a force mask into a rung? Long story short, I would like to create a test routine for a FAT test. In...
Replies
7
Views
1,268
Dear all, i am using compact logix l18er and control logix l63 i want to use message instruction in between this to i am not getting proper...
Replies
6
Views
3,809
Hello there, I'm working on adding a historian, of sorts, to a PLC project where I'd like the data that is being stored to be reset on a certain...
Replies
15
Views
4,145
Hello, I am using the DCS instruction for a simple emergency stop detection. Actually I set the "cold start type" to automatic. This means when...
Replies
3
Views
2,487
Manual tuning this instruction as with older pid's " set Kp until oscillates and half it then increase Ki until offset is correct to sufficient...
Replies
1
Views
1,924
Back
Top Bottom