Array Value

PFrog

Member
Join Date
Apr 2011
Location
Ohio
Posts
83
Hello,

I have an array tag made up of 400 DINTS (in Rslogix 5000). I would like to check for values from DINT[1] through DINT[399]. If there are no values, I would like to set a value of 1 in DINT[0].

All the other DINTS in this array will have a value greater than 1. It would be cool if I could get the value from the head tag of the array, but it looks like I can't do this?

Any advice on this?


This is done in structured text.

Thanks,

Keith
 
I don't follow what you're asking. If all the other DINTs have a value greater than 1, they have a value and you would never place a 1 in DINT[0]. And what is the "head tag"? The last tag with a value?
 
What do you understand as "no values"... how do you go from a state of having values to having no values again?

Is no values equal to zero?

Otherwise, you need to cycle through the memory positions, check if there is a value there and if yes, place a 1 in the first position and jump off the loop.
 
What do you understand as "no values"... how do you go from a state of having values to having no values again?

Is no values equal to zero?

Otherwise, you need to cycle through the memory positions, check if there is a value there and if yes, place a 1 in the first position and jump off the loop.

Correct no values would be a zero value. I am indexing through this array, and stopping if I have a value to display it for a couple seconds. I move values in and out (zero on out) of each of these DINTs within the array. I would like to quickly check if there are values in the array from [1] to [399]. I could run each dint on its own, and compare it to zero, add them ,etc. but that would be a few hundred lines of code. Hopefully I made it a little more clear. THanks
 
This sounds similar to displaying possible multiple alarms one at a time with a delay for viewing.


That is exactly what I am doing, and I have it functioning properly. Was just looking for an easy, clean way, in ST, to check for values within each of the DINTs of the array. If they were all 0 I could set a value in [0] to display.
 
Before each full scan, looking at all positions 1-399, set a flag to zero. If the scan finds a non-zero value to display then set the flag to one. At the end of the full scan if the flag is still zero then set that as the value. I haven't used ST so I can't give you the correct syntax though the earlier post of a FOR loop sounds about right.
 
Last edited:
That is exactly what I am doing, and I have it functioning properly. Was just looking for an easy, clean way, in ST, to check for values within each of the DINTs of the array. If they were all 0 I could set a value in [0] to display.

You'd be better off, as AutoMax said, using the ladder-only FSC instruction. Because if it finds a non-zero register, the .POS tells you the first register that was non-zero, and you could move that value into your DINT[0] value. Unlatching the .IN and .FD bits would have the FSC continue on from the first found "alarm" to the second. And so on.

You can, of course, reinvent the wheel in ST if you choose. I'd suggest looking at the Help file for FSC, to give you the timing diagram and a full description of how it works (from the outside, not from the inside).

Good luck
 

Similar Topics

The analog array has 16 individual bits and each bit is an alarm. SCADA is having issues getting the BIT bool value. However they can get the...
Replies
9
Views
978
Hi. Not the fist time I'm saying this but just to give a background. 95% of my PLC programming has used Schneider over the last 10 years on...
Replies
66
Views
4,632
I am working on trying to create a an HMI program where the user can select a value from 1-25 and then enter a string, which will be placed into...
Replies
5
Views
1,027
Hello I wanna know if are some function to check what is the max value from an array or if I have to loop the array to compare all numbers to get...
Replies
4
Views
1,856
Sorry for the word salad title, I'm having trouble putting my problem into words. Basically I have two arrays of DINTs, both the same size...
Replies
29
Views
7,895
Back
Top Bottom