Changes between Version 5 and Version 6 of Docs/Prog/Manual/ApplicationLibraries/lib825ev/DAC
- Timestamp:
- 09/20/18 08:17:17 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Docs/Prog/Manual/ApplicationLibraries/lib825ev/DAC
v5 v6 23 23 void SetDACVoltage(float voltage) 24 24 { 25 // The DAC output is controlled by a 16 bit register so we multiple the maximum 16-bit value 0xFFFF times output percentage/100 desired. 26 // For example maxium 10 V would be 0xFFFF * (10.0 / 10.0) = 0xFFFF * 1.0 = 0xFFFF, 5V would be 0xFFFF * (5.0 / 10.0) = 0xFFFF * 0.5 = 0x8000 25 27 uint16 value = (uint16)(0xFFFF * (voltage / 10.0)); 26 28 SetDACReg(nDAC, dacAD5422Data, value, WAIT_ACK);