Indexing an Array

garlantm

Member
Join Date
Aug 2016
Location
Michigan
Posts
28
Hello All,

I am fairly new to the controls engineering roll and need help with stepping through an array. I need to compare a 16 bit array one bit at a time in an XOR to make sure our saftey system is communicating with the plc correctly. I want to use the move command to put the bits I need into the XOR with each clock cycle. Then if one of the bits is wrong it can flag for the error on the bit that has changed. How do I go about getting the move command to increment by just one bit in the array each cycle?

Thank you,
Trent
 
Massively important question: what PLC and software are you using?

You may be able to add 1 to an index each cycle, and then address the bits as arrayname[index]. You would need to make sure "index" never goes outside the array dimensions.
 
Do you truly have an array or just one 16 bit integer? Are all the bits used for safety? Are all the bits supposed to be zero? Just asking because you might not need to do a XOR. If it happened to be one INT that was supposed to always be zeros, you could just do a GRT than zero and then look at which individual bit is turned on (Safety_INT.0,Safety_INT., etc). If it's truly an array, you will probably have to "step" or index through the array. Your post asks about indexing through one bit so I'm thinking you don't have a true array. A little more info?
 
Last edited:
sorry guys I was trying to get a picture to help better. I am pulling this info from a safety gateway and I want to throw it onto an hmi after comparing each bit to show why the machine has stopped. It isn't an array it is just an int. I am using RSlogix5000 here is the picture.
photo1.jpg
[/URL][/IMG]
 
sorry guys I was trying to get a picture to help better. I am pulling this info from a safety gateway and I want to throw it onto an hmi after comparing each bit to show why the machine has stopped. It isn't an array it is just an int. I am using RSlogix5000 here is the picture.
photo1.jpg
[/URL][/IMG]

OK- Is this whole INT supposed to zeroes in normal conditions? If so-use the GRT than zero to flag an alarm and then ecflagreturn.X (X=whichever bit is a 1) can be displayed on your HMI.

If they are not all alarms and some may be changing states for other reasons, you will probably have to do a masked move (MVM) to pull only the bits that relate to safety bits. After you pull them to a new tag, you could use the GRT zero option i talked about.
 
Some are supposed to be 1's while others are supposed to be 0's but I need to be able to monitor them all because any of them changing means something different. That is why I would like to increment through them one at a time and use an XOR to detect if any are incorrect to flag an alarm.
 
Set up another INT with the individual bits set (or reset) according to the normal acceptable pattern. On each pass XOR this INT with the current status. If the result is not zero then proceed to the individual bit testing (step through the result to find the '1' bits). If the result was zero then everything is ok.
 
My knowledge is dated but, perhaps one of the DDT, FBC, DTR types would work here.
 

Similar Topics

Hello! The equipment I'm working on uses a lot of indexed tags I guess you'd call them. I thought it was indirect addresses maybe but all the...
Replies
9
Views
1,063
Hi Using RSlogix 5000 v13. I need to enter data from a hmi to an array ie StoreBarCode[0] where storebarcode is a string array. The code gets...
Replies
4
Views
2,291
Hi guys! Imagine you got taks someting like this: You got 6 motors and under some conditions you have to start one of them. That "one of them" has...
Replies
19
Views
5,892
Hi, We are developing an application on a S7-1200 that we have to use MB/TCP with. All is working ok, but we need to transfer recipe data from the...
Replies
6
Views
3,599
An interesting read for 2 hidden functions that i hadnt seen before...
Replies
2
Views
3,553
Back
Top Bottom