Array Value

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.
 
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

Hello! I'm looking for advice how to convert an array of SINT[5] into the Decimal value. Since the total value of the array is 40 bits, it's too...
19
Replies
4,407
Views
I have been working on this for awhile now and haven't been able to find any answers. I am monitoring some freezer temperatures at work. I am...
8
Replies
2,956
Views
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...
9
Replies
3,535
Views
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...
66
Replies
9,569
Views
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...
5
Replies
2,447
Views
Top