RSLogix 5000 SINT to INT

NetNathan

Lifetime Supporting Member
Join Date
Nov 2011
Location
Corona, CA
Posts
2,199
I have am programming a Controllogix PLC.
I have an Anybus AB7007 Communicator talking Modus RTU to a temperature controller.
The tags it is reading in through the "Generic Ethernet Module" (GEM) are configured as SINT in the GEM.
But the values are actually INT. Regrettably, I cannot get the GEM to work when configured for INT.

I would be nice if there was a SINT to INT instruction, but no luck...or am I missing it. It seems logical that there would be this instruction.

Is there a way to convert the 2 tags from SINT to a single INT tag in Controllogix?
 
Last edited:
A simple copy should do the trick. Since Modbus doesn't have native support for floats, the same process is used for getting float values... copy two INTS to a single REAL.
 
You should just be able to do a MOV from the SINT tag to an INT tag, and the controller handles the data type conversion for you.
 
No - he does want a COPy. The information is actually an INT but is being sent as two SINTs. If the two SINTs are in an array ( RcvSINT[0], RcvSINT[1] ) then COP RcvSINT[0] DestINT 1 should do it.
 
No - he does want a COPy. The information is actually an INT but is being sent as two SINTs. If the two SINTs are in an array ( RcvSINT[0], RcvSINT[1] ) then COP RcvSINT[0] DestINT 1 should do it.

You're right, I missed that he's trying to convert two SINTs to the same INT. One SINT to one INT the MOVe would work.
 
So if Tag:I.Data(4) and Tag:I.Data(5) contain the SINT, then, in the COP instruction I want to show Tag:I.Data(4) as Source and the INT tag a destination and a length of 1?

RSlogix will know to grab Tag:I.Data(4) and Tag:I.Data(5) to do the conversion to INT or should it be a length of 2?
 
So if Tag:I.Data(4) and Tag:I.Data(5) contain the SINT, then, in the COP instruction I want to show Tag:I.Data(4) as Source and the INT tag a destination and a length of 1?

RSlogix will know to grab Tag:I.Data(4) and Tag:I.Data(5) to do the conversion to INT or should it be a length of 2?

Then length should be 1. The length field is the number of destination elements to copy to. It will start at the location indicated in the source and copy until the length of (in this case) 1 destination element (your INT tag) is full.

The one thing you should be aware of is that this is a straight bit for bit copy. Its not doing any actual data type conversions. I have run into situations before where the source SINT's needed to be swapped before being copied into the INT. In other words I had to copy (5) and then (4) rather than (4) and then (5). You can use a bit field distribute (BTD) instruction to accomplish this if necessary.
 
Yes- that is what I was doing. Bringing it into our PLC from the Anybus to an INT in the PLC. I went through all this and also tried to configure for INT on the GEM and had no luck either. Even with Anybus support. This is what I had to do and it's been working out in the field for the last 2 years.
 
Eureka! I have good data...
The lady at Anybus Tech Support (Maribel Geroy) stuck with me to get this working.
I finally got a working cfg file from her. (She had actually only sent me 2.)

She took care of the byte swap in the Anybus module, so I got a true integers on all my needed data.

How it was done by her:
"I’m very glad it worked and yes, what I did is to configure the gateway to swap every two bytes all the data that was reading under that command, so your PLC would read the correct value. If you go to your node and expand the Read Holding Registers command and then expand the Response, under Register Value there is a setting that allows the byte swapping, if you select that setting you will find a small description of what it does underneath."

I even got the Anybus AB7007 EDS file to work, so I do not have to mess with the "Generic Ethernet Module".
I had had previous problems with the EDS file even when the GEM was working.
I am a happy camper.
 
Last edited:
A simple copy should do the trick. Since Modbus doesn't have native support for floats, the same process is used for getting float values... copy two INTS to a single REAL.

Hej guys
it the same matter i have a question about the COP instruction
if i have an Ai card that sends me 16SINT meaning the 8 channels in groups of 2SINTs can i use the COP(SINT[0], INT[0],8) to get those 16 SINTs into 8INTs?

the way i understood that COP works is that it takes byte by byte from the source and copies it to destination to fill as many as the "lenght" says. Is that wright?
 

Similar Topics

Hello i have been trying to figure out a good way to take hex and convert it to an array of SINT[]. Here is what my failed attempt looks like.
Replies
5
Views
1,262
Can anyone explain to me what Sint,Int,Dint data types represent? or what they mean? I was watching one of the Ab's "How Do I" "Reference a tag in...
Replies
10
Views
56,202
Hi folks, in the alarm manager of Rslogix 5000, the tag-based alarm has been created. But when I tried to change the condition, it was found the...
Replies
0
Views
13
I am completely stuck on building a ladder program that requires a start button to be pressed 3 times to turn on motor 1. Then motor 2 starts...
Replies
20
Views
526
Back
Top Bottom