Cicode Programming Reference > Cicode Function Categories > Error Functions Introduction > ErrGetHw

ErrGetHw

Gets the current hardware error status for an I/O device.

I/O devices can be grouped into 2 distinct categories: Those that are created by the system engineer, and those that are created by CitectSCADA itself.

I/O devices that are created by the system engineer include any I/O device listed in the CitectSCADA I/O devices database, and any device visible as a record in the I/O Device form in the Project Editor.

I/O devices that are created by CitectSCADA include Generic, LAN, Cicode, Animation, Reports Server, Alarms Server, Trends Server, and I/O Server, and are those specifically not created by the system engineer.

The argument's values you supply in this function are used by CitectSCADA to determine which type of device hardware alarm you want to work with.

Note: Do not use this function if you have more than 511 I/O devices in your project and the flag [Code]BackwardCompatibleErrHw is set to 1. You may retrieve the hardware error status for the wrong I/O device.

Syntax

ErrGetHw(Device, DeviceType)

Device:

For I/O devices that are created by the system engineer, select the IODevNo as the argument value.

To determine the IODevNo of a physical I/O device in your project, use the I/O device record number from the I/O Device form in the Citect Project Editor. When using an IODevNo, the DeviceType argument needs to be set to 2.

For I/O devices that are created by CitectSCADA itself, select one of the following options as the argument value:

DeviceType:

Select a value from the following options to indicate the 'Type of Device' used in the Device argument:

0 - for I/O devices that are created by CitectSCADA itself (Generic, LAN, Cicode, Animation, etc).

2 - for I/O devices that are created by the system engineer.

The DeviceType argument was added to this function in V5.40 and later. Earlier versions did not pass a value for the DeviceType argument (as it did not exist). Versions prior to V5.40 identified an I/O device by passing the IODevNo (masked with the value of 8192) to the function as the Device argument, in the structure:

IODevNo + 8192

This was for versions of CitectSCADA permitting a maximum limit of 4095 I/O devices.

Versions prior to V5.20 masked the IODevNo with a value of 512. The backward compatibility flag for using this mask needs to be set in the Citect.INI file (see code parameter BackwardCompatibleErrHw.).

Return Value

The detected error.

Related Functions

ErrHelp, ErrInfo, ErrMsg, ErrSetHw

Example

Error=ErrGetHw(3,0);
! Sets Error to the current error status for the animation device.
IF Error=0 THEN
DspText(4,0,"");
ELSE
DspText(4,0,"Hardware error");
END

See Also

Error Functions