![background image](http://html1.mh-extra.com/html/advantech/pcl-849/pcl-849_user-manual_2858275026.webp)
24
PCL-849 User's Manual
Programming
The following code fragment illustrates how the library functions can
simplify card programming, reducing setup time and avoiding bugs.
The following C program shows a simple data transfer test. It uses a
PC-ComLIB function call to send data between Port 1 and Port 2 at a
rate of 57.6 Kbps.
/* Execute the PC-ComLIB TSR driver first*/
#include<head-c.h>
main()
{
/*Setup PORT1 & PORT2 : baud = 57600 data = 8
stop = 1 no parity*/
sio_ioctl(1,B57600,BIT_8|P_NONE|STOP_1);
sio_ioctl(2,B57600,BIT_8|P_NONE|STOP_1);
/*Enable communication ports*/
sio_open(1);
sio_open(2);
/*Transmit data on Port 1*/
sio_write(1," Hello ",7);
delay(200)
/*Receive data on Port 2, store in buf1*/
sio_1input(2,buf1,7,13);
/*Print received data*/
printf("%s\n",buf1);
/*Disable communication ports*/
sio_close(1);
sio_close(2);
}
See the PC-ComLIB user’s manual for information on programming
and linking your application programs with the driver libraries.
Summary of Contents for PCL-849
Page 1: ...PCL 849 4 Port RS 232 Interface Card...
Page 4: ......
Page 5: ...Chapter 1 Introduction 3 1 Introduction C H A P T E R...
Page 9: ...Chapter 1 Introduction 7 Figure 1 1 Switch and jumper layout...
Page 10: ...8 PCL 849 User s Manual...
Page 11: ...2 Hardware Installation C H A P T E R...
Page 21: ...3 Software Installation C H A P T E R...
Page 31: ...Chapter 4 Wiring 29 4 Wiring C H A P T E R...
Page 35: ...Appendix A PC I O Address Assignments 33 A PC I O Address Reference A P P E N D I X...
Page 37: ...Appendix B Quick Reference 35 B Quick Reference A P P E N D I X...
Page 40: ...38 PCL 846 847 User s Manual...