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

GetDAC

Get a DAC register value.

int GetDAC(int dev, DACReg reg, int wait);

Parameters

  • dev - number of DAC card.
  • reg - DAC register to get - dacAD5422Status, dacAD5422Data, dacAD5422Control, dacLowWeight, dacMaxOutput, dacOutputRange, dacScaleAssign, dacHighWeight, or dacGrossNet
  • 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

   extern uint16 g_nDACValue16;
   extern float g_fDACValue;

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

   // Gets the DAC control register value
   if(GetDAC(dac, dacAD5422Control, WAIT_ACK) == OK)
   {
      DisplayText(0, 0, "GetDAC control result = " + IntToStr(g_nDACValue16));
   }
   // Gets the DAC high weight register value
   if(GetDAC(dac, dacHighWeight, WAIT_ACK) == OK)
   {
      DisplayText(0, 0, "GetDAC high weight = " + FloatToStr(g_fDACValue));
   }

See Also

Last modified 7 years ago Last modified on 04/12/18 12:32:08
Note: See TracWiki for help on using the wiki.