~ 30 ~
UBZ-304
NOVATEK-ELECTRO
ATTENTION! CHANGES OF THE COMMUNICATION SETTINGS (EXCEPT THE UNIT ADDRESS) WILL BE
EFFECTIVE ONLY AFTER DE-ENERGIZATION OF UBZ-304 OR AFTER FULFILLMENT OF THE COMMAND
"UBZ RESTART" ("RESTART") (it.5.4.11).
5.4.3 Communication protocol
Exchange between PC and UBZ is carried by data packets. Data packet format in
RTU
mode is shown in Table
5.3 and in
ASCII
mode
–
In Table 5.4.
Table 5.3
–
Data packet in
RTU
mode
Name
Description
START
Silence interval
–
over 4 ms at transmission rate of 9600 baud, or more 2 ms at
transmission rate of 19200 baud
ADR
UBZ communication address (8 bit)
CMD
Command code 8 bit
DATA 0
Content of data:
N*8 bit data (n<=24)
….
DATA (n-1)
CRC CHK low
CRC
–
Cyclic Redundant Check
16 bit
CRC CHK high
END
Silence interval
–
over 4 ms at transmission rate of 9600 baud, or more 2 ms at
transmission rate of 19200 baud
5.4.4 Command codes
5.4.4.1
General
The format of data characters depends on command codes. Examples of transmission of commands and data
are given for
RTU
mode. For
ASCII
mode the command codes are not changed, but the format of the transmission
data and control of data is based on the Table 5.4.
Table 5.4
–
Data packet in
ASCII
mode
Name
Description
STX
Start character ':' (3A Hex)
ADR1
UBZ communication address (8 bit) consisting of two ASCII characters
ADR0
CMD1
Command code 8 bit consisting of two ASCII characters
CMD0
DATA 0
Content of data:
N*8 bit data (n<=24) consisting of two ASCII characters
….
DATA (n-1)
LRC CHK 1
LRC Cyclic Redundant Check:
8-bit
control total consisting of two ASCII characters
LRC CHK 0
END1
The end of characters: END1= 0D Hex
–
carriage return (CR);
END0 = 0A Hex
–
line feed (LF)
END0
5.4.4.2
Command for reading the register group
Table 5.5
Command message
Response message
ADR
0x01
ADR
0x01
CMD
0x03
CMD
0x03
Start address of data
0x21
0x02
Number of data in bytes
0x04
Number of data in words
0x00
0x02
Content of data at address
0x17
0x70
CRC CHK low
0x6F
Content of data at address
0x00
0x00
CRC CHK high
0xF7
CRC CHK low
0xFE
CRC CHK high
0x5C
Command code
–
0x03, reading n-words
For example, reading of continuous 2 words from starting address 2102H in UBZ with communication
address 01H in
RTU
mode (Table 5.5) and in
ASCII
mode (Table 5.6)
Note
–
In UBZ during fulfillment of one command 12 registers (n=12) are possible to be read.