
Chapter 8 MODBUS Communications
|
ASDA-B Series
Revision January 2009
8-15
The following is an example of CRC generation using C language. The function takes two arguments:
unsigned char* data;
unsigned char length
The function returns the CRC value as a type of unsigned integer.
unsigned int crc_chk(unsigned char* data, unsigned char length) {
int j;
unsigned int reg_crc=0xFFFF;
while( length-- ) {
reg_crc^= *data++;
for (j=0; j<8; j++ ) {
if( reg_crc & 0x01 ) { /*LSB(bit 0 ) = 1 */
reg_crc = (reg_crc >> 1)^0xA001;
} else {
reg_crc = (reg_crc>>1);
}
}
}
return reg_crc;
}
PC communication program example:
#include<stdio.h>
#include<dos.h>
#include<conio.h>
#include<process.h>
#define PORT 0x03F8
/* the address of COM 1 */
#define THR 0x0000
#define RDR 0x0000
#define BRDL 0x0000
#define IER 0x0001
#define BRDH 0x0001
#define LCR 0x0003
#define MCR 0x0004
#define LSR 0x0005
#define MSR 0x0006
unsigned char rdat[60];
/* read 2 data from address 0200H of ASD with address 1 */
unsigned char tdat[60]={‘:’,’0’,’1’,’0’,’3’,’0’,’2’,’0’,’0’,’0’,’0’,’0’,’2’,’F’,’8’,’\r’,’\n’};
void main() {
Содержание ASD-B0121-A
Страница 1: ......
Страница 13: ...Table of Contents ASDA B Series Revision January 2009 This page intentionally left blank...
Страница 18: ...Chapter 1 Unpacking Check and Model Explanation ASDA B Series Revision January 2009 1 5 ECMA Series Servo Motor...
Страница 53: ...Chapter 3 Connections and Wiring ASDA B Series 3 28 Revision January 2009 3 6 2 Speed Control Mode...
Страница 54: ...Chapter 3 Connections and Wiring ASDA B Series Revision January 2009 3 29 3 6 3 Torque Control Mode...
Страница 55: ...Chapter 3 Connections and Wiring ASDA B Series 3 30 Revision January 2009 This page intentionally left blank...
Страница 72: ...Chapter 4 Display and Operation ASDA B Series Revision January 2009 4 17 Figure 4 7...
Страница 75: ...Chapter 4 Display and Operation ASDA B Series 4 20 Revision January 2009 Figure 4 9...
Страница 77: ...Chapter 4 Display and Operation ASDA B Series 4 22 Revision January 2009 Figure 4 10...
Страница 79: ...Chapter 4 Display and Operation ASDA B Series 4 24 Revision January 2009 Figure 4 11...
Страница 92: ...Chapter 4 Display and Operation ASDA B Series Revision January 2009 4 37 Figure 4 21...
Страница 93: ...Chapter 4 Display and Operation ASDA B Series 4 38 Revision January 2009 This page intentionally left blank...
Страница 115: ...Chapter 5 Trial Run and Tuning Procedure ASDA B Series 5 22 Revision January 2009 This page intentionally left blank...
Страница 255: ...Chapter 9 Maintenance and Inspection ASDA B Series 9 4 Revision January 2009 This page intentionally left blank...
Страница 277: ...Chapter 11 Specifications ASDA B Series 11 10 Revision January 2009 11 4 Servo Motor Speed Torque Curves T N Curve...
Страница 291: ...Chapter 12 Application Examples ASDA B Series 12 2 Revision January 2009 PLC Program...
Страница 292: ...Chapter 12 Application Examples ASDA B Series Revision January 2009 12 3...
Страница 293: ...Chapter 12 Application Examples ASDA B Series 12 4 Revision January 2009...
Страница 296: ...Chapter 12 Application Examples ASDA B Series Revision January 2009 12 7 HMI DOP A HMI Program Screen Homing Operation...
Страница 297: ...Chapter 12 Application Examples ASDA B Series 12 8 Revision January 2009 Position Control 1...
Страница 298: ...Chapter 12 Application Examples ASDA B Series Revision January 2009 12 9 Position Control 2...
Страница 299: ...Chapter 12 Application Examples ASDA B Series 12 10 Revision January 2009 JOG Operation...
Страница 302: ...Chapter 12 Application Examples ASDA B Series Revision January 2009 12 13...
Страница 305: ...Chapter 12 Application Examples ASDA B Series 12 16 Revision January 2009 Connecting to Delta DVP 01PU...
Страница 306: ...Chapter 12 Application Examples ASDA B Series Revision January 2009 12 17 Connecting to Mitsubishi FX1PG...
Страница 307: ...Chapter 12 Application Examples ASDA B Series 12 18 Revision January 2009 Connecting to Mitsubishi FX2N1PG...
Страница 308: ...Chapter 12 Application Examples ASDA B Series Revision January 2009 12 19 Connecting to Mitsubishi AD75...
Страница 309: ...Chapter 12 Application Examples ASDA B Series 12 20 Revision January 2009 This page intentionally left blank...