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


Sets the hardware error status for a hardware device. Call this function to generate a hardware error.

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

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

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

The arguments values you supply in this function are used by CitectSCADA to determine the type of device hardware alarm you want to work with.

Note: To use this function, you need to set [Code]BackwardCompatibleErrHw to 1. You cannot use this function if you have more than 511 I/O devices in your project.


ErrSetHw(Device, Error, DeviceType)


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:

0 - Generic

1 - LAN

2 - Cicode

3 - Animation

4 - Reports Server

5 - Alarms Server

6 - Trends Server

7 - I/O Server


The error code.


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 that permitted 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

0 (zero) if successful, otherwise an error is returned.

Related Functions

ErrHelp ErrMsg ErrSet ErrSetHw


! Generates a divide by zero error (273) on the report device.
! Resets any error on the animation device.

See Also

Error Functions