Skip to content

Instantly share code, notes, and snippets.

@hdo
Created December 7, 2012 09:03
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hdo/4231981 to your computer and use it in GitHub Desktop.
Save hdo/4231981 to your computer and use it in GitHub Desktop.
Communication capture between application and energy meter via RS-485 (IEC62056-21)
Here is a short capture of a communication between the sample application and the energy meter using RS-485
Energy Meter: DRS110M, DRS155M (from http://www.bg-etech.de/)
/?!
/YTL:001511420144
[ACK]0:1
{SOH}P0{STX}(00000000){ETX}{BCC 0x60}[SOH]P1[STX]()[ETX][BCC 0x61]{SOH}B0{ETX}{BCC 0x75}[SOH]B0[ETX][BCC 0x71]
/?!
/YTL:001511420144
[ACK]0:1
{SOH}P0{STX}(00000000){ETX}{BCC 0x60}[SOH]P1[STX](00000000)[ETX][BCC 0x61]{ACK}[SOH]R1[STX]00000034()[ETX][BCC 0x64]{STX}00000034(001511420144){ETX}{ACK}[SOH]B0[ETX][BCC 0x71]
/?!
/YTL:001511420144
[ACK]0:1
{SOH}P0{STX}(00000000){ETX}{BCC 0x60}[SOH]P1[STX](00000000)[ETX][BCC 0x61]{ACK}[SOH]R1[STX]00000034()[ETX][BCC 0x64]{STX}00000034(001511420144){ETX}{ACK}[SOH]R1[STX]00000000()[ETX][BCC 0x63]{STX}00000000(2290){ETX}[SOH]B0[ETX][BCC 0x71]
/?!
/YTL:001511420144
[ACK]0:1
{SOH}P0{STX}(00000000){ETX}{BCC 0x60}[SOH]P1[STX](00000000)[ETX][BCC 0x61]{ACK}[SOH]R1[STX]00000034()[ETX][BCC 0x64]{STX}00000034(001511420144){ETX}{ACK}[SOH]R1[STX]00000000()[ETX][BCC 0x63]{STX}00000000(2291){ETX}
[SOH]R1[STX]00000001()[ETX][BCC 0x62]{STX}00000001(0000){ETX}{ETX}[SOH]R1[STX]00000010()[ETX][BCC 0x62]{STX}00000010(00000000){ETX}{ETX}[SOH]B0[ETX][BCC 0x71]
/?001511420144!
/YTL:001511420144
[ACK]0:1
{SOH}P0{STX}(00000000){ETX}{BCC 0x60}[SOH]P1[STX](00000000)[ETX][BCC 0x61]{ACK}[SOH]R1[STX]00000034()[ETX][BCC 0x64]{STX}00000034(001511420144){ETX}{ACK}[SOH]R1[STX]00000000()[ETX][BCC 0x63]{STX}00000000(2291){ETX}
[SOH]R1[STX]00000001()[ETX][BCC 0x62]{STX}00000001(0000){ETX}{ETX}[SOH]R1[STX]00000010()[ETX][BCC 0x62]{STX}00000010(00000000){ETX}{ETX}[SOH]B0[ETX][BCC 0x71]
Clarification:
--------------
Known registers:
READ (length)
#############
0: voltage (4)
1: current (4)
10: Energy (8)
34: Serial number (12)
36: Meter ID (12)
WRITE (length)
##############
34: Serial number (12)
36: Meter ID (12)
37: Password (8)
40: ClearEnergy (0)
{} receive from energy meter
[] send to energy meter
#################################################################
/?!
-> request data
/YTL:001511420144
<- identification
[ACK]0:1
-> ACK, BAUDRATE ':', MODE 1 (programming mode)
{SOH}P0{STX}(00000000){ETX}{BCC 0x60}
<- operation requires password 'P0'
[SOH]P1[STX]()[ETX][BCC 0x61]
-> send empty password
{SOH}B0{ETX}{BCC 0x75}
<- invalid password, exit!
[SOH]B0[ETX][BCC 0x71]/?!
-> exit, logout
#################################################################
/?!
/YTL:001511420144
[ACK]0:1
<-> (see above)
{SOH}P0{STX}(00000000){ETX}{BCC 0x60}
<- operation requires password 'P0'
[SOH]P1[STX](00000000)[ETX][BCC 0x61]
-> send '00000000' as password
{ACK}
<- ACK, password accepted
[SOH]R1[STX]00000034()[ETX][BCC 0x64]
-> request data in register 34
{STX}00000034(001511420144){ETX}{ACK}
<- return data in register 34
[SOH]B0[ETX][BCC 0x71]/?!
-> exit, logout
#################################################################
/?001511420144!
-> request data from energy meter with mether id '001511420144!'
/YTL:001511420144
<- identification
[ACK]0:1
-> ACK
{SOH}P0{STX}(00000000){ETX}{BCC 0x60}
<- operation requires password 'P0'
[SOH]P1[STX](00000000)[ETX][BCC 0x61]
-> send '00000000' as password
{ACK}
<- ACK, password accepted
[SOH]R1[STX]00000034()[ETX][BCC 0x64]
-> request data in register 34
{STX}00000034(001511420144){ETX}{ACK}
<- return data in register 34
[SOH]R1[STX]00000000()[ETX][BCC 0x63]
-> request data in register 0
{STX}00000000(2291){ETX}
<- return data in register 0
[SOH]R1[STX]00000001()[ETX][BCC 0x62]
-> request data in register 1
{STX}00000001(0000){ETX}{ETX}
<- return data in register 1
[SOH]R1[STX]00000010()[ETX][BCC 0x62]
-> request data in register 10
{STX}00000010(00000000){ETX}{ETX}
<- return data in register 10
[SOH]B0[ETX][BCC 0x71]
-> exit, logout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment