Toky DL8A Series User Manual Download Page 4

Psge 04

2

4

2

2

2

2

2

2

2

2

2

1

1
1
1
1
1

6

8

10

12

14

16

29
30
31
32
33
34

0

1

2

3

4

5

6

7

8

1

2

3

5

1

2

3

4

5

6

7

9

10

11

13

12

8

4

Meter ADD

Function code

Meter ADD

Meter ADD

Function 
code

Function code

Start ADD
High bit

Start ADD
Low bit

Data byte

Length

high bit

Data byte

Length

low bit

CRC code low 

bit

CRC code high 

bit

0x01

0x01

0x01

0x10

0x00

0x01

0x00

0x02

0x10

0x08

0x10

0x00

0x01

0x00

0x04

0x00

0x00

0x03

0xE8

0x32

0xDD

0x02

0x83

0x02

0xC2

0xC1

Slave normal answer (write multi-register)

Slave abnormal answer(Read multi-register)

Data 1
high bit

Data 1
low bit

Data 2
high bit

Data 2
low bit

CRC code
low bit

CRC code 
high bit

CRC code low bit

CRC code high bit

Error code

1

2

3

5

4

Meter ADD

Function code

0x01

0x0000

0x0002

0x0004

0x0006

0x0008

0x000A

0x000C

0x000E

0x0010

0x001D

0x001E
0x001F

0x0020
0x0021
0x0022

0x90

0x02

0xCD

0xC1

Slave abnormal answer (write multi-register)

CRC code low bit

CRC code high bit

Error code

Abnormal answer: (For example: host request function code 0x03

2. Write multi-register

For example: Host write HY1 (1st alarm value hysteresis 1.0)

ADD code of HY1 is 0x0001

 because HY1

4 byte

),

 seizes 2 data registers. The hexadecimal  memory code of decimal floating point number 

1.0 *1000=1000 is 0x000003E8. 

Host request (write multi-register)

Data byte
Length

Start ADD

high 8 bit

Start ADD

low 8 bit

Data byte Length

high bit

Data byte Length

low bit

Data location error response: (For example:Host request the ADD index is 0x0050)

Address Mapping Table of Meter Parameters

No

ADD 

mapping

Variable name

Data

Length

Range

Read/write

Rate

Remark

1st loop alarm value  AL1

1st loop alarm hysteresis HY1

2nd loop alarm value AL2

2nd loop alarm hysteresis HY2

Coefficient Ct

Analog output high limit value rH

Analog output low limit value rL

Amendment value PS

Read measured value

-1999~9999

-1999~9999

-1999~9999

-1999~9999

0~9999

-1999~9999

-1999~9999

-1999~9999

0~9999

0~2
0~1
0~1
0~3
0~1

0x255

R/W

0.001

0.001

0.001

0.001

0.001

0.001

0.001

0.001

0.001

R/W

R/W

R/W

R/W

R/W

R/W

R/W

R/W
R/W
R/W

R
R
R

R

Reserve

Reserve

INP measure channel
1st loop alarm type Ad1
2nd loop alarm type Ad2
Alarm status indication
Baud rate
Meter address Add

1

1
1
1
1
1
1
1

35

0x0023

0xD1

R

Meter name

Note 

Note 

Note 

Note 

R: read only;  R/W: read/write.
Note 

①:

alarm type

High limit alarm

Communication value

Communication 

value

Low limit alarm

Communication value

H

1

L

0

1

9.6

0

4.8

Note 

: baud rate

Menu display

Note 

: alarm status indiction

D7

D6

D5

D4

D3

D2

D1

D0

AL2

AL1

16 digits CRC check code acquisition program
unsigned int Get_CRC(uchar *pBuf, uchar num)
{
    unsigned i,j; 
 

unsigned int wCrc = 0xFFFF;

 

for(i=0; i<num; i++)

 

{

 

 

wCrc ^= (unsigned int)(pBuf[i]);

  for(j=0; 

j<8; 

j++)

 

 

{

 

 

 

if(wCrc & 1){wCrc >>= 1; wCrc ^= 0xA001; }

   else
    wCrc 

>>= 

1; 

 

 

}

 

}

       return wCrc;
}



Reviews: