SerialPortEL600x
- Namespace
- ZEquipmentBeckhoff
- Implements
FUNCTION_BLOCK SerialPortEL600x IMPLEMENTS ZEquipmentBeckhoff.ISerialPort, ZCore.IObject, ZCore.IError
This function block can be used with a Beckhoff EL6001/EL6002 terminal for sending and receiving data packets through a RS232 serial channel interface. Sending data packets is done with a string variable type and the TransmitAsync. Receiving packets can be done bytewise with StartReceiveAsync. There are also some methods to check if the sending commands are executed correctly or if there were transmission errors.
The default transmission buffer size is set to 127 bytes. However if there is a larger buffer needed this size can be changed by editing the DataBufferSize parameter in the ParameterList of this library.
This function block should be used with the Zeugwerk Template to get the full advantages of automatically calling of the cyclic method.
Constructor
FB_init
METHOD FB_init (
[input] bInitRetains : BOOL,
[input] bInCopyCode : BOOL,
[input] parent : ZCore.IManagedObject) : BOOL
Inputs
bInitRetainsBOOLif TRUE, the retain variables are initialized (warm start / cold start)
bInCopyCodeBOOLif TRUE, the instance afterwards gets moved into the copy code (online change)
parentIManagedObject
Returns
- BOOL
Properties
Busy
PROPERTY Busy : BOOL
This property returns TRUE if the object is busy executing a sequence or still in its
initialization phase (if applicable). It returns FALSE if the object is idle or in an
error state.
Property Value
- BOOL
Done
PROPERTY Done : BOOL
This property returns TRUE if a sequence was executate without any error and the object
is in its idle state.
Property Value
- BOOL
Error
PROPERTY Error : BOOL
This property returns TRUE if a fault occured within a sequence or the initialization phase
of an object, respectively. If this property returns TRUE, one of the errorMessage methods
give insight about the origin of the fault.
It is also possible to distinguish between initialization errors and sequence errors by checking the exact, internal state of the object using the state method.
Property Value
- BOOL
Methods
CommandErrorDetail
METHOD CommandErrorDetail (
[input] id : DINT) : ZCore.ZString
Gibt den Fehlertext für einen gestarteten (und fehlgeschlagenen) Befehl aus
Inputs
Returns
ErrorId
METHOD ErrorId () : UDINT
Returns the error code of the first error source for this object. The method recursively goes down the error stack until the initial source of error of this object can be found. For performance reasons, the error stack is not cleared when the error state is reset. So this method should always used in conjunction with Error.
Returns
- UDINT
ErrorMessage
METHOD ErrorMessage () : ZCore.ZString
Returns the error description of the first error source for this object. The method recursively goes down the error stack until the initial source of error of this object can be found. For performance reasons, the error stack is not cleared when the error state is reset. So this method should always used in conjunction with Error.
Returns
ErrorSource
METHOD ErrorSource () : ZCore.IError
this method returns the direct error source of this object. This method can then be used to retrieve the actual error source by using the method of the returned IError.
Returns
HasCommandError
METHOD HasCommandError (
[input] id : DINT) : BOOL
returns true if a started command finished with an error
Inputs
Returns
- BOOL
IsCommandBusy
METHOD IsCommandBusy (
[input] id : DINT) : BOOL
Returns true if a started command has finished its task. (use in combination with NOT HasCommandError())
Inputs
Returns
- BOOL
ReceiveAsync
METHOD ReceiveAsync (
[input] receivedSuffix : BYTE) : DINT
This method starts a receiving command and is running until a receivedSuffix is send from the other host
Inputs
Returns
- DINT
ReceivedString
METHOD ReceivedString (
[input] id : DINT) : ZCore.ZString
If a receiving command has been started with ReceiveAsync() this method returns the actual text as ASCII which has been send from the other host.
Inputs
Returns
TraceErrorStack
METHOD TraceErrorStack (
[input] trace : ZCore.IErrorTrace)
This method is used internally when recording an error trace.
Inputs
traceIErrorTrace
TransmitAsync
METHOD TransmitAsync (
[input] data : ZCore.ZString) : DINT
Sends data through the serial interface to the other host
Inputs
dataZString
Returns
- DINT