serClose (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.00 / 1.00.00


serClose will close the serial port. Use of the serial port after calling this function is not allowed.

 

Input:

port : SINT (0..127) (default 0)

Selects which serial port to close.

 

Returns:

None.

 

Declaration:

FUNCTION serClose;
VAR_INPUT
  port : SINT := 0;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
VAR
  ignition : BOOL;
END_VAR;
 
PROGRAM test;
VAR
  ser_open : BOOL;
END_VAR;
 
BEGIN
  ...
  IF ignition THEN
    IF NOT ser_open THEN
        IF serOpen(port:=1,baud:=57600) = 0 THEN
           ser_open := TRUE;
        ELSE
          DebugMsg(message:="serOpen - Failed!");
        END_IF;
    END_IF;
  ELSE
    IF ser_open THEN
        serClose(port:=1);
        ser_open := FALSE;
    END_IF;
  END_IF;
  ...
END;
END_PROGRAM;