Programmatically configure a timeout, Programmatically determine if a timeout occurs – Rockwell Automation Logix5000 Controllers Tasks, Programs, and Routines Programming Manual User Manual

Page 68

Advertising
background image

Chapter 2 Manage event tasks

Programmatically configure a timeout

To programmatically configure a timeout, use a Get System Value (GSV)

instruction to access the attributes of the task. The following table lists the status

attribute for the TASK object.

Attribute

Data Type

Instruction

Description

Rate

DINT

GSV
SSV

If the task type is

Then the Rate attribute specifies the

Periodic

Period for the task. Time is in microseconds.

Event

The timeout value for the task. Time is in microseconds.

EnableTimeOut

DINT

GSV
SSV

Enables or disables the timeout Function of an event task.

To

Set the attribute to

Disable the timeout function

0 (default)

Enable the timeout function

1 (or any non-zero value)

Example

To make sure that a timeout value is always defined and enabled for an event task, the logic configures the timeout when the controller enters Run mode.

If S:FS = 1 (first scan) then set the timeout value for Task_2 and enable the timeout function.
1.

The first MOV instruction sets Task_2_Timeout = 10000000 µs (DINT value). Then the SSV instruction sets the Rate attribute for Task_2 =

Task_2_Timeout. This configures the timeout value for the task.

2.

The second MOV instruction sets One = 1 (DINT value). Then the SSV instruction sets the EnableTimeout attribute for Task_2 = One. This enables the

timeout function for the task.

Programmatically determine if a timeout occurs

To determine if an event task ran due to a timeout, use a Get System Value (GSV)

instruction to monitor the Status attribute of the task. The following table lists the

Status attribute for the TASK object.

68

Rockwell Automation Publication 1756-PM005-EN-P - October 2014

Advertising