You are on page 1of 40

Retrieving and Setting

Logix5000 Controller
Status Values with
GSV/SSV Instructions

1
Objectives

• Retrieve and set a controller status value using GSV (Get System Value)
and SSV (Set System Value) instructions
• Assign a fault routine

2
Monitoring Controller System Data

Unlike other controllers, a Logix5000 controller does not constantly monitor


controller system data and update status files.
A Logix5000 controller stores controller system data in structures called
objects.

3
Monitoring Controller System Data

Objects are monitored and changed using specific ladder logic and
structured text instructions:
• GSV Instruction: Used to monitor specific controller system data.
• SSV Instruction: Used to set specific controller system data.

Use the GSV/SSV instructions


carefully. Changes to objects
storing controller system data or
based on controller system data
can cause unintended controller
operation that may injure personnel
and damage equipment.

4
GSV/SSV Parameters

GSV and SSV instructions operate on values for these parameters:


• Class
• Instance
• Attribute
• Source (SSV) or destination (GSV)

5
Class

Class: Category or type of object that is accessed.

Category

6
Class

Classes that can be monitored or set:


To retrieve or set information about Select this Class Name . . .
the . . .
Axis of a servo module AXIS
Percentage of CPU time assigned to CONTROLLER
communications
Controller hardware CONTROLLERDEVICE
Coordinated system time of a chassis CST
DF1 driver of the controller's serial port DF1
Fault history of the controller FAULTLOG
Attributes of a message instruction MESSAGE
Status, faults, and mode of a module MODULE
Status of a group of axes MOTIONGROUP
(Continued)
7
Class

Classes that can be monitored or set:


To retrieve or set information about Select this Class Name . . .
the . . .
Fault or scan times of a program PROGRAM
Redundant controller information REDUNDANCY
Instance of a routine ROUTINE
Configuration of the serial port SERIALPORT
Properties or scan times of a task TASK
Wall clock of a controller WALLCLOCKTIME

8
Instance

If more than one project component relates to the class selected, an instance
must be selected:

Specific Specific
Component Instance Name

Select “THIS" to identify the current


task, program, or routine. The
instruction can then be easily
reused.

9
Attribute

Attribute: Particular property or value that is retrieved or set:

Property to
Monitor

10
Source or Destination

Source: Contains values that will be set by SSV instruction.


Destination: Stores values retrieved by GSV instruction:

Storage Tag for Value

The destination tag data type must


match the size and layout of the
source as specified in the Help
system.

11
Source or Destination

If the tag is a user-defined data type


or an array of data, select the
correct member of the user-defined
data type or element of the array:
User-Defined Data Type Based on
Data Structure in the Help System

The first
element of
the tag (Year)
must be
selected.

12
Example: GSV Instruction

GSV instructions can retrieve information about program scan time:

Tag

User-Defined
Data Type

13
Example: GSV Instruction

Example shows how to retrieve status information from a program class.


Specified program is named "DISCRETE":
• One GSV instruction retrieves value of last scan time.
• Other GSV instruction retrieves value of max scan time.
• Both instructions place data in different members of user-defined structure
named Discrete_Info.

14
Example: SSV Instruction

In this example, an SSV instruction is used to enable or disable a program.

15
Example: SSV Instruction

Based on value moved into discrete_prog_flag, the appropriate value is placed


in the disable flag attribute of the program named "DISCRETE."

16
Status Flags

Controller status and arithmetic status flags can also be examined for specific
data:
• Controller configuration and status values accessed using GSV and SSV
instructions
• A set of status and arithmetic flags can be accessed directly in relay
instruction operands

These flags are not base tags and


you cannot create alias tags for
them.

17
Controller Status Flags

Limited controller status can be examined using the following controller status
flags:
This status flag . . . Is set after the . . .
First scan S:FS First normal scan of the routines in the current program

Minor fault S:MINOR Generation of an instruction-execution minor fault by


program execution

18
Arithmetic Status Flags

Arithmetic status flags can be used to view the results of an arithmetic


operation:
This status flag . . . Is set when the . . .
Overflow S:V Value being stored cannot fit into the destination because
it is either greater than the maximum value or less than
the minimum value for the destination
Zero S:Z Instruction's destination value is zero [0]
Sign S:N Instruction’s destination value is negative
Carry S:C Instruction generated a carry

19
Fault Types

Main fault categories:


• Non-recoverable major fault
• Recoverable major fault
• Minor fault

20
Non-Recoverable Major Fault

Non-Recoverable Major Fault: Fault within controller severe enough to


shut it down:
• Hardware failure causes such a fault

21
Non-Recoverable Major Fault

Following changes take place in system:


• Outputs change to Fault Mode state set in I/O configuration:
– On
– Off
– Hold

22
Non-Recoverable Major Fault

Following changes take place in system:


• Controller OK LED turns solid red.
• “Faulted” is displayed in Online toolbar

Solid
Red

23
Recoverable Major Fault

Recoverable Major Fault: Severe enough to shut down controller if


condition is not cleared.

Two categories of recoverable major faults:


• Instruction execution
• Other errors:
– Power loss
– Loss of critical I/O
– Array subscript errors

24
Recoverable Major Fault Processing: Level 1

When fault first occurs, changes take place in system:


• Major fault bit set in controller
• Any user-programmed fault routines execute:
– Program-level fault routine
– Controller-fault handler

25
Fault Routine

Program can have its own fault routine:


• Controller executes program's fault routine when instruction-related fault
occurs
• If fault is cleared, routine continues execution:
– Controller does not enter Fault mode

26
Fault Routine

• Normally contains code to identify fault


• Can contain code to clear fault

Fault Routine Icon

Fault Routine Code

Elements 0 to 1: 64-Bit Timestamp


Element 2: Fault Type (Lower 16 Bits) and
Code (Upper 16 Bits)
Elements 3 to 10: Fault-Dependent Information

27
Controller Fault Handler

Each project contains a Controller Fault Handler folder:


• Programmer may add one optional program to it.

Controller fault handler executes:


• When recoverable major fault is not related to an instruction
• When program fault routine:
– Does not exist
– Could not clear instruction-related fault

28
Controller Fault Handler

At minimum, main routine must be created and assigned:

Program

Main Routine
Subroutine

29
Recoverable Major Fault Processing: Level 2

If controller fault handler does not exist or cannot clear fault:


• Controller enters Fault mode and shuts down.

30
Recoverable Major Fault Processing: Level 2

• Outputs change to configured output state for Program mode


• Controller OK LED flashes red
• “Faulted” displayed in the Online toolbar:

Flashing
Red

31
Multiple Recoverable Major Faults

Multitasking capabilities:
• Controller can handle 32 simultaneous recoverable major faults

32
Multiple Recoverable Major Faults

If multiple recoverable major faults are reported:


• Controller processes faults in order they occur
• If faults are not cleared by controller fault handler, controller goes into Fault mode:
– Fault that was not cleared and up to two additional faults logged
– Information viewed via Major Faults tab in controller properties

33
Multiple Recoverable Major Faults

• If over 32 major faults occur at same time, controller goes into Fault mode:
– First three major faults logged into controller fault log
• If watchdog fault occurs second time in same logic scan:
– Controller enters Fault mode (whether or not controller fault handler clears fault)

34
Common Major Faults

Common major faults include:


• Required I/O connection has failed
• Array subscript too big
• Timer has negative preset or accumulated value
• Task watchdog timer has expired
• Others

35
Minor Fault

Minor Fault: Fault not severe enough to shut down controller:


• Low battery
• Serial port problems

36
Minor Fault

Changes take place in system:


• Program scan and normal I/O control continues
• Controller OK LED remains solid green
• Minor fault bit set

Normal Operating
State Solid
Green

37
Minor Fault

A minor fault may only be detected


if programming language is written
to monitor it or if you monitor the
Minor Faults tab in the Controller
properties.

A minor fault does not affect


application operation. However,
clearing a minor fault may improve
scan time.

38
39
40

You might also like