Specifications

24 PCL-846/847 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.