Changes between Version 1 and Version 2 of Docs/Prog/Manual/ApplicationLibraries/lib825ev/DAC


Ignore:
Timestamp:
09/20/18 07:42:43 (6 years ago)
Author:
Don Wilson
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Docs/Prog/Manual/ApplicationLibraries/lib825ev/DAC

    v1 v2  
    22
    33[[TOC(inline, noheading, depth=1, Docs/Prog/Manual/ApplicationLibraries/lib825ev/DAC/*)]]
     4
     5== Example - Application manually setting DAC output voltage ==
     6{{{
     7void SetupDAC(void)
     8{
     9    // Setup DAC to not track gross or net weight but be controlled manually
     10   DACOutputRange outputrange = dacOutput0to10V;
     11
     12   if(SetDACReg(nDAC, dacAD5422Control, 0x3FF0 | (uint16)outputrange, WAIT_ACK) != OK)
     13       printf("\n\nSetDACOutputRange error\r\n");
     14
     15   float fMaxOutput = 10.0; // Maximum output 10 volts
     16
     17   if(SetDACFloat(nDAC, dacMaxOutput, fMaxOutput, WAIT_ACK) != OK)
     18       printf("\n\nSetDACFloat max output error\r\n");
     19
     20
     21}
     22
     23// Application may call this any time change in voltage output is desired
     24void SetDACVoltage(float voltage)
     25{
     26     uint16 value = (uint16)(0xFFFF * (voltage / 10.0));
     27     SetDACReg(nDAC, dacAD5422Data, value, WAIT_ACK);
     28}
     29
     30
     31
     32}}}