RS 500 ML 1400: Combine 2 consecutive Int Words in to a Long

theColonel26

Lifetime Supporting Member
Join Date
Feb 2014
Location
West Michigan
Posts
784
I am getting data from a modbus device and I need to combine 2 16 bit N registers in to 1 32bit L register.


I have tried a CPW
N242:2 -> L245:0 Length of 2
I get 292,552,705 when I should get 70,000


N242:3 is the lower register, N242:2 is the higher register.


Edit:


ooooooh see Screen shot of Help file for CPW.

I assume so I assume a ML1400 is Little Endian, but the device is Big Endian.



Ok so can I handle this without creating a 3rd register location to be a temp register for swamping the words?

2020-07-06_23-10-37.png
 
Last edited:
70,000 base 10 = 0x0001,1170 (base 16 i.e. hexadecimal)



292,552,705 base 10 = 0x1170,0001



N.B. Commas at powers of 1000 base 10 and 0x10000 base 16.


I trust you can take it from there?
 
Is a ML1400 big endian or little endian? :unsure:



the 16bit word endianness seems to match the device but the 2 words are swapped :unsure:


So either Rockwell is screwy or IFM is screwy.
 
Last edited:
The CPW is right for a ML1400. It is a bit for bit copy. The Length for CPW is the number of 16 bit "words" to copy. This is different than the COP which bases the length on the number of destination elements which can vary. The COP doesn't support some types of data with different element sizes in the Micrologix.

You might have to shuffle the words around prior to the CPW. I don't spend a whole lot of time trying to read the manuals and interpret word order when I can run a trial and if I get gibberish, swap the words...if I still get junk, swap the bytes...rarely you have to do both.
 
I don't spend a whole lot of time trying to read the manuals and interpret word order when I can run a trial and if I get gibberish, swap the words...if I still get junk, swap the bytes...rarely you have to do both.


Exactly, the number of times I have first figured out what works, before figuring out why it works is maddening, but that's the job.


Try this before the CPW:


XOR N242:2 N242:3 N242:2
XOR N242:2 N242:3 N242:3
XOR N242:2 N242:3 N242:2
 
I got it working

I just did 2 movess and dropped them in a temporary resister. Then did my CPW. I might work improving it later, right now I have to get this done LOL.
 

Similar Topics

I'm not super familiar with the Micrologix line of processors, but I am pretty familiar with RSLogix 500. I'm trying to simply copy a string to...
Replies
4
Views
297
I have a Allen Bradely 1500 that has a cracked board. It still works but needs replaced (battery is no longer connected). To make migration easier...
Replies
10
Views
3,215
Hello, I am using pulse train output to a stepper driver to control a stepper motor. It seems to work fine except when I use a Control Stop...
Replies
16
Views
3,311
Hello, I have an AB MicroLogix PLC (1400 1766-L32BWA), and I want to communicate with the SLC500 PLC (1747-L40C) has any of you already done so...
Replies
9
Views
4,270
Hi All. I can write an N7 value to a modbus register in an Automation Direct Servo but I can't read a holding register to an N7 address. I've...
Replies
3
Views
1,896
Back
Top Bottom