GSV/SSV Programming Example

The following examples use GSV instruction to get fault information.
Example 1: Getting I/O Fault Information
This example gets fault information from the I/O module disc_in_2 and places the data in a user-defined structure disc_in_2_info.
Ladder Diagram
GSVSSV_LD_ex1_Pg225_v31
Structured Text
GSV(MODULE,disc_in_2,FaultCode,disc_in_2_info.FaultCode);
GSV(MODULE,disc_in_2,FaultInfo,disc_in_2_info.FaultInfo);
GSV(MODULE,disc_in_2,Mode,disc_in_2_info.Mode);
Example 2: Getting Program Status Information
This example gets status information about program discrete and places the data in a user-defined structure discrete_info.
Ladder Diagram
GSVSSV_LD_ex2_Pg226_v31
Structured Text
GSV(PROGRAM,DISCRETE,LASTSCANTIME,discrete_info.LastScanTime);
GSV(PROGRAM,DISCRETE,MAXSCANTIME,discrete_info.MaxScanTime);
Example 3: Getting Task Status Information
This example gets status information about task IO_test and places the data in a user-defined structure io_test_info.
Ladder Diagram
GSVSSV_LD_ex3_Pg226_v31
Structured Text
GSV(TASK,IO_TEST,LASTSCANTIME,io_test_info.LastScanTime);
GSV(TASK,IO_TEST,MAXSCANTIME,io_test_info.MaxScanTime);
GSV(TASK,IO_TEST,WATCHDOG,io_test_info.Watchdog);
Setting Enable and Disable Flags
The following example uses the SSV instruction to enable or disable a program. You could also use this method to enable or disable an I/O module, which is a program solution similar to using inhibit bits with a PLC-5 processor.
Based on the status of SW.1, place the appropriate value in the disable flag attribute of program discrete.
Ladder Diagram
GSVSSV_LD_ex4_Pg227_v31
Structured Text
IF SW.1 THEN
discrete_prog_flag := enable_prog;
ELSE
discrete_prog_flag := disable_prog;
END_IF;
SSV(PROGRAM,DISCRETE,DISABLEFLAG,discrete_prog_flag);
Inhibiting and Uninhibiting FirmwareSupervisor Automatic Firmware Update
The following example uses the GSV/SSV instruction to inhibit or uninhibit the Automatic Firmware Update attribute of the controller. If you write a value of 1, it inhibits the feature. If you write a value of 0, the feature is uninhibited. The status of the attribute can also be read with a GSV.
Ladder Diagram
GSVSSV_LD_ex5_Pg228_v31
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.