Infinite L-com SRCN-C711-1 Скачать руководство пользователя страница 6

Data Write Format

 

ID 

Function Code 

Register Address 

Write Data 

CRC Check 

1 byte 

1 byte 

2 bytes 

2 bytes 

2 bytes 

1-247 (Decimal) 

06 

— 

— 

Low in front 

When the data returned by the module is consistent with the data sent, the relay is unlocked. 

Tips:

 The ID range in the command is in decimal format, please convert it to Hex (hexadecimal) format when using it. 

When user do not know the module ID, user can view or modify the ID directly through the function menu F09. User can also check the ID through the 

following commands: 

ID 

Function Code 

Register Address 

Write Data 

CRC Check 

1 byte 

1 byte 

2 byte 

2 byte 

2 byte 

FA 

03 

0x0064 

0x0001 

D0 

5E 

This command can only be used in stand alone state. 
The returned data is as follows: 

ID 

Function Code 

   Data Length 

ID 

CRC Check 

1 byte 

1 byte 

1 byte 

2 byte 

2 byte 

xx 

03 

00 

xx 

Low in front 

“xx” is the ID of the module here. 
Attachment: CRC check code 
Function: CRC check function, generate CRC 
Parameter description: arr_buff: array set to be verified 
len: the length of the data to be checked 
Return parameter: CRC is unsigned int type, High-order byte is high-order first, low-order last. 
 
unsigned int CRC_Compute (unsigned char *arr_buff, unsigned char len) 

unsigned int crc=0xFFFF; unsigned char i, j; 
for ( j=0; j<len; j++) 

crc=crc ^*a+; for ( i=0;  i<8;  i++) 

if( ( crc&0x0001) >0) 

crc=crc>>1;  crc=crc^ 0xa001; 

else 
crc=crc>>1; 


return ( crc); 

Отзывы: