beautypg.com

2 s826_dacdatawrite, 3 s826_dacread, S826_dacdatawrite – Sensoray 826 User Manual

Page 30: S826_dacread

background image

6.3.2 S826_DacDataWrite

The S826_DacDataWrite function programs the output voltage of a DAC channel.

int S826_DacDataWrite(
uint board, // board identifier
uint chan, // channel number
uint setpoint, // output level
uint safemode // RAM bank select
);

Parameters

board

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

chan

DAC channel number in the range 0 to 7.

setpoint

Analog output level. This is a value ranging from 0x0000 to 0xFFFF. The resulting output voltage depends on the
channel's previously programmed output range.

Analog output range

setpoint range

0 to +5V

0x0000 to 0xFFFF

0 to +10V

0x0000 to 0xFFFF

-5V to +5V

0x0000 to 0xFFFF

-10V to +10V

0x0000 to 0xFFFF

safemode

Specifies the RAM bank to be written: '0' = runmode, '1' = safemode.

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 programs a channel's runmode or safemode output voltage level. If the output range will also be changed,
the range should be changed first, before calling this function. This function is frequently used to change a runmode
setpoint whenever an output level change is required. It can also be used to change a safemode setpoint; this is typically
done once per channel when the application starts, after programming the channel's safemode output range.

The SWE bit must be set (see S826_SafeWrenWrite) to allow writing to the safemode bank. This function will fail
without notification (return S826_ERR_OK) if SWE=0 (see Section 10.1.1) when writing to the safemode bank.

6.3.3 S826_DacRead

The S826_DacRead function returns the output range and setpoint of an analog output channel.

int S826_DacRead(
uint board, // board identifier
uint chan, // channel number
uint *range, // output range
uint *setpoint, // output level
uint safemode // RAM bank select
);

826 Instruction Manual

25

Analog Outputs