Decode a block of data

justshoot2125

Member
Join Date
Sep 2010
Location
wisconsin
Posts
17
Hello, I'm new to the contrologix platform with only two years under my belt with it. Some of the instructions I noticed are no longer there (from slc days) and some to be honest don't have a clue of there purpose. Anyways on to my delema.

We have a device that we pull information from in a 256 word block, it uses modbus/tcp. We then run it through a converter to ethernet ip for AB. and connect it to a contrologix platform or compactglogix. The issue we have is imbedded in each word of the block is actually two pieces of data or sets, one high and one low. We use a BTD instruction to break out the information first doing the high group source bit 8 ((((BTD(word[10],8,newword[10],0,8))))) then the low word with source bit 0, ((((BTD(word[10],0,newword[11],0,8))))). This would go on for word 11 and newword 12 and 13, so on and so on depending on how much data we might need or using. Usually its from word 10 to word 172, and give newwords of 324.

Instead of writing each btd instruction I would like to just pull that info. out of the word block of 256 words and write it to the newword block of 512 words. Is there a easy way to achieve this or has someone done something similiar to this that could give some guidence.
 
I would make an AOI that you would give the "networkword" and "newword" to and have it index through each one to the BTD instruction. That way you would cycle through 1 BTD instruction 512 times instead of writing 512 BTD instructions!
 
Last edited:
Well that was my original thought too but it doesn't work, because two btd would be needed with indexed addressing and seperate increments and it gets real messy and starts actually taking the scan time down to nothing. Then it starts messing with other functions.
 
Don't quote me, and I can't test it at the moment, but I seem to remember that in a Micrologix 1400, copying a Long into a Integer would copy the LSBs into the first register, then the MSBs into the next, like so:

COPW L15:0 N7:0 2

Would put data into N7:0 to N7:3.

Could you maybe try this with INT and SINT arrays in the Control/Compactlogix?
 
Is this a new program or an addition to something existing? If new, can you just operate on SINTs? If so:

word[256] is an integer array
newword[512] is a SINT array

COP(word[0], newword[0], 512)

would do the trick. This assumes that the SINT values are either bipolar (-128 to 127) or you don't specifically care about the sign.

If you need newword[] to be a 16-bit integer, I would still copy word[] to a SINT array and then use indirect addressing to move them over.

Also, does this have to occur in a single scan?

Keith
 
Looks like kamenges and I have the same general idea, but he certainly articulated it better!

We cheeseheads gotta help each other out :)
 
Well thank you both for the help. Its a revision to a old program which now has add on instructions to do alot of the BS programming we use to do. For some reason I remember I started to use the copy instruction but don't remember why we went a differnt route with the btd instructions. My first gut tells me that I don't care about the sign but lately that's been biting me. I would like to do it in one scan as we are monitoring temperatures and making shutdown decisions. Ill post back after testing and let you both know how it worked out. Thank you both again
 
Last edited:

Similar Topics

I can't seem to sort out how to decode this into useful numbers. Maybe I'm tired and this will be obvious tomorrow but it hasn't been all day...
Replies
36
Views
6,744
Where am I going wrong here? I'm trying to turn a modbus register into the expected value of around 375 as displayed on the instrument. According...
Replies
21
Views
5,621
I have a machine with a Maple Systems HMI5056T and I can download from the panel but can't open it in Easy Builder 5000. Tried to decode it but it...
Replies
2
Views
1,882
Looking to convert a decimal value to turn on a bit eg. like the DCD instruction in 500 where it converts a 4 to 1 of 16
Replies
3
Views
3,166
Good afternoon to all Need help in understanding the purpose of a case state "decode 4 to 1 of 16" any help is greatly appreciated. Thank you
Replies
5
Views
1,623
Back
Top Bottom