beautypg.com

2 reset state, 2 connector j1, 3 programming – Sensoray 826 User Manual

Page 29: 1 s826_dacrangewrite, Reset state, Connector j1, Programming, S826_dacrangewrite

background image

6.1.2 Reset State

Upon reset, all DAC outputs and all channels in both RAM banks are programmed to 0V with the output range set to 0 to
+5V.

6.2 Connector J1

DAC output signals are available on the analog I/O connector J1, which is shared with the ADC system. See Section 5.2 for
the connector pinout.

Each DAC channel has a single-ended output signal that is referenced to the board's power supply common. The output and
common signals are available on the analog I/O connector. DAC output signals are sensed at the connector; no external
sense inputs are available on the connector.

6.3 Programming

6.3.1 S826_DacRangeWrite

The S826_DacRangeWrite function programs the voltage range of an analog output channel.

int S826_DacRangeWrite(
uint board, // board identifier
uint chan, // channel number
uint range, // output range
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.

range

Enumerated value that specifies the output voltage range:

range

Analog Output Range

Notes

0

0 to +5V

Default upon reset

1

0 to +10V

2

-5 to +5V

3

-10 to +10V

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 configures a channel's output voltage range and programs the setpoint to zero volts. It can be called at any
time, though it is typically called once per channel during program initialization for the runmode bank and, if
necessary, once per channel for the safemode bank as well (if default safemode values are not suitable).

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.

826 Instruction Manual

24

Analog Outputs