unsigned 32 register in crimson 3

ERCfarcontrol

Member
Join Date
Apr 2015
Location
Fresno, Ca
Posts
63
I'm trying to read a u32 register from a fuel meter over modbus rtu. There isn't a unsigned integer option under the "treat as" field. I select the register as word as long. I also tried using word as word and tried an expression tag of (tag1)*65536+(tag2) but it doesn't work. Can anyone offer help in getting a u32 register to read valid data?
 
No plc. Using red lion g15 to read a Sage fuel meter totalizer register. See attached pic of register listing. Trying to read 312, current totalizer.

PXL_20201021_230051925.jpg
 
Another thing I might mention is what the individual registers are reading as u16's...


Register 312 is reading 17990
Register 313 is reading 54470


The totalizer on the meter itself reads 185542
 
I’m not a crimson guy so I’d have to test what you’re receiving in some code tomorrow. I would imagine that crimson, being a Modbus master has the ability to copy the two integers to a 32 bit word. With that said it wouldn’t surprise me if you had to do a byte swap to have workable value.
 
I've done it before using the expression in my first post, but it isn't working in this case.



Letting some gas bleed through I increased the totalizer by 2 to185544
Register1 unchanged at 17990
Register2 inccreased by 2 as well to 54472
 
I had changed scales heads on a working project and had to play around. I ended up using the manipulation tab right above treat as tab and set to reverse bytes.

Capture.PNG
 
It is easier to see the problem if you go to binary format.
Code:
185542 = 00000000 00000010 11010100 11000110 - as should be
54470  = -------- -------- 11010100 11000110 - Register 2
17990  = 01000110 01000110 -------- -------- - Register 1
So Register 2 is bang on, but Register 1 is wrong, you need to look at Register 1, you should just have 3 in there.
 
I am reading properly now. Two things I had to change. Word ordering needed to be low then high, and the register offset needed to be increased by 1. I tried both things yesterday evening, just not together.


Bryan, you telling me that register 1 needed to be 3 helped me out. I viewed registers 310 to 314 independently, register 313 read 54470 and register 314 read 3.


With that being said, the treat as field is signed integer. Will it still read properly when it gets to 2,147,483,647? Or something like that, Lol, I never got around to reading that data types for dummies book.
 
To be honest I didn't know what Crimson would do, so I made a simple database with tag1 and tag2, I set tag1 to 2147483647 decimal, and tag2 to (tag1 +1), you can see the result. If your value won't be bigger than 2147483647 then you don't have a problem, if it might then you need to fix it. Once I have figured that out I will be back to you. :)

32 bit signed integer.JPG
 
The unit I am working on now cannot burn more than 408,163 cu/ft of natural gas a day for air quality control...



2,147,483,647 / 408,163 = 5261 days = 14.4 years


I shouldn't worry about it. I'm sure the totalizer can be reset to 0 when sent in for calibration. Who knows where we will all be in 14 years anyways.
 
So detect a negative value and raise an alarm so the next guy knows what happened to his total gas usage figure. Maybe contact Red Lion tech support, they often seem to have ways to work around things that aren't even slightly obvious.
 
> and the register offset needed to be increased by 1


Hmm, the OP says they got it to work using the values in registers 313 and 314, but the image of the manual in post #3 says the totalizer is in (starts at?) register 312. Is this a 0-based (device) vs. 1-based (Modbus) issue?
 

Similar Topics

I'm having to make an AOI to use with a generic ethernet device because the manufacturer does not provide an AOP. I just want to do a sanity check...
Replies
13
Views
1,258
Is there a way in CX-Programmer to ad UINTs together with an instruction without a compiler warning. Ladder Rung: Warning: Instructions...
Replies
2
Views
1,248
Hello, I'm reading a modbus register 40125 I'm using a modbus poll program to read this register. If i read the register as a "signed" value it...
Replies
12
Views
9,289
PLC Programming Noob here... Converting a Micro/WIN program to RSLogix 5000. Anyway to do an Unsigned DINT in RSLogix 5000? Have a value of...
Replies
4
Views
4,232
I have a cognex camera that is transmitting a trigger id as an unsigned integer. However, everything in siemens displays it as a signed integer...
Replies
10
Views
6,211
Back
Top Bottom