beautypg.com

4 s826_virtualsaferead, 5 s826_virtualsafeenableswrite, S826_virtualsaferead – Sensoray 826 User Manual

Page 16: S826_virtualsafeenableswrite

background image

int S826_VirtualSafeWrite(
uint board, // board identifier
uint data, // safemode data
uint mode // 0=write, 1=clear bits, 2=set bits
);

Parameters

board

826 board number. This must match the settings of the board's dip switches as described in section 2.2.

data

Pointer to data array (see Section 4.2) to be programmed into the Safe registers.

mode

Write mode for data: 0 = write, 1 = clear bits, 2 = set bits (see “Atomic Read-Modify-Write”).

Return Values

If the function succeeds, the return value is zero.

If the function fails, the return value is an error code.

Remarks

This function should only be called when the SWE bit is set (see S826_SafeWrenWrite). The function will fail without
notification (return S826_ERR_OK) if SWE=0 (see Section 10.1.1).

4.2.4 S826_VirtualSafeRead

The S826_VirtualSafeRead function returns the contents of the virtual output channel Safe registers.

int S826_VirtualSafeRead(
uint board, // board identifier
uint *data // pointer to data buffer
);

Parameters

board

826 board number. This must match the settings of the board's dip switches as described in section 2.2.

data

Pointer to a buffer (see Section 4.2) that will receive the Safe register states.

Return Values

If the function succeeds, the return value is zero.

If the function fails, the return value is an error code.

4.2.5 S826_VirtualSafeEnablesWrite

The S826_VirtualSafeEnablesWrite function programs the virtual output channel Safe Enable registers.

int S826_VirtualSafeEnablesWrite(
uint board, // board identifier
uint enables // safemode enables
);

Parameters

board

826 board number. This must match the settings of the board's dip switches as described in section 2.2.

826 Instruction Manual

11

Virtual Outputs