![background image](http://html1.mh-extra.com/html/icp-das-usa/i-8411/i-8411_user-manual_3619301084.webp)
I-8000 Series (C Language Based) User Manual, Version 1.0.1 Page: 84
Copyright © 2012 ICP DAS Co., Ltd. All Rights Reserved. E-mail: [email protected]
For example, reading and receiving data through the COM1.
#include <stdio.h>
#include “8000E.h”
void main(void)
{
int quit=0, data;
InitLib();
/* Initiate the upac5000 library */
InstallCom(1, 115200, 8, 0, 1);
/* Install the COM1 driver */
while(!quit)
{
if(IsCom(1))
/* Check if there is any data in the COM port input buffer */
{
data=ReadCom(1);
/* Read data from COM1 port */
ToCom(1, data);
/* Send data via COM1 port */
if(data==’q’) quit=1;
/* If ‘q’ is received, exit the program */
}
}
RestoreCom(1);
/* Release the COM1 */
}