Syntax
int ComOpen(
int port
);
Parameters
- port
-
[in] Specifies which communications port is to be opened.
See the table below for details.Value Description COM3 Bluetooth SPP (Master) COM4 Bluetooth HID (Slave) COM5 Bluetooth SPP (Slave) COM9 USB VCP COM10 USB HID
The default communication settings are different for each communication / boat number.
Set by calling the SetConfig function.
Return value
The function ends normally (OK) or returns a port specification error (ERROR).
Remarks
You cannot open multiple COM ports at the same time.
When a comport is opened the power consumption may increase,
so use the ComClose function when communication is no longer needed.
When a comport is opened the power consumption may increase,
so use the ComClose function when communication is no longer needed.
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 ((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