-

Dependencies:   ADS7828 mbed

Files at this revision

API Documentation at this revision

Comitter:
frada
Date:
Tue Dec 30 18:47:41 2014 +0000
Parent:
1:608e44287bb8
Commit message:
-

Changed in this revision

ADS7828.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/ADS7828.lib	Tue Dec 30 15:13:12 2014 +0000
+++ b/ADS7828.lib	Tue Dec 30 18:47:41 2014 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/frada/code/ADS7828/#2ff328d8e4dd
+http://developer.mbed.org/users/frada/code/ADS7828/#abbfd9c7f30c
--- a/main.cpp	Tue Dec 30 15:13:12 2014 +0000
+++ b/main.cpp	Tue Dec 30 18:47:41 2014 +0000
@@ -6,7 +6,7 @@
 ADS7828  ADC(I2C_SDA, I2C_SCL, 100000, 0x00);
 
 int main() {
-    double data;
+    int data;
     
     pc.baud(115200);
     pc.printf("Hello, World!\r\n");
@@ -14,12 +14,11 @@
     while(1) {
         myled != myled;
         
-        data = ADC.readAnalogValue(MODE_SE | MODE_INTERNAL_REF_ON_ADC_ON, CH0_SE);
-    
+        data = ADC.readRawValue(MODE_SE | MODE_INTERNAL_REF_ON_ADC_ON, CH0_SE);
         if (data == -1)
             pc.printf("Error reading data from ADC!\r\n");
         else
-            pc.printf("%.3f\r\n", data);
+            pc.printf("Conversion result: 0x%04x = %.3f V\r\n", data, 2.5F/4096*data);
             
         wait(0.2);
     }