Modbus protokoll rs485: Difference between revisions

From Chaosdorf Wiki
No edit summary
 
(38 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=== Modbus Rtu 2 ===
=== Modbus Funktions Codes ===
 
{| class="wikitable"
! colspan="5"| Hex Data !! colspan="1"| Funktion
|-
| adr || fc  || ! colspan="3"| data .....  ||
|-
| ..  || 01  || ..  ||  ..  ||..  ||  Lese Ausgangsbit Status
|-
| ..  || 02  || ..  ||  ..  ||..  || Lese Eingangsbit Status
|-
| ..  || 03  || ..  ||  ..  ||..  || Lese Holding-Register Analog Ausgang
|-
| ..  || 04  || ..  ||  ..  ||..  || Lese Input-Register Analog Eingang
|-
| ..  || 05  || ..  ||  ..  ||..  || Schreibe Ausgangsbit
|-
| ..  || 06  || ..  ||  ..  ||..  || Schreibe Holding-Register Analog Ausgang
|-
| ..  || 0F  || ..  ||  ..  ||..  || * Funktion noch offen 
|-
| ..  || 10  || ..  ||  ..  ||..  || wird bei den China Modulen zum Anpassen der UID benutzt
|-
| ..  || 15  || ..  ||  ..  ||..  || Schreibe mehrfach Ausgangsbit 
|-
| ..  || 16  || ..  ||  ..  ||..  || Schreibe mehrfach Holding-Register (Daten für >16-bit) Analog Ausgang
|-
| ..  || 23  || ..  ||  ..  ||..  || *  Funktion noch offen
|-
|}


Hardware Resources:
* das sind wohl noch nicht alle Modbus Funktion Codes
es gibt wohl auch Sonderfunktionen die nur bei bstimmten Geräten vorhanden sind hier z.B. 0x10h setzten der UID


  *  RS485 communication interface
  *  TTL communication interface
  *  2 optocoupler isolation input
  *  2 way optocoupler isolation output
  *  A user button
  *  A user LED
  *  A power indicator
  *  A STM32F030F4 microcontroller
  *  2 relay status indicators LED lights
  *  Power supply terminal interface (12V power supply)


<br>
adr  -> device Adress oder auch UID - 1 Byte lang <br>
fc  -> Function Code 1 Byte <br>
data -> n Bytes<br>


Modbus RTU Instructions:
Modbus RTU Instructions:
Line 26: Line 50:
2. Set the address (communication using the device address, the default address is 01)<br>
2. Set the address (communication using the device address, the default address is 01)<br>
<br>
<br>
/ *************************************************************************************** / <br>
Set the address from from Broadcast to 0x01 , 0x02 , 0x03
Set the address to: 09<br>
 
01 10 00 00 00 01 02 00 09 66 56 // Current address 01 is changed to 09<br>
{| class="wikitable"
00 10 00 00 00 01 02 00 09 6B C6 // Broadcast Address Modified to 09<br>
|-
! Hex Byte  !! Funktion 
|-
| 00 10 00 00 00 01 02 00 01 6A 00  || Broadcast Address Modified to 01
|-
| 00 10 00 00 00 01 02 00 02 2A 01 || Broadcast Address Modified to 02
|-
| 00 10 00 00 00 01 02 00 03 EB C1  || Broadcast Address Modified to 03
|}
<br>
<br>
Read Address<br>
00 03 00 00 00 01 85 db<br>
Return:<br>
00 03 02 00 01 44 44 // 01 for Address<br>


/ *************************************************************************************** / <br>
Read Address at Broadcast Call <br>
 
{| class="wikitable"
|-
! Hex Byte  !! Funktion 
|-
| 00 03 00 00 00 01 85 db  || Send to Device ( Broadcast )
|-
| 00 03 02 00 01 44 44    || Receive from Device  '''01 for Address'''
|-
| 00 03 02 00 02 04 45    || Receive from Device  '''02 for Address'''
|-
| 00 03 02 00 03 C5 85    || Receive from Device  '''03 for Address'''
|-
|}
<br>
 
=== Modbus Rtu 2 ===
 
Hardware Resources:
Data register address
  *   RS485 communication interface
  *   TTL communication interface
  *   2 Input ( max. DC +12 Volt UB )
  *   2 Relay Output
  *   A user button
  *   A user LED
  *   A power indicator
  *   A STM32F030F4 microcontroller
  *   2 relay status indicators LED lights
  *   Power supply terminal interface (12V power supply)
 


Meaning of each byte:<br>
Meaning of each byte:<br>
[address 1]<br>
// --------------------------------------------<br>
No. 1 relay is on : 01 05 00 01 01 00 9d 9a<br>
<br>
<br>
Byte 1: address<br>
Byte 1:       address <br>
byte 2: function<br>
byte 2:       function <br>
byte 3 4: register address<br>
byte 3 4:     register address <br>
byte 5 6: register data<br>
byte 5 6:     register data <br>
byte 7 8: CRC check<br>
byte 7 8:     CRC check <br>
<br>
<br>
/ *************************************************************************************** / <br>
[Address 1]
// --------------------------------------------<br>
0 relay ON: 01 05 00 00 FF 00 8C 3A<br>
0 relay off: 01 05 00 00 00 00 CD CA<br>
// --------------------------------------------<br>
No. 1 relay ON: 01 05 00 01 FF 00 DD FA<br>
No. 1 relay off: 01 05 00 01 00 00 9C 0A<br>
// --------------------------------------------<br>
No. 2 relay open: 01 05 00 02 FF 00 2D FA<br>
No. 2 relay off: 01 05 00 02 00 00 6C 0A<br>
// --------------------------------------------<br>
/ *************************************************************************************** / <br>
off: 01 0F 00 00 00 08 01 00 FE 95<br>
all bright: 01 0F 00 00 00 08 01 FF BE D5<br>
/ *************************************************************************************** / <br>


Read all relay states:<br>
<br>
Send: 01 01 00 00 00 08 3D CC<br>
<br>
Return: 01 01 01 00 51 88 Relay fully closed<br>
<br>
Return: 01 01 01 03 11 89 All relays are on<br>
<br>
/ *************************************************************************************** / <br>
Read all input switch status<br>
Send: 01 02 00 00 00 08 79 CC // Read 8 input states<br>
Return: 01 02 01 00 A1 88<br>
<br>
<br>




[address 1 bzw. UID 0x01]<br>
Switch Single
{| class="wikitable"
! colspan="8"| Hex Data !! colspan="1"| Funktion
|-
| Adresse  || Funktion  || Reghigh || Reglow || Data 1 || Data 2 || CRChigh || CRClow || Funktion 
|-
| 01      || 05        ||  00  ||    00  ||    FF  ||  00    ||    8C  ||  3A  ||  0 relay ON
|-
| 01      || 05        ||  00  ||    00  ||    00  ||  00    ||    CD  ||  CA  ||  0 relay off 
|-
| 01      || 05        ||  00  ||    01  ||    FF  ||  00    ||    DD  ||  FA  ||  1 relay ON
|-
| 01      || 05        ||  00  ||    01  ||    00  ||  00    ||    9C  ||  0A  ||  1 relay off
|-
|}
all Funktion
{| class="wikitable"
! colspan="8"| Hex Data !! colspan="1"| Funktion
|-
| Adresse  || Funktion  || Reghigh || Reglow || Data 1 || Data 2 || Data 3 || Data 4 || CRChigh || CRClow || Funktion 
|-
| 01      || 0F        ||  00  ||    00  ||    00  ||  08  ||    01  ||  00  ||  FE    || 95    || Full Relay off
|-
| 01      || 0F        ||  00  ||    00  ||    00  ||  08  ||    01  ||  FF  ||  BE    || D5    || Full Relay on
|-
|          ||          ||        ||        ||        ||        ||        ||        ||        ||        ||
|-
|  01      || 02        ||  00    ||  00    ||  00    ||  08    ||        ||        ||  79    || CC    || Send : Read all input switch status
|-
|  01      || 02        ||  01    ||  00    ||        ||        ||        ||        ||  A1    || 88    || Return : 8 input states
|-
|}
Quelle - https://hacktronics.co.in/2-channel-relay-module/modbus-rtu-2-way-relay-output-2-way-input-switch-ttl-rs485-interface-communication
<br>


=== Modbus Rtu 4 ===
=== Modbus Rtu 4 ===
Line 89: Line 159:
   *  RS485 communication interface
   *  RS485 communication interface
   *  TTL communication interface
   *  TTL communication interface
   *  4 optocoupler isolation input
   *  4 Input ( Switch to GND !!!! NO + UB !!! )
   *  4 way optocoupler isolation output
   *  4 Relay Output
   *  A user button
   *  2 user button
   *  A user LED
   *  A user LED
   *  A power indicator
   *  A power indicator
Line 99: Line 169:




Modbus RTU command


Baud Rate: 9600 8 NONE 1
[address 1 bzw. UID 0x01]<br>
 
Switch Single


{| class="wikitable"
! colspan="8"| Hex Data !! colspan="1"| Funktion
|-
| Adresse  || Funktion  || Reghigh || Reglow || Data 1 || Data 2 || CRChigh || CRClow || Funktion 
|-
| 01      || 05        ||  00  ||    00  ||    FF  ||  00    ||    8C  ||  3A  ||  0 relay ON
|-
| 01      || 05        ||  00  ||    00  ||    00  ||  00    ||    CD  ||  CA  ||  0 relay off 
|-
| 01      || 05        ||  00  ||    01  ||    FF  ||  00    ||    DD  ||  FA  ||  1 relay ON
|-
| 01      || 05        ||  00  ||    01  ||    00  ||  00    ||    9C  ||  0A  ||  1 relay off
|-
| 01      || 05        ||  00  ||    02  ||    FF  ||  00    ||    xx ||  xx  ||  2 relay ON
|-
| 01      || 05        ||  00  ||    02  ||    00  ||  00    ||    xx  ||  xx  ||  2 relay off
|-
| 01      || 05        ||  00  ||    03  ||    FF  ||  00    ||    xx  ||  xx  ||  3 relay ON
|-
| 01      || 05        ||  00  ||    03  ||    00  ||  00    ||    xx  ||  xx ||  3 relay off
|-


/ *************************************************************************************** / <br>
Setting address is: 01<br>
00 06 40 00 00 01 5c 1b<br>
Setting address is: 02<br>
00 06 40 00 00 02 1c 1a<br>
Read address<br>
00 03 40 00 00 01 90 1b<br>
/ *************************************************************************************** / <br>
Read the software version<br>
00 03 00 04 00 01 c4 1a // [month] broadcast read (only by one device to address all practical, easy to test)<br>
0,003,000,800,010,419 [years] // broadcast read (only by one device to address all practical, easy to test)<br>
00 03 00 10 00 01 84 1e [when] // sub broadcast read (only by one device to address all practical, easy to test)<br>


Read the hardware version (PCB version)<br>
 
0,003,002,000,018,411 // broadcast read (only by one device to address all practical, easy to test)<br>
 
/ *************************************************************************************** / <br>
 
[1 Address]<br>
|}
 
 
all Funktion
 
{| class="wikitable"
! colspan="8"| Hex Data !! colspan="1"| Funktion
|-
| Adresse  || Funktion  || Reghigh || Reglow || Data 1 || Data 2 || Data 3 || Data 4 || CRChigh || CRClow || Funktion 
|-
| 01      || 0F        ||  00  ||    00  ||    00  ||  08  ||    01  ||  00  ||  FE    || 95    || Full Relay off
|-
| 01      || 0F        ||  00  ||    00  ||    00  ||  08  ||    01  ||  FF  ||  BE    || D5    || Full Relay on
|-
|          ||          ||        ||        ||        ||        ||        ||        ||        ||        ||
|-
|  01      || 02        ||  00    ||  00    ||  00    ||  08    ||        ||        ||  79    || CC    || Send : Read all input switch status
|-
|  01      || 02        ||  01    ||  00    ||        ||        ||        ||        ||  A1    || 88    || Return : 8 input states
|-
|}
 
<br>
<br>
Open relay 1<br>
 
01 05 00 01 01 00 9d 9a<br>
[https://hacktronics.co.in/4-channel-relay-module/4-channel-relay-module-programmable-w-opto-isolated-rs485-stm8s103f3 hacktronics.co.in/4-channel-relay-module]
Relay 1 closed<br>
01 05 00 01 00 00 9c 0a<br>
<br>
<br>
No. 2 relay open<br>
[https://github.com/TG9541/stm8ef/wiki/Board-C0135 github Board-C0135]
01 05 00 02 01 00 6d 9a<br>
 
No. 2 relay closed<br>
[https://wiki.chaosdorf.de/images/1/14/Modbus_RTU_4_Way_Relay_Module.pdf Modbus_RTU_4_Way_Relay_Module.pdf]
01 05 00 02 00 00 6c 0a<br>
 
===  DDS578R Energy Meter ===
 
MODBUS-RTU communication protocol Description:
 
1.the data format: <br>
Address + function code + data + CRC check code<br>
<br>
<br>
3 relay open<br>
2.the register type<br>
01 05 00 03 01 00 3c 5a<br>
This meter uses two types of registers, individually addressed<br>
3 Relay Off<br>
The first is the data register, read-only, using the command code 0x04 to read.<br>
01 05 00 03 00 00 3d ca<br>
The second category is the parameter register, readable and writable, using the command code 0x03<br>
read, write parameters using 0x10<br>
<br>
<br>
No. 4 relay open<br>
3.the data format<br>
01 05 00 04 01 00 8d 9b<br>
Float type data: Read the internal data within the meter in line with IEEE-754 standardv
4 Relay Off<br>
floating-point number, data format is 32-bit 4-byte single-precision floating-point data format.<br>
01 05 00 04 00 00 8c 0b<br>
Quanmie<br>
01 05 00 ff 00 00 fd fa<br>
All light<br>
01 05 00 ff ff ff fc 4a<br>
<br>
<br>
[2 Address]<br>
4、Data register list<br>
Open relay 1<br>
 
02 05 00 01 01 00 9d a9<br>
{| class="wikitable"
Relay 1 closed<br>
! colspan="4"| Data register address !! colspan="6"| Register Description
02 05 00 01 00 00 9c 39<br>
|-
| adr || fc  || highByte || lowByte || Description    || unit ||  Format        || Mode
|-
| xx  || 03  || 00        ||    00  || A phase voltage || V    || Floating point || Read-only
|-
| xx  || 03  || 00        || 02     || B phase voltage || V    || Floating point || Read-only
|-
| xx  || 03  || 00        || 04      || C phase voltage || V    || Floating point || Read-only
|-
| xx  || 03  || 00        || 08      || A line current  || A    || Floating point || Read-only
|-
| xx  || 03  || 00        || 0A      || B line current  || A    || Floating point || Read-only
|-
| xx  || 03  || 00        || 0C      || C line current  || A    || Floating point || Read-only
|-
| xx  || 03  || 00        || 10      || Total active power || KWh || Floating point || Read-only
|-
| xx  || 03  || 00       || 12      || A phase active power || KWh || Floating point || Read-only
|-
| xx  || 03  || 00        || 14      || B phase active power || KWh || Floating point || Read-only
|-
| xx  || 03  || 00        || 16      || C phase active power || KWh || Floating point || Read-only
|-
| xx  || 03  || 00        || 18      || Total reactive power || KWh || Floating point || Read-only
|-
| xx  || 03  || 00        || 1A      || A phase reactive power || Var || Floating point || Read-only
|-
| xx  || 03  || 00        || 1C      || B phase areactive power || Var || Floating point || Read-only
|-
| xx  || 03  || 00        || 1E      || C phase reactive power || Var || Floating point || Read-only
|-
| xx  || 03  || 00        || 2A      || A phase power factor ||  || Floating point || Read-only
|-
| xx  || 03  || 00        || 2E      || B phase power factor ||  || Floating point || Read-only
|-
| xx  || 03  || 00        || 2C      || C phase power factor ||  || Floating point || Read-only
|-
| xx  || 03  || 00        || 36      || frequency || frequency  || Floating point || Read-only
|-
| xx  || 03  || 01       || 00      || Total active electricity power  || KWh  || Floating point || Read-only
|-
| xx  || 03  || 04        || 00     || Total reactive electricity power|| KWh || Floating point || Read-only
|-
|}
 
 
The second category register (parameter register) read and operate read the meter Address:<br>
 
(HEX):01 03 00 08 00 02 45 C9<br>
 
Date descriptions
 
{| class="wikitable"
|-
! Data      !! Detailed description
|-
| 0x01      || Instrument address ( adr )
|-
| 0x03      || Function code, read parameter register ( fc )
|-
| 0x00 0x08 || reading the data from the 00 08 meter internal register address
|-
| 0x00 0x02 || Read data length for two words( four bytes )of data
|-
| 0x45 0xC9 || CRC checksum data for the front, where the high front and low in the post
|-
|}
 
Returns Data (HEX) 01 04 03 40 00 00 00 EF F3
 
{| class="wikitable"
|-
! Data      !! Detailed description
|-
| 0x01      || Instrument address
|-
| 0x03      || Function code, read parameter register
|-
| 0x04      || Returned data length is 4 bytes of data length
|-
| 0x40 0x00 0x00 0x00 || TUSB To RS485 Converterhe data returned as a 4-byte data type float
|-
| 0xEF 0xF3 || CRC checksum data for the front, where the high front and low in the post
|-
|}
<br>
<br>
<br>
 
===  USB To RS485 Converter ===
<br>
<br>
No. 2 relay open<br>
[https://www.ebay.de/itm/USB-To-RS485-Converter-Industrial-Upgrade-Protection-RS-485-USB-2-0-Converter/401720933781 USB-To-RS485-Converter] 
02 05 00 02 01 00 6d a9<br>
No. 2 relay closed<br>
02 05 00 02 00 00 6c 39<br>
<br>
<br>
3 relay open<br>
02 05 00 03 01 00 3c 69<br>
3 Relay Off<br>
02 05 00 03 00 00 3d f9<br>
<br>
<br>
No. 4 relay open<br>
''ll /sys/class/tty/*/device/driver''<br>
02 05 00 04 01 00 8d a8<br>
lrwxrwxrwx 1 root root 0 Dez 21 19:30 /sys/class/tty/ttyUSB0/device/driver -> ../../../../../../../../bus/usb-serial/drivers/pl2303/<br>
4 Relay Off<br>
02 05 00 04 00 00 8c 38<br>
Quanmie<br>
02 05 00 ff 00 00 fd c9<br>
All light<br>
02 05 00 ff ff ff fc 79<br>
/ *************************************************************************************** / <br>
No. 1 relay 1 channel status<br>
01 01 00 01 00 04 6c 09<br>
<br>
<br>
No. 1 Relay 2 channel status<br>
''lsusb''<br>
01 01 00 02 00 04 9c 09<br>
Bus 003 Device 014: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port<br>
<br>
<br>
Relay 1 3 Channel status<br>
01 01 00 03 00 04 CD C9<br>
<br>
<br>
4 channel relay 1 status<br>
 
01 01 00 04 00 04 7C 08<br>
https://developer.toradex.com/knowledge-base/uart-(linux)
/ *************************************************************************************** / <br>
Read the status of all input interfaces<br>
01 02 00 00 00 00 78 0a<br>

Latest revision as of 13:45, 25 January 2020

Modbus Funktions Codes[edit | edit source]

Hex Data Funktion
adr fc data .....
.. 01 .. .. .. Lese Ausgangsbit Status
.. 02 .. .. .. Lese Eingangsbit Status
.. 03 .. .. .. Lese Holding-Register Analog Ausgang
.. 04 .. .. .. Lese Input-Register Analog Eingang
.. 05 .. .. .. Schreibe Ausgangsbit
.. 06 .. .. .. Schreibe Holding-Register Analog Ausgang
.. 0F .. .. .. * Funktion noch offen
.. 10 .. .. .. wird bei den China Modulen zum Anpassen der UID benutzt
.. 15 .. .. .. Schreibe mehrfach Ausgangsbit
.. 16 .. .. .. Schreibe mehrfach Holding-Register (Daten für >16-bit) Analog Ausgang
.. 23 .. .. .. * Funktion noch offen
  • das sind wohl noch nicht alle Modbus Funktion Codes

es gibt wohl auch Sonderfunktionen die nur bei bstimmten Geräten vorhanden sind hier z.B. 0x10h setzten der UID



adr -> device Adress oder auch UID - 1 Byte lang
fc -> Function Code 1 Byte
data -> n Bytes

Modbus RTU Instructions:

Baud rate: 9600 8 NONE 1

Hexadecimal send
hexadecimal receive

Operation steps:
1. Software settings communication baud rate
2. Set the address (communication using the device address, the default address is 01)

Set the address from from Broadcast to 0x01 , 0x02 , 0x03

Hex Byte Funktion
00 10 00 00 00 01 02 00 01 6A 00 Broadcast Address Modified to 01
00 10 00 00 00 01 02 00 02 2A 01 Broadcast Address Modified to 02
00 10 00 00 00 01 02 00 03 EB C1 Broadcast Address Modified to 03


Read Address at Broadcast Call

Hex Byte Funktion
00 03 00 00 00 01 85 db Send to Device ( Broadcast )
00 03 02 00 01 44 44 Receive from Device 01 for Address
00 03 02 00 02 04 45 Receive from Device 02 for Address
00 03 02 00 03 C5 85 Receive from Device 03 for Address


Modbus Rtu 2[edit | edit source]

Hardware Resources: Data register address

 *   RS485 communication interface
 *   TTL communication interface
 *   2 Input ( max. DC +12 Volt UB ) 
 *   2 Relay Output 
 *   A user button
 *   A user LED
 *   A power indicator
 *   A STM32F030F4 microcontroller
 *   2 relay status indicators LED lights
 *   Power supply terminal interface (12V power supply)


Meaning of each byte:

Byte 1: address
byte 2: function
byte 3 4: register address
byte 5 6: register data
byte 7 8: CRC check


[address 1 bzw. UID 0x01]

Switch Single

Hex Data Funktion
Adresse Funktion Reghigh Reglow Data 1 Data 2 CRChigh CRClow Funktion
01 05 00 00 FF 00 8C 3A 0 relay ON
01 05 00 00 00 00 CD CA 0 relay off
01 05 00 01 FF 00 DD FA 1 relay ON
01 05 00 01 00 00 9C 0A 1 relay off


all Funktion

Hex Data Funktion
Adresse Funktion Reghigh Reglow Data 1 Data 2 Data 3 Data 4 CRChigh CRClow Funktion
01 0F 00 00 00 08 01 00 FE 95 Full Relay off
01 0F 00 00 00 08 01 FF BE D5 Full Relay on
01 02 00 00 00 08 79 CC Send : Read all input switch status
01 02 01 00 A1 88 Return : 8 input states

Quelle - https://hacktronics.co.in/2-channel-relay-module/modbus-rtu-2-way-relay-output-2-way-input-switch-ttl-rs485-interface-communication



Modbus Rtu 4[edit | edit source]

Specifications:

 *   RS485 communication interface
 *   TTL communication interface
 *   4 Input ( Switch to GND !!!! NO + UB !!! )
 *   4 Relay Output 
 *   2 user button
 *   A user LED
 *   A power indicator
 *   A STM32F030F4 microcontroller
 *   4 relay status indicators LED lights
 *   Power supply terminal interface (12V power supply)


[address 1 bzw. UID 0x01]

Switch Single

Hex Data Funktion
Adresse Funktion Reghigh Reglow Data 1 Data 2 CRChigh CRClow Funktion
01 05 00 00 FF 00 8C 3A 0 relay ON
01 05 00 00 00 00 CD CA 0 relay off
01 05 00 01 FF 00 DD FA 1 relay ON
01 05 00 01 00 00 9C 0A 1 relay off
01 05 00 02 FF 00 xx xx 2 relay ON
01 05 00 02 00 00 xx xx 2 relay off
01 05 00 03 FF 00 xx xx 3 relay ON
01 05 00 03 00 00 xx xx 3 relay off


all Funktion

Hex Data Funktion
Adresse Funktion Reghigh Reglow Data 1 Data 2 Data 3 Data 4 CRChigh CRClow Funktion
01 0F 00 00 00 08 01 00 FE 95 Full Relay off
01 0F 00 00 00 08 01 FF BE D5 Full Relay on
01 02 00 00 00 08 79 CC Send : Read all input switch status
01 02 01 00 A1 88 Return : 8 input states


hacktronics.co.in/4-channel-relay-module
github Board-C0135

Modbus_RTU_4_Way_Relay_Module.pdf

DDS578R Energy Meter[edit | edit source]

MODBUS-RTU communication protocol Description:

1.the data format:
Address + function code + data + CRC check code

2.the register type
This meter uses two types of registers, individually addressed
The first is the data register, read-only, using the command code 0x04 to read.
The second category is the parameter register, readable and writable, using the command code 0x03
read, write parameters using 0x10

3.the data format
Float type data: Read the internal data within the meter in line with IEEE-754 standardv floating-point number, data format is 32-bit 4-byte single-precision floating-point data format.

4、Data register list

Data register address Register Description
adr fc highByte lowByte Description unit Format Mode
xx 03 00 00 A phase voltage V Floating point Read-only
xx 03 00 02 B phase voltage V Floating point Read-only
xx 03 00 04 C phase voltage V Floating point Read-only
xx 03 00 08 A line current A Floating point Read-only
xx 03 00 0A B line current A Floating point Read-only
xx 03 00 0C C line current A Floating point Read-only
xx 03 00 10 Total active power KWh Floating point Read-only
xx 03 00 12 A phase active power KWh Floating point Read-only
xx 03 00 14 B phase active power KWh Floating point Read-only
xx 03 00 16 C phase active power KWh Floating point Read-only
xx 03 00 18 Total reactive power KWh Floating point Read-only
xx 03 00 1A A phase reactive power Var Floating point Read-only
xx 03 00 1C B phase areactive power Var Floating point Read-only
xx 03 00 1E C phase reactive power Var Floating point Read-only
xx 03 00 2A A phase power factor Floating point Read-only
xx 03 00 2E B phase power factor Floating point Read-only
xx 03 00 2C C phase power factor Floating point Read-only
xx 03 00 36 frequency frequency Floating point Read-only
xx 03 01 00 Total active electricity power KWh Floating point Read-only
xx 03 04 00 Total reactive electricity power KWh Floating point Read-only


The second category register (parameter register) read and operate read the meter Address:

(HEX):01 03 00 08 00 02 45 C9

Date descriptions

Data Detailed description
0x01 Instrument address ( adr )
0x03 Function code, read parameter register ( fc )
0x00 0x08 reading the data from the 00 08 meter internal register address
0x00 0x02 Read data length for two words( four bytes )of data
0x45 0xC9 CRC checksum data for the front, where the high front and low in the post

Returns Data (HEX) 01 04 03 40 00 00 00 EF F3

Data Detailed description
0x01 Instrument address
0x03 Function code, read parameter register
0x04 Returned data length is 4 bytes of data length
0x40 0x00 0x00 0x00 TUSB To RS485 Converterhe data returned as a 4-byte data type float
0xEF 0xF3 CRC checksum data for the front, where the high front and low in the post




USB To RS485 Converter[edit | edit source]


USB-To-RS485-Converter

ll /sys/class/tty/*/device/driver
lrwxrwxrwx 1 root root 0 Dez 21 19:30 /sys/class/tty/ttyUSB0/device/driver -> ../../../../../../../../bus/usb-serial/drivers/pl2303/

lsusb
Bus 003 Device 014: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port


https://developer.toradex.com/knowledge-base/uart-(linux)