UINT data type in RS 500 Pro

ETX.GSR

Member
Join Date
Jul 2015
Location
Texas
Posts
1
Hello all,
I'm new to the programming world and have encountered an issue in RS 500.
My situation goes like this. I have a tank stick bringing a level back to my AB 1400 as a Unsigned INT via Modbus. Recently my raw count and EU number became a negative number and after inspection of the stick I realized that the issue is that my data type in the controller is signed. I have looked the program over and can't find a spot to designate the point as UINT or INT. A more senior programmer I contacted said he believes 500 doesn't do Unsigned. Just wanted to check and see if this is correct and if so there's a way around it.

The sequence to receive the data is as follows.

Read in data on MSG block and point it to an N7 table.
SCP block to scale the data and convert to a Float.

Thanks in advance guys.
 
Welcome to the Forum !

The bad news is that there are no Unsigned datatypes in the RSLogix 500 environment.

The good news is that the MicroLogix 1400 does support a signed 32-bit integer, called a Long datatype. You have to create a new data table file with type Long (L), just like you would for a new Integer (N) data file.

Use the Copy Word (CPW) instruction to copy the bit pattern of two N data table elements (use a buffer to be sure the second word is empty, if you must) to a single Long data table element, and you should see the full magnitude of your 16-bit unsigned data value in that Long data table element.

Example: Let's say you moved the Modbus value to N10:0, and made sure that N10:1 was zero.

CPW
Source: N10:0
Dest: L11:0
Length: 1

The Length has to be 1 because it designates the number of Destination *elements*, which is one Long. The CPW instruction automatically grabs the necessary 4 bytes of data to fill up the Long datatype, which is why you need that empty N10:1 in there to avoid having the wrong data moved into the upper 2 bytes of the Long data table element.
 

Similar Topics

Hello, It is possible to change form INT to UINT a variable data type? For the moment, I receive the value -32766 (Local:6:I.Ch0Data) from...
Replies
4
Views
2,733
HI, I am trying to read a UINT 64 bit data(active energy parameter) from a PQA meter(WM5-96) over Modbus TCP into a GE PLC.I am able to read...
Replies
0
Views
1,576
I apologize for the basic question but I have read the documentation and searched online and I'm still not getting it... I want to convert UINT...
Replies
4
Views
999
I have a Compactlogix 5380. I am using the Modbus Client TCP IP Modbus Client to query a modicon 984. I am getting UINT from the Modicon into...
Replies
43
Views
5,443
I have a UDT with multiple elements that all show on the display perfectly using direct reference. For example I have the following instance on a...
Replies
2
Views
1,458
Back
Top Bottom