« Close

Datasheets and User Guides

App Notes

Software & Driver

 

4.2.18 - eDAC()

An easy function that writes a value to one analog output. This is a simple alternative to the very flexible IOType based method normally used by this driver.

When needed, this function automatically enables the specified analog output.

Declaration:

LJ_ERROR _stdcall eDAC (  LJ_HANDLE Handle,
                          long Channel,
                          double Voltage,
                          long Binary,
                          long Reserved1,
                          long Reserved2)

Parameter Description:
Returns: LabJack errorcodes or 0 for no error.
Inputs:

  • Handle – Handle returned by OpenLabJack().
  • Channel – The analog output channel to write to.
  • Voltage – The voltage to write to the analog output.
  • Binary – If this is nonzero (True), the value passed for Voltage should be binary. For example, pass 32768.0 in the double parameter for mid-scale output.
  • Reserved (1&2) – Pass 0.

2 comments

I gather that by 'binary' you actually mean to pass an integer value as a double, right?  For instance, if I want the 12-bit DAC output of Channel 1 to be at half scale, I could pass 2047.0 as Voltage, i.e.

eDAC ( handle, 1, 2047.0, TRUE, 0, 0);

"Binary" to me means 0b000007FF for 2047.

Great gizmo btw.

Cheers

Phil H

Yes, good clarification.  From looking at Section 5.2.5.16 I know that it is actually justified to a 16-bit value, so you want to pass 32768.0 for mid-scale.