Siva ram
/
SPI_DAC_EPS
Nikunj code
Revision 0:b121e4eadb42, committed 2015-07-06
- Comitter:
- Piasiv1206
- Date:
- Mon Jul 06 12:45:23 2015 +0000
- Commit message:
- PYLD EPS working
Changed in this revision
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 |
diff -r 000000000000 -r b121e4eadb42 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Jul 06 12:45:23 2015 +0000 @@ -0,0 +1,50 @@ +#include "mbed.h" + +SPI spi(PTA16, PTA17, PTA15); // mosi, miso, sclk +DigitalOut cs(PTD2); +Serial pc(USBTX, USBRX); +uint16_t input = 24576; +uint16_t Num = 15 ; +uint8_t K , F , i ,input2 = 0; + +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); + + cs = 0; + spi.write(input); + spi.write(input2); + cs = 1; + + + + for ( i = 0 ; i<= 15; i++ ) + + { + + cs = 0; // Select the device by seting chip select low + + spi.write(0x3F) ; // 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 (1) ; + pc.printf ("%d %d %d \n " , Num, F, K ); + pc.printf( "\n\r"); + +} + + + +} \ No newline at end of file
diff -r 000000000000 -r b121e4eadb42 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Jul 06 12:45:23 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7cff1c4259d7 \ No newline at end of file