Availability | All terminals | ||||||||||
Description | Opens a port for communication. | ||||||||||
Syntax | int ComOpen( int port ); | ||||||||||
Arguments |
int portport specifies which communications port is to be opened. See the table below for details.
|
||||||||||
Returns |
|
||||||||||
Remarks |
When a comport is opened the power consumption may increase, so use the ComClose() function when communication is no longer needed. When you have opened a communication port with ComOpen() this port is automatically closed when another communication port is opened using ComOpen(). The functions GetCom() and PutCom(), will use the port opened by ComOpen(). |
||||||||||
Example |
#include <stdio.h> #include "lib.h" void main( void ) { int ch; ComOpen( COM9 ); // Open the USB-VCP port for(;;) { if( (ch = GetCom( 0 )) != -1) { PutCom( ch ); } Idle(); // Very important to lower the power consumption } } |