wiki:Docs/Prog/Manual/ApplicationLibraries/lib825ev/DAC/SetDACReg

Version 2 (modified by Don Wilson, 13 years ago) ( diff )

--

SetDACReg

Set a DAC output register.

int SetDACReg(int dev, DACReg reg, uint16 val, int wait);

Parameters

  • dev - number of DAC card.
  • reg - DAC register to set - dacAD5422Status, dacAD5422Data, dacAD5422Control, dacLowWeight, dacMaxOutput, dacOutputRange, dacScaleAssign, dacHighWeight, or dacGrossNet
  • val - value to assign to the register
  • wait - WAIT_ACK Wait for acknowledgement, NO_WAIT_ACK do not wait for acknowledgement

Return Value

  • Returns the result - OK success (If WAIT_ACK may be TIMEOUT)

Remarks

The option card must already be opened by calling OpenMnBd(dev) first. If the application is using main board communication events these events may be called during the wait for acknowledgement.

Examples

   int dac = 1; // number of dac card - not number of slot
   DACOutputRange outRange = dacOutput0to10V;

   // This sets the DAC output for manual control
   if(SetDACReg(dac, dacAD5422Control, 0x3FF0 | (uint16)outRange, WAIT_ACK) != OK)
   {
       DisplayText(0, 0, "SetDACReg Error");
   }

   uint16 level = 0x7FFF; // Output at half
   if(SetDACReg(dac, dacAD5422Data, level, WAIT_ACK) != OK)
   {
       DisplayText(0, 0, "SetDACReg Set level error");
   }
   

See Also

Note: See TracWiki for help on using the wiki.