Omron NB Screen & NX1P2 PLC Real Number issue

srsicard3

Member
Join Date
Jun 2020
Location
CT
Posts
16
I am working on a project using a NB screen and NX1P2 PLC.
I am having a really hard time getting a real number to properly translate through to the PLC.
For example, i have 1.25 entered in a numeric entry box on the screen, the decimal format of the DWORD in the PLC shows up as 1067450368. I have tried different ways of converting including DWORD_TO_REAL, but i am unable to get the 1.25 or even an INT/DINT of 125 to show in the PLC.

Is there a trick for entering REAL numbers on an NB screen and taking that data into the PLC?

NB Screen Setup:
Numeric Data -
Storage Format: Float
Data Length: DWORD
Integer: 2
Decimal: 2

Variable Table -
Memory Type: Word
Area: H
Address: 110
Data Format: BIN

NX1P2 Setup:
Global Variable
Data Type: DWORD
AT: %H110
 
The byte order is fine.

You want to COPy the 32-bits from the DWORD tag into a REAL tag. If the NB cannot do that, then do the following:
  • dworig is the intial DWORD tag from the HMI, with a value of e.g. 1067450368
  • dwtmp is another DWORD tag.
  • reel is the result REAL tag
  • if dworig is 0, or -217483568, then reel is 0.0 or -0.0, respectively, and you are done. If not, then continue
  • Do a bit-wise AND of dworig with 8388607 (0x007FFFFF) and put the result into dwtmp (2097152).
  • Add 8388608 to dwtmp, MOVe (not COPy) the resulting value result into reel (10485760.0).
  • If dworig is negative, then make multiply reel by -1.0 and put the result back into reel (10485760.0; dworig is not negqative)
  • Divide reel by 8388608.0, put the resulting value into reel(1.25).
    • N.B. you are not done; it only appears that you are done because the value is in the range [1.0,2.0).
  • Do a bit-wise AND of dworig with 2139095040 (0x7f800000), put the result in dwtmp (1065353216)
  • Divide dwtmp by 8388608, put the result in dwtmp (127)
  • if dwtmp is 127, then you are done.
  • If dwtmp is less than 127, then subtract dwtmp from 127 and put the result in dwtmp, and the OP below will be divide
  • if dwtmp greater than 127, then subtract 127 from dwtmp and put the result in dwtmp, and the OP below will be multiply.
  • if
    • bit 0 of dwtmp is 1, then OP (divide or multiply) the value of reel by 2.0 and put the result in reel.
    • bit 1 of dwtmp is 1, then OP the value of reel by 4.0 and put the result in reel.
    • bit 2 ... by 16.0 ...
    • bit 3 ... by 256.0 ...
    • bit 4 ... by 65536.0 ...
    • bit 5 ... by 4294967296.0 ...
    • bit 6 ... by 1.8446744E+19 ...
 

Similar Topics

Hello, I have an Omron NT31C that I am trying to upload a screen to from my laptop. The software on my laptop is NT-series Support Tool ver...
Replies
4
Views
1,872
Hello all, I'm new to the Sysmac Studio software and I'm having an issue with the HMI screens crashing. I have a screen that shows the active...
Replies
1
Views
1,975
Hi. For a project I’m programming a 10 inch Omron NB hmi. Now, creating an event or alarm screen is no problem, however all event related screens...
Replies
2
Views
1,451
hi i have used the data history screen for data log purpose in Omron's NB Designer for HMI-NB7W-TW01B. i want to know if i will be able to clear...
Replies
1
Views
2,219
Dears I wonder if I can work and navigate on my Omron HMI NT21 through pages without connecting to the PLC because it sticks/freezes on "System...
Replies
3
Views
2,027
Back
Top Bottom