RSLogix 5000 Converting

dbradford

Member
Join Date
Sep 2010
Location
Houston
Posts
8
I am using rslogix 5000 V20 and converting 2 INT to a real. The data from the real I am reading is lower than what is should be and not sure if the data from the module is giving it this way or if I am not doing my conversion correctly. If you look at this attachment, the AEG:I.Data[2] is in data format INT and wanting to copy [2] and [3] into a real. The main question I have is the Length correct? In the Rockwell literature is confusing because one says:

EXAMPLE
Convert INTs to a DINT

[FONT=Garamond,Bold][FONT=Garamond,Bold]


[/FONT]
[/FONT]
Elements 3 of INT_array is the lower 16 bits of the amount of free I/O
memory. Element 4 is the upper 16 bits.
[FONT=Garamond,Bold][FONT=Garamond,Bold]


[/FONT]
[/FONT]
Memory_IO_Free is a DINT tag (32 bits) in which to store the value for
the amount of free I/O memory.
[FONT=Garamond,Bold][FONT=Garamond,Bold]


[/FONT]
[/FONT]
To copy all 32 bits, specify a Length of 1. This tells the instruction to copy 1 times the size of
the Destination (32 bits). This copies both element 3 (16 bits) and element 4 (16 bits) and
places the 32-bit result in Memory_IO_Free.

but another states:

The number of bytes copied is:
Byte Count = Length * (number of bytes in the Destination data type)
Caut.jpg


If the byte count is greater than the length of the Source, unpredictable data is copied for the remaining elements.

What should the length be or is there another way I need to be converting the 2 INT to a real?



COP.JPG
 
Your length should be 1. The length of the copy is determined by the number of elements of the destination data type. If the destination data type is a REAL, which it presumably is in your attached screenshot, a length of 1 will copy two 16-bit integers byte-for-byte into the destination.

Keith
 
I recommend the CPS instruction instead of the COP instruction, just on the possibility that the instruction executes at the exact instant between the bytes being copied to the Input data table from the network module.

And do a sanity check to be sure the bytes are coming in from the network in the order you expect. Sometimes I have to swap words or swap bytes when doing this sort of thing.
 

Similar Topics

Looking for info on converting RSLogix 500 file to RSLogix 5000 format. 1747-L552 CPU is being changed out with the 1769L35E
Replies
3
Views
9,794
Hi all! I have a question here: I have installed in my computer the RS Logix 5000 versions 15.00 and 16.00 Because of specific reasons I'm...
Replies
3
Views
4,256
Long story short, the operator inputs a code that is always two letters and a single number for a process. I need to take that in rslogix5000 and...
Replies
13
Views
20,524
Does anyone know how to convert from a decimal number to a true binary output. For example convert the number 15 to 1111 and then be able to turn...
Replies
9
Views
14,647
Hello all, I have a question in regards to RSlogix 5000. I am having issues with the program force closing when I try to make online edits. We...
Replies
0
Views
95
Back
Top Bottom