FB_CX70xx_ResetOnBoardIO

FB_CX70xx_ResetOnBoardIO 1:

The function block allows to execute a reset from the OnBoard I/O of the CX70xx Embedded PC.

Typical use case is after an error in the communication to the OnBoard I/Os (CX7028). Such an error occurs when the power supply (Up) of the OnBoard I/Os is interrupted.

Notice

State of the I/Os

Outputs that are still set in the process image are switched on again immediately after a reset.

Further details on the OnBoard I/O can be found in the documentation of the CX70xx Embedded PC.

FB_CX70xx_ResetOnBoardIO 2: Inputs

VAR_INPUT
    bExecute      : BOOL;         // rising edge triggers process
    sNetId        : T_AmsNetID;   // AMS Net ID of the OnBoard IOs
    tTimeout      : TIME := DEFAULT_ADS_TIMEOUT; // maximum time allowed for execution of this ADS command
END_VAR

Name

Type

Description

bExecute

BOOL

A positive edge starts the function block.

sNetId

T_AmsNetID

AMS Net ID of the OnBoard I/Os

tTimeout

TIME

States the length of the timeout that may not be exceeded by execution of the ADS command.

FB_CX70xx_ResetOnBoardIO 3: Outputs

VAR_OUTPUT
    bBusy       : BOOL;       // FB is working
    bError      : BOOL;       // FB has an Error
    nErrorID    : UDINT;      (* Error Code. If nErrorID=DEVICE_SRVNOTSUPP probably the image version need to be updated to support this feature. *)
END_VAR

Name

Type

Description

bBusy

BOOL

The function block is active and working.

bError

BOOL

The function block has an error.

nErrorID

UDINT

ADS Error Code
Examples:

DEVICE_SRVNOTSUPP: the image version of the CX70xx does not support this feature. An update (>=47912) is necessary.

Sample:

FUNCTION_BLOCK FB_Test_ResetOnboardIO
VAR
    AMSNetID    : T_AmsNetIdArr;    // link to the AMS Net ID of the OnBoard IOs
    State       : WORD;             // link to the State of the OnBoard IOs
    bReset      : BOOL;             // if Ready to Reset you can reset the OnBoard IOs
    fbReset     : FB_CX70xx_ResetOnBoardIO;
END_VAR
IF State<>8 AND NOT State.8 AND State.4 THEN // if OnBoard IO device signals an error and is not OP but present
    bReset := TRUE;
ELSE
    bReset := FALSE;
END_IF

IF NOT fbReset.bBusy AND bReset THEN
    fbReset(bExecute:=TRUE, sNetId:=F_CreateAmsNetId(AMSNetID));
ELSE
    fbReset(bExecute:=FALSE);
END_IF