Syntax
int comloc(void);
Parameters
None
Return value
Returns the number of received data or abnormal termination (ERROR).
Value | Description |
---|---|
Positive integer | Returns the number of received data. |
ERROR | Abnormal termination |
0 | No received data |
Remarks
It supports COM3, COM5 and COM9.
When no port is currently open, ERROR will be returned.
When no port is currently open, ERROR will be returned.
Requirements
Header file:
lib.hLibrary file:
libSTARTUPOPH5000.a
Sample
#include <stdio.h>
#include "lib.h"
void main(void)
{
int ch;
ComOpen(COM9); // Open the COM port
for(;;)
{
if (comloc() > 0 )
{
if ((ch=GetCom(0)) != -1)
{
putchar(ch);
}
}
if ((ch=getchar())!=EOF)
{
PutCom(ch);
}
Idle(); // Very important to lower the power consumption
}
}
Last updated: 2020/10/07