COM port function block
COM Port Open

FUNCTION_BLOCK FB_COMPORTOPEN
VAR_INPUT
bOpen :BOOL;
stComConfig :ST_COMCONFIG;
VAR_OUTPUT
bBusy :BOOL;
bErr :BOOL;
iErrId :WORD;
iHandle :WORD;
Legend
bBusy: The function block is active as long it is TRUE.
bErr: Error bit.
iErrId: Error number.
iHandle: pointer transfer.
| 
                   Return parameter iErrId  | 
                   Meaning  | 
|---|---|
| 
                   0  | 
                   No error  | 
| 
                   -1, 0xFFFF  | 
                   Incorrect COM port  | 
| 
                   -2, 0xFFFE  | 
                   Incorrect or unsupported baud rate. Check the parameter stComConfig.BaudRate.  | 
| 
                   -3, 0xFFFD  | 
                   Incorrect data format. Check the parameter stComConfig.  | 
| 
                   -4, 0xFFFC  | 
                   Incorrect initialization of the COM interface  | 
| 
                   -5, 0xFFFB  | 
                   Unsupported instance  | 
| 
                   -6, 0xFFFA  | 
                   Incorrect size of the RX buffer  | 
| 
                   -7, 0xFFF9  | 
                   Incorrect size of the TX buffer  | 
| 
                   -8, 0xFFF8  | 
                   COM port is blocked  | 
COM Port Close

FUNCTION_BLOCK FB_COMPORTCLOSE
VAR_INPUT
bOpen :BOOL;
iHandle :WORD;
Legend
bClose: rising edge starts the function block
 iHandle: pointer transfer of FB_COMPORTOPEN.
VAR_OUTPUT
bBusy :BOOL;
bErr :BOOL;
iErrId :WORD;
Legend
bBusy: The function block is active as long it is TRUE.
bErr: Error bit.
iErrId: Error number.
| 
                   Return parameter iErrId  | 
                   Meaning  | 
|---|---|
| 
                   0  | 
                   No error  | 
| 
                   > 0  | 
                   error number (#not documented#)  |