Chapter 8 MODBUS Communications
Revision June 2010
8-15
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() {
int I;
outportb(PORT+MCR,0x08);
/* interrupt enable */
outportb(PORT+IER,0x01);
/* interrupt as data in */
outportb(PORT+LCR,( inportb(PORT+LCR) | 0x80 ) );
/* the BRDL/BRDH can be access as LCR.b7 == 1 */
outportb(PORT+BRDL,12);
outportb(PORT+BRDH,0x00);
outportb(PORT+LCR,0x06);
/* set prorocol
<7,E,1>
=
1AH, <7,O,1>
=
0AH
<8,N,2>
=
07H <8,E,1>
=
1BH
<8,O,1>
=
0BH
*/
for( I = 0; I<=16; I++ ) {
while( !(inportb(PORT+LSR) & 0x20) );
/* wait until THR empty */
outportb(PORT+THR,tdat[I]);
/* send data to THR */
}
I = 0;
while( !kbhit() ) {
if( inportb(PORT+LSR)&0x01 ) { /* b0==1, read data ready */
rdat[I++] = inportb(PORT+RDR); /* read data from RDR */
}
}
}
Summary of Contents for ASD-B2-0121-B
Page 1: ......
Page 13: ...Table of Contents xii Revision June 2010 This page intentionally left blank...
Page 17: ...Chapter 1 Unpacking Check and Model Explanation 1 4 Revision June 2010 ECMA Series Servo Motor...
Page 87: ...Chapter 4 Display and Operation 4 12 Revision June 2010 This page intentionally left blank...
Page 131: ...Chapter 6 Control Modes of Operation 6 22 Revision June 2010 Time Domain...
Page 267: ...Chapter 8 MODBUS Communications 8 18 Revision June 2010 This page intentionally left blank...
Page 271: ...Chapter 9 Maintenance and Inspection 9 4 Revision June 2010 This page intentionally left blank...
Page 291: ...Chapter 11 Specifications 11 8 Revision June 2010 11 3 Servo Motor Speed Torque Curves...