EasyManuals Logo

Chino KP3000 User Manual

Default Icon
88 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #26 background imageLoading...
Page #26 background image
- 23 -
LRC calculation method
Target extends from slave address to the end of the data and calculation is done by the following
procedure.
1) Create message in RTU mode.
2) Add from the beginning (Slave address) to the end of data. X
3) Get the complement (bit inversion) of X. X
4) Add 1.(X=X+1)
5) Add X as LRC at the end of the message.
6) Convert everything to ASCII character.
Example) When data is [02H][07H], LRC becomes [F7H] hence
Binary message becomes [02H] [07H] [F7H]
ASCII message becomes [30H] [32H] [30H] [37H] [46H] [37H]
Reference: LRC calculation program
/***** LRC calculation program (C language) *****/
#include <stdio.h>
#include <conio.h>
void main(void)
{
/*** Internal variable declaration ***/
unsigned short usData; /* Input data */
unsigned short usLrcData; /* LRC data */
int iDummy; /* Dummy variable */
/* Initialize the output result of LRC data */
usLrcData = 0;
printf(“ Enter hexadecimal data.(End using [q]) >\n”);
while( scanf(“%x”,&usData) != 0 )
{
/* Add from the beginning to the end of the data */
usLrcData += usData;
/* Cancel high order, 1 byte */
usLrcData = usLrcData & 0xff;
} /* while */
/* Get the exclusion with FFH */
usLrcData = usLrcData ^ 0xff;
/* Add 1 */
usLrcData = usLrcData++;
/* Cancel high order,1 byte */
usLrcData = usLrcData & 0xff;
/* LRC error check */
printf( “LRC-16 data is %xH..\n”, usLrcData );
iDummy = getch();
}

Table of Contents

Other manuals for Chino KP3000

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Chino KP3000 and is the answer not in the manual?

Chino KP3000 Specifications

General IconGeneral
BrandChino
ModelKP3000
CategoryController
LanguageEnglish

Related product manuals