Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 5:477603ce54a0, committed 2015-01-29
- Comitter:
- wbeaumont
- Date:
- Thu Jan 29 11:03:56 2015 +0000
- Parent:
- 4:bc9ab300ab26
- Commit message:
- i n calculation corrected gain+1 to gain+2
Changed in this revision
| AD5384.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/AD5384.cpp Thu Oct 23 17:14:58 2014 +0000
+++ b/AD5384.cpp Thu Jan 29 11:03:56 2015 +0000
@@ -24,9 +24,10 @@
* v1.24 added update shadow registers
* v1.26 corrected mask for reading register value
* v1.30 added get voltage
+ *V1.31 corrected gain+1 to gain+2 in calculate_dac_setting
*/
-#define AD5384_SRC_VERSION "1.26"
+#define AD5384_SRC_VERSION "1.31"
#define M_DATA_R 0x3
#define M_OFFS_R 0x2
@@ -113,7 +114,7 @@
float x2= vout * (float)p2_14 /(2 *vref);
// x2 = [(gain+2)/2^n * x1] + offset-2^13
// x1 = 2^14/(gain+2) * [ x2 - offset+2^13 ]
- u16 x1 = (float)p2_14/((float)gain[nr]+1) *( x2- offset[nr]+p2_13);
+ u16 x1 = (float)p2_14/((float)gain[nr]+2) *( x2- offset[nr]+p2_13);
x1= 0x3FFF & x1;
dacr[nr]=x1 ;
return x1;