ControlLogix (RSLogix 5000): Global Constants

Join Date
Dec 2016
Location
Southeast
Posts
134
More dumb questions from the 'Janitor:

In this program I've been looking through (that I didn't write), I see hard-coded constants which are against my coding religion.

What's the equivalent of a "#define ARRAYSIZE 500" on these PLCs? This program *could've* been written in structured text, but a contractor wrote it in ladder (unfortunately). Do I just have to declared a variable and set it to this value (hoping it never gets accidentally overwritten)?
 
I create variables and check the 'constant' box. This prevents the logic from changing the value under normal operation.
 
If I want a constant, I set up a ladder routine for all of them. Within the routine are simple MOV instructions. So instead of Define ArraySize 500, it's MOV 500 ArraySize. Very similar.
 
I think with the MOV, there is a risk someone accidentally writes a new value to it later on in the program, or a HMI screen somehow thinks it should write a 0 to that value (which would end up with that value true for half a scan). The constant checkbox is the way to go if you want a constant value, although MOV can increase readability.
 
I think with the MOV, there is a risk someone accidentally writes a new value to it later on in the program, or a HMI screen somehow thinks it should write a 0 to that value (which would end up with that value true for half a scan). The constant checkbox is the way to go if you want a constant value, although MOV can increase readability.

Sorry, I should have been more descriptive...that's in addition to the constant checkbox. And for the purpose you indicate...makes for better readability. It's usually called a setup routine as I do alot of similar work in my industry and just change these constants from job to job.
 
... and if you set the "constant" checkbox and some rogue index results in a write to this 'constant' value, can the program detect that?

Is there an exception with a 'warning' level, for example?
 

Similar Topics

I have installed rs logix 5000 v 20, and I have a project file (.acd) ehere the controller is 1756-L71..... my software does not contains 1756...
Replies
3
Views
3,745
I have a friend/customer that has a old program, they say its version 8.... anyone have anything they can open it with and print a PDF I can go...
Replies
6
Views
2,667
... more PLC101 questions for you experience Ladder lovers: Do these PLCs boot up with junk values in memory, and if so how do you typically...
Replies
12
Views
7,514
OK, the "Janitor" here with more dumb questions: I've got an Analog I/O point (AT-13) on a 1756-IF8 module which is configured as a 4-20 ma...
Replies
42
Views
12,537
Hi, I wish to verify the CPS instruction using RSLogix 5000 v20 on Controllogix PLC. Is there any method i could do this and generate a...
Replies
1
Views
4,219
Back
Top Bottom