Class for AD7390, a 12 bit SPI driven external DAC from Analog Devices.

Dependencies:   mbed

Datasheet - http://www.analog.com/static/imported-files/data_sheets/AD7390_7391.pdf

Revision:
2:8633e348822f
Parent:
0:82cd70f9fc3f
Child:
3:37ec9ea72264
--- a/main.cpp	Sat Apr 05 20:45:08 2014 +0000
+++ b/main.cpp	Sat Apr 05 21:06:17 2014 +0000
@@ -1,30 +1,23 @@
 #include "mbed.h"
-
-SPI DAC(p5, p6, p7);                //mosi, miso, sclck
-DigitalOut CLR (p10);               //Resets DAC register to 0 when pulled low
-DigitalOut LD (p8);                 //Pull low to load DAC register from shift register
-DigitalOut led(LED2);
+#include "AD7390.h"
 
-int main()
-{
-        DAC.format(12,0);               //Set to 12 bit data transfer with no change in clock polarity or phase
-        DAC.frequency(2000000);
-
-    while(1) {
+AD7390 Test(p5,p7,p10,p11,5,2000000);
+DigitalOut Led(LED1);
 
-        CLR = 1;                    //Pull this low to set back to 0;
-        LD = 1;                     //Send high as the DAC register is loaded once pulled low.
-        DAC.write(0x3ff);           //Write 256 to DAC
-        LD = 0;                     //Send to DAC register from shift register
-        wait_us(10);                //Give time to update
-        LD = 1;                     //Send back into read mode
-        wait(2);
-        DAC.write(0xBff);           //Write 256 to DAC
-        LD = 0;                     //Send to DAC register from shift register
-        wait_us(10);                //Give time to update
-        LD = 1; 
-        wait(2); 
+int main(){
+while (1){
+Test.WriteL(2.5);
+    Led = 1;
+    wait(5);
+    Led = 0;
+    Test.WriteL(4);
+    Led = 1;
+    wait(5);
+    Led = 0;
+    Test.WriteL(0.5);
+    Led = 1;
+    wait(5);
+    Led = 0;
+}
+}
 
-
-    }
-}