Dword to Real conversion Omron NX1P2

Abhidada10

Member
Join Date
Mar 2023
Location
Mumbai
Posts
2
Hello,

I am using Omron PLC: NX1P2 Software:-Sysmac Studio Plc in which I have to read data from an energy meter over Modbus RTU
The data that I receive is in 2-word registers

1) 40157:- 4248H
2) 40158:- 7A68H

want to convert this received value into Float/Real in PLC logic i.e. 50.11
Any suggestion or method to do this?

I have tried merging 2 words and converting them into Real by using
Dword_To_LReal but it didn't work it just simply converted those values to integers.šŸ™ƒ
 
It probably is a real number doing an int to real will not work it also looks like the words may be swapped I got 50.11954
So not done any in Omron for many years but somehow you need to bit copy the two registers into the float in Mitsubishi this is easy by using actual addresses i.e. MOV the last register (40158) to D0 MOV First register (40157) into D1 and use the D0 (D0+D1) as a float not sure you can do that in Omron an alternative is to mask move or bit copy into the float.
You could probably do a MOVL to say D100 & use D100 + D101 as the float as the movL will move Dx + Dx+1.
It would probably be better to do a MOV first Register to D101 & Second register to D100 then use D100 + D101 as the float.
 
Last edited:
I have just done it in CX1 programmer & it will work if you move the second (40158) into say D100 & the first (40157) into D101 then use D100 as a float it comes out at 50.11954
As I suspected, the two registers contain the floating point value so you do not need to convert it .
 

Similar Topics

Hello, I have been writing a program which reads values of reactive power from power analyser over Modbus RTU. Reactive power is represented by...
Replies
7
Views
10,624
I am needing to convert the low DWORD of a timestamp into a LREAL. The DWORD is a 32bit unsigned number. In TwinCat2, I keep getting a negative...
Replies
3
Views
1,688
Hey All, I'm looking for a simple way to take an incoming value in DWORD format and convert it to a real number. Does anyone know of a simple way...
Replies
4
Views
9,330
I'm trying to set alarm as DWord where each bit is individual alarm. So far I have tryed with DWord.0, DWord.1, DWord.2, etc. DWord.L0...
Replies
8
Views
826
Hello, I am provided with PLC tags with PLC_UDT datatype via symbolic connection. The structure of PLC_UDT (DI_hmi) is: DI_hmi.stat (UDINT)...
Replies
4
Views
1,444
Back
Top Bottom