Cette fonction renvoie l'état du signal CTS du port série connecté au paramètre File, précédemment ouvert avec le FB SysSerialPort.
Fonction
CODESYS : indisponible
LogicLab : eLLabXUnified12Lib
Description
File (FILEP) Flux de données de flux renvoyé par le FB SysSerialPort.
La fonction retourne un (BOOL) FALSE Signal CTS non actif, TRUE signal CTS actif.
Exemples
Comment utiliser les exemples.
Dans l'exemple suivant, un port de communication série est ouvert et l'état du signal CTS est acquis, ce qui est pris en charge sur la variable CTSIn. Le contrôle des erreurs d'exécution est géré dans le programme en vérifiant si la dernière erreur a ObjectID 9993, relatif à la fonction.
LogicLab (Ptp116), ST_SysGetSerialCTS
PROGRAM ST_SysGetSerialCTS
VAR
CTSIn : BOOL; (* CTS signal status *)
IsError : BOOL; (* Execution error *)
Sp : SysSerialPort; (* Serial port management *)
END_VAR
// *****************************************************************************
// PROGRAM "ST_SysGetSerialCTS"
// *****************************************************************************
// The program allows to read the status of the serial CTS signal.
// -----------------------------------------------------------------------------
// -------------------------------------------------------------------------
// INITIALIZATION
// -------------------------------------------------------------------------
IF (SysFirstLoop) THEN
Sp.COM:=ADR('COM0'); //COM port definition
Sp.Baudrate:=19200; //Baudrate
Sp.Parity:='E'; //Parity
Sp.DataBits:=8; //Data bits
Sp.StopBits:=1; //Stop bits
Sp.DTRManagement:=DTR_AUTO_WO_TIMES; //DTR management
Sp.DTRComplement:=FALSE; //DTR complement
Sp.EchoFlush:=FALSE; //Received echo flush
Sp.DTROnTime:=0; //DTR On time delay (mS)
Sp.DTROffTime:=0; //DTR Off time delay (mS)
Sp.FlushTm:=0; //Flush time (mS)
Sp.RxSize:=0; //Rx buffer size
Sp.TxSize:=0; //Tx buffer size
END_IF;
// -------------------------------------------------------------------------
// DTR MANAGEMENT
// -------------------------------------------------------------------------
// The DTR signal is managed.
Sp(Open:=TRUE); //Serial port management
IF (Sp.Opened) THEN
CTSIn:=SysGetSerialCTS(Sp.File); //CTS signal status
// To check if execution error, check if the return is FALSE and last
// error code has the function ObjectID.
IF NOT(CTSIn) THEN
IsError:=((SysGetLastError(TRUE)/1000) = 9993); //Execution error
END_IF;
END_IF;
// [End of File]