HelloWorld AD8556

Dependencies:   AD8556 mbed

Files at this revision

API Documentation at this revision

Comitter:
fblanc
Date:
Wed Sep 11 13:32:04 2013 +0000
Child:
1:e43b05e13f28
Commit message:
ok

Changed in this revision

AD8556.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AD8556.lib	Wed Sep 11 13:32:04 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/fblanc/code/AD8556/#05eaa16f3327
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Sep 11 13:32:04 2013 +0000
@@ -0,0 +1,75 @@
+#include "mbed.h"
+#include "AD8556.h"
+Serial pc(USBTX, USBRX);
+AD8556 aop(PTD7); //KL25Z
+//AD8556 aop(p21); //MBED
+unsigned char mode=ADC_MODE_SIMULATION;
+float vdd=3.3,vss=0.0;
+
+void pc_rx(void)
+{
+    char c;
+    c=pc.getc();
+    switch (c) {
+        case 'h':
+        case 'H':
+            pc.printf("\r\nHELP\r\n");
+            pc.printf("G : GAIN (V/V)\r\n");
+            pc.printf("O : OFFSET (V)\r\n");
+            pc.printf("M : MODE SIMULATION/FUSE\r\n");
+            pc.printf("S : SUPPLY VDD VSS\r\n");
+            
+            break;
+        case 'G':
+            float gain;
+            pc.printf("\r\nGAIN =");
+            pc.scanf("%f",&gain);
+            aop.prog_gain(gain,mode);
+            pc.printf("%f\r\n",gain);
+            break;
+        case 'O':
+            float offset;
+            pc.printf("\r\nOFFSET =");
+            pc.scanf("%f",&offset);
+            aop.prog_vdac(offset,vdd,vss,mode);
+            pc.printf("%f\r\n",offset);
+            break;
+        case 'M':
+            pc.printf("\r\nMODE :");
+            pc.printf("\r\n1:SIMULATION");
+            pc.printf("\r\n2:FUSE");
+            pc.scanf("%d",&mode);
+            if(mode==2)
+                pc.printf("\r\nFUSE");
+                else
+                {
+                    mode=ADC_MODE_SIMULATION;
+                    pc.printf("\r\nSIMULATION");
+                }
+            break;
+        case 'S':
+            pc.printf("\r\nSUPPLY :");
+            pc.printf("\r\nVCC :");
+            pc.scanf("%f",&vdd);
+            pc.printf("%f\r\n",vdd);
+            pc.printf("\r\nVSS :");
+            pc.scanf("%f",&vss);
+            pc.printf("%f\r\n",vss);
+            break;
+    }
+}
+
+
+
+int main()
+{
+pc.printf("\r\nAD8556 HelloWolrd 11/09/2013\r\n");
+    //aop.init(ADC_Simulate_Parameter_Value,0x00, 0x00,0x7F);
+
+    while (1) {
+        if (pc.readable()) //reception d'une trame com
+            pc_rx();
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Sep 11 13:32:04 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9c8f0e3462fb
\ No newline at end of file