11
‘A’ ‘0’ ‘D’ ‘D’
CR ‘0’ CR CR
End character
LF
LRC Checksum
‘3’
End character
LF
End character
LF
CR
End character
LF
*CR = 10H, LF = 0AH
LRC Checksum = 2’s complement of (A Function code + Hi byte of start a … )
For example: 01H + 03H + 10+ 00H + 00H + 02H = 16H, and LRC = 2’s complement of 16H = EAH
RTU Mode
Register Read (03H)
Response
Register Write (06H)
Response
Address 01H Address 01H Address 01H Address 01H
Function code
03H
Function code
03H
Function code
06H
Function code
06H
10H 10H
10H
Start address of
read data
00H
Data length (byte)
04H
Data address
01H
Data address
01H
00H 01H 03H 03H
Word length)
02H
Address 1000H
Data content
F4H
Data content
20H
Data content
20H
CRC Low byte
C0H
03H
CRC Low byte
DDH
CRC Low byte
DDH
CRC high byte
CBH
Address 1001H
Data content
20H
CRC high byte
E2H
CRC high byte
E2H
CRC
Low
byte
BBH
CRC high byte
15H
CRC Program Example:
unsigned int reg_crc = 0xffff;
i = 0; while (length--)
{ reg_crc ^= RTUData[i]; i ++;
for (j = 0; j < 8; j++)
{ if (reg_crc & 0x01) reg_crc = (reg_crc >> 1) ^ 0xA001;
else reg_crc = reg_crc >> 1;
} }
return(reg_crc);
4.
Address & Data Register Content
Address
Default
T
imer
Cou
nter
Ta
chom
e
te
r
Content
Remark
1000H
0
V
V
V PV1 (Low byte)
1001H
0
V
V
V PV1 (High byte)
1002H 0 V
PV2
(Low
byte)
1003H 0 V
PV2
(High
byte)
Available on batch, total, dual counter and mixed mode
1004H
0
V
V
V SV1 (Low byte)
1005H
0
V
V
V SV1 (High byte)
Read/write low byte (1004H) in advance is required.
1006H
0
V
V
V SV2 (Low byte)
1007H
0
V
V
V SV2 (High byte)
Read/write low byte (1006H) in advance is required.
1008H
0
V
V
V Select function
0: Timer; 1: Counter; 2: Tachometer; 3: Mixed function
1009H
0
V
Counter function
0: 1-stage; 1: 2-stage; 2: Batch; 3: Total; 4: Dual
100AH
0
V
V
V Input type
0: PNP; 1: NPN
100BH
0
V
Timer function
0: Counting up; 1:Counting down
100CH
0
V
Timer output mode
See Table 1 ”Timer Output Mode”
100DH
0
V
Counting unit for timer
See Table 1 ”Timer Display”
100EH
0
V
Input mode of counter
0: Counting up; 1: Counting down; 2: Command; 3:
Individual; 4: Quadrature
100FH 0 V
Dual
output
counting mode 0: Sum; 1: Subtract
1010H
0
V
Counter output mode
See Table 1 “Counter Output Mode”
1011H
4
V
V Counting speed
0: 1Hz; 1: 30Hz; 2: 200Hz; 3: 1kHz; 4: 5kHz; 5: 10kHz
1012H
2
V
V
Pulse width of output 1
Range: 0 ~ 9,999; Unit: 10ms, 0: Sustained mode
VARITEL INGENIERIA ELECTRONICA S.A.
[email protected] - www.varitel.com - Tel. (54) 11-4243-1171 / Fax: (54) 11-4292-7545
Manuel Baliña 456, Lomas de Zamora (B1832CCJ) Buenos Aires, Argentina.