4.2.4 RS-485 Serial Communication Sample Program
The following sample program illustrates the use of the
#define DINBUFSIZE 15 #define DOUTBUFSIZE 15
void main( void ){ int nEcho,nReply; char cChar;
Jr485Init ();// Init RS485 Control (PD5) serDopen ( 9600 );// Open Serial Port D for (;;) {// Forever
for (cChar='a';cChar<='z';++cChar){
//Send Alphabet
Jr485Tx ();// Enable RS485 Transmitter serDputc ( cChar );// Send Byte while ((nEcho = serDgetc ()) ==
//Wait for Echo
Jr485Rx ();// Disable RS485 Transmitter while ((nReply = serDgetc ()) ==
printf ( "%02x
}
}
}
NOTE: If your version of Dynamic C is earlier than 6.55, see Technical Note 117, Jack- rabbit (BL1800 Series)
User’s Manual | 47 |