This function reads a character from the receive buffer of the serial communications port that was opened last by ComOpen function.

Syntax

int GetCom(
  int timeout
);

Parameters

timeout
[in] timeout is the time (in steps of 20ms) that the routine tries to get a character from the communications port before returning.
This is the waiting time until this function reads 1 byte.
For example, timeout = 10 specifies 200 milliseconds.
When timeout = 0, the routine returns immediately. The range of values is 0 to 32,767.

Return value

On success, when a character is available, Getcom() returns the received character. On error -1 is returned.
ValueDescription
Positive integer Returns the received character.
ERROR Abnormal termination
(Including when the communication port is not open)

Remarks

It supports COM3, COM5 and COM9.
When no port is currently open, ERROR will be returned.

Requirements

Header file:
lib.h
Library file:
libSTARTUPOPH5000.a

Last updated: 2020/10/07