Open (FB)ΒΆ
FUNCTION_BLOCK Open EXTENDS CBM.ETrig
Open a serial com port.
The input Parameters are a list of settings, with which the COM port should be opened.
MyComOpen : COM.Open;
aParamsB115200 : ARRAY [1..7] OF COM.PARAMETER := [
    (udiParameterId := COM.CAA_Parameter_Constants.udiPort,             udiValue := 1),
    (udiParameterId := COM.CAA_Parameter_Constants.udiBaudrate,         udiValue := 115200),
    (udiParameterId := COM.CAA_Parameter_Constants.udiParity,           udiValue := COM.PARITY.NONE),
    (udiParameterId := COM.CAA_Parameter_Constants.udiStopBits,         udiValue := COM.STOPBIT.ONESTOPBIT),
    (udiParameterId := COM.CAA_Parameter_Constants.udiTimeout,          udiValue := 0),
    (udiParameterId := COM.CAA_Parameter_Constants.udiByteSize,         udiValue := 8),
    (udiParameterId := COM.CAA_Parameter_Constants.udiBinary,           udiValue := 1)
];
IMPLEMENTATION:
So to parameterize the FB looks like:
MyComOpen(usiListLength := SIZEOF(aParamsB115200)/SIZEOF(COM.PARAMETER), pParameterList := ADR(aParamsB115200));
...
- InOut:
- Scope - Name - Type - Comment - Inherited from - Input - xExecute- BOOLRising edge: Action startsFalling edge: Resets outputsIf a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values (- xDone,- xError) are present at the outputs for exactly one cycle.- ETrig - Output - xDone- BOOL- TRUE: Action successfully completed- ETrig - xBusy- BOOL- TRUE: Function block active- ETrig - xError- BOOL- TRUE: Error occurred, function block aborts action- FALSE: No error- ETrig - Input - usiListLength- USINT- Number of entries in the pParameterList - pParameterList- CAA.PVOID- Pointer to ARRAY of parameter entries - Output - eError- Local library error ID (0: no error; 5001: time out) - hCom- CAA.HANDLE- specific Outputs 
