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.
Diff: main.cpp
- Revision:
- 0:e0da63caefb9
diff -r 000000000000 -r e0da63caefb9 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Jul 06 10:43:41 2015 +0000
@@ -0,0 +1,47 @@
+#include "mbed.h"
+
+SPI spi(PTA16, PTA17, PTA15); // mosi, miso, sclk
+DigitalOut cs(PTD2);
+Serial pc(USBTX, USBRX);
+int Num = 15 ;
+int K , F , i ;
+
+int main() {
+ // Chip must be deselected
+ cs = 1;
+
+ // Setup the spi for 8 bit data, high steady state clock,
+ // second edge capture, with a 1MHz clock rate
+ spi.format(8,0); // mode not decided
+ spi.frequency(1000000);
+
+
+
+
+
+
+
+ for ( i = 0 ; i<= 15; i++ )
+
+ {
+
+ cs = 0; // Select the device by seting chip select low
+
+ spi.write(0x6F) ; // power up int ref and select all dacs 0b01101111
+
+ K = Num >> 8 ;
+ spi.write ( K );
+ F = Num - ( K << 8 ) ;
+ spi.write ( F) ;
+ Num = Num + 2400 ;
+
+ cs = 1;
+
+ wait (1000) ;
+ pc.printf ("%d %d %d \n " , Num, F, K );
+
+}
+
+
+
+}
\ No newline at end of file