Topic
[KB430]64 bit floating point values using Open Modbus TCP/IP protocol
Applies to:
PcVue version 8.2 SP2 and version 9.0 SP1. |
||
|
||
Summary:
This article explains how to retrieve 64 bit floating point values using the Open Modbus TCP/IP protocol. |
||
|
||
Details:
For this method it is necessary to understand the format of, and directly edit, the variable definition file VAREXP.DAT. 1/ Declare a word frame (16 bits) 2/ Create EQT variables (3 variables in the sample) as shown in the screenshot below. 3/ Map your variables every 4 words. 4/ Stop the project and change the variable type directly in the varexp.dat file using a text editor. – Original variable below (from file “original varexp.dat”):
REG,78,FRAME64,WORD0,,,,,,””,””,,,,,,E,0,0,0,0,0,1,0,0,0,0,,,1,MODBUS,PLC1,WORD_FRAME,U,0,0,16,,,,,,,,,,,,,,,,,,,,,,, ,0,0,65535,0,0,65535,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,””,””,””,,,””,””,,,,,,,,,,,,,,0,””,””,””,””,””,””,””,””,””,””,””,””,””,””,,,,,,,,,,,,0,0,,,0,,,,,,,,,,,,,,0,-1,-2,-2,0,””,,,,,,,,,,,,,,,,,,,,,,,,,,
REG,79,FRAME64,WORD2,,,,,,””,””,,,,,,E,0,0,0,0,0,1,0,0,0,0,,,1,MODBUS,PLC1,WORD_FRAME,U,8,0,16,,,,,,,,,,,,,,,,,,,,,,,,0,0,65535,0,0,65535,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,””,””,””,,,””,””,,,,,,,,,,,,,,0,,””,””,””,””,””,””,””,””,””,””,””,””,””,,,,,,,,,,,,0,0,,,0,,,,,,,,,,,,,,0,-1,-2,-2,0,””,,,,,,,,,,,,,,,,,,,,,,,,,,
REG,80,FRAME64,WORD3,,,,,,””,””,,,,,,E,0,0,0,0,0,1,0,0,0,0,,,1,MODBUS,PLC1,WORD_FRAME,U,16,0,16,,,,,,,,,,,,,,,,,,,,,,,,0,0,65535,0,0,65535,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,””,””,””,,,””,””,,,,,,,,,,,,,,0,””,””,””,””,””,””,””,””,””,””,””,””,””,””,,,,,,,,,,,,0,0,,,0,,,,,,,,,,,,,,0,-1,-2,-2,0,””,,,,,,,,,,,,,,,,,,,,,,,,,,
– For PcVue to consider variables as 64 bits floating point values, you must change U to D and 16 to 64 as shown below:
REG,78,FRAME64,FLOAT0,,,,,,””,””,,,,,,E,0,0,0,0,0,1,0,0,0,0,,,1,MODBUS,PLC1,WORD_FRAME,D,0,0,64,,,,,,,,,,,,,,,,,,,,,,,,0,0,65535,0,0,65535,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,””,””,””,,,””,””,,,,,,,,,,,,,,0,””,””,””,””,””,””,””,””,””,””,””,””,””,””,,,,,,,,,,,,0,0,,,0,,,,,,,,,,,,,,0,-1,-2,-2,0,””,,,,,,,,,,,,,,,,,,,,,,,,,,
REG,79,FRAME64,FLOAT1,,,,,,””,””,,,,,,E,0,0,0,0,0,1,0,0,0,0,,,1,MODBUS,PLC1,WORD_FRAME,D,8,0,64,,,,,,,,,,,,,,,,,,,,,,,,0,0,65535,0,0,65535,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,””,””,””,,,””,””,,,,,,,,,,,,,,0,””,””,””,””,””,””,””,””,””,””,””,””,””,””,,,,,,,,,,,,0,0,,,0,,,,,,,,,,,,,,0,-1,-2,-2,0,””,,,,,,,,,,,,,,,,,,,,,,,,,,
REG,80,FRAME64,FLOAT2,,,,,,””,””,,,,,,E,0,0,0,0,0,1,0,0,0,0,,,1,MODBUS,PLC1,WORD_FRAME,D,16,0,64,,,,,,,,,,,,,,,,,,,,,,,,0,0,65535,0,0,65535,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,””,””,””,,,””,””,,,,,,,,,,,,,,0,””,””,””,””,””,””,””,””,””,””,””,””,””,””,,,,,,,,,,,,0,0,,,0,,,,,,,,,,,,,,0,-1,-2,-2,0,””,,,,,,,,,,,,,,,,,,,,,,,,,,
5/ Save varexp.dat and restart the project. You will be able to retrieve directly double float values. See in the attached sample project for an example AP_64BITS.zip Download attachments: AP_64BITS.zip |
||
|
||
|
Created on: 22 Feb 2011 Last update: 13 May 2024