2 s826_virtualread, 3 s826_virtualsafewrite, S826_virtualread – Sensoray 826 User Manual
Page 15: S826_virtualsafewrite
int S826_VirtualWrite(
uint board, // board identifier
uint data, // data to write
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
Normal (runmode) output data for the six virtual channels (see Section 4.2).
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
In mode zero, this function will unconditionally write new values to all virtual output registers. In modes one and two,
the function will selectively clear or set any arbitrary combination of output registers; data bits that contain logic '1'
indicate virtual output registers that are to be modified, while all other output registers will remain unchanged. Modes
one and two can be used to ensure thread-safe operation as they atomically set or clear the specified bits.
4.2.2 S826_VirtualRead
The S826_VirtualRead function reads the programmed states of all virtual output registers.
int S826_VirtualRead(
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 output register states.
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 returns the output register states.
4.2.3 S826_VirtualSafeWrite
The S826_VirtualSafeWrite function programs the virtual output channel Safe registers.
826 Instruction Manual
10
Virtual Outputs