Dheeraj M Pai
/
ADF7023_mbed_Rolling_Buffer_4
ADF7023-mbed
Diff: main.cpp
- Revision:
- 1:9112177c4643
- Parent:
- 0:4d10d51bf949
diff -r 4d10d51bf949 -r 9112177c4643 main.cpp --- a/main.cpp Tue Jun 30 10:03:45 2015 +0000 +++ b/main.cpp Thu Jul 09 06:44:19 2015 +0000 @@ -1,12 +1,15 @@ #include "mbed.h" +#include<iostream> #define ENDL "\r" << endl -#include<iostream> + DigitalOut led(LED_RED); DigitalOut CS(D10); -int irq0=0; -int irq1=0; -int irq2=0; -int irq3=0; +InterruptIn IRQ(); + +int irq0 = 0; +int irq1 = 0; +int irq2 = 0; +int irq3 = 0; //int irq2=0; @@ -15,77 +18,70 @@ void bbram_write() { - CS=0; - // To bring in off state + CS=0;// PHY_OFF adf.write(0xB0); - wait(0.1); - wait(0.1); - + wait_ms(5); // Testmode register CS=0; adf.write(0x09); adf.write(0x39); adf.write(0x10); CS=1; - wait(0.1); + wait_ms(5); //CMD_CONFIG_DEV CS=0; adf.write(0xBB); CS=1; - wait(0.1); + wait_ms(5); CS=0; adf.write(0xFF); adf.write(0xFF); CS=1; - wait(0.1); + wait_ms(5); } void data_write() { - // PHY_ON - CS=0; - adf.write(0xB1); - CS=1; - wait(0.1); + CS=0; adf.write(0xFF); adf.write(0xFF); CS=1; - wait(0.1); + wait_ms(5); // TRANSMIT_DATA LENGTH CS=0; adf.write(0x08); adf.write(0x14); adf.write(0xFF); CS=1; - wait(0.1); + wait_ms(5); CS=0; adf.write(0x08); adf.write(0x15); adf.write(0xFF); CS=1; - wait(0.1); + wait_ms(5); // TX_BASE ADDRESS CS=0; adf.write(0x09); adf.write(0x24); adf.write(0x20); CS=1; - wait(0.1); + wait_ms(5); // BUFFER SIZE CS=0; adf.write(0x09); adf.write(0x37); adf.write(0xE0); CS=1; - wait(0.1); + wait_ms(5); CS=0; adf.write(0x09); adf.write(0x36); adf.write(0x70); CS=1; - wait(0.1); + wait_ms(5); // PACKET WRITE CS=0; adf.write(0x18); @@ -160,7 +156,7 @@ adf.write(0xFF); adf.write(0xFF); adf.write(0xFF); - - adf.write(0xFF); + adf.write(0xFF); adf.write(0xFF); adf.write(0xFF); adf.write(0xFF); @@ -319,7 +315,7 @@ adf.write(0xFF); adf.write(0xFF); CS=1; - wait(0.1); + wait_ms(5); // TX MODE CS=0;//Initiate the IRQ @@ -329,26 +325,25 @@ adf.write(0x60); adf.write(0x00); adf.write(0x60); - - - CS=1; - - - - + wait_ms(2); CS=0; adf.write(0xB5); + int r1 = adf.write(0xFF); + int r2 = adf.write(0xFF); CS=1; wait_ms(1); - CS=0; - adf.write(0x09); - adf.write(0x00); - adf.write(0x); + + cout<<r1<<"__"<<r2<<ENDL; + +// CS=0; +// adf.write(0x09); +// adf.write(0x00); +// adf.write(0x); - CS=1; - wait_ms(1); +// CS=1; +// wait_ms(1); } @@ -356,8 +351,11 @@ int main() { adf.format(8,0); + cout<<"in main"<<ENDL; adf.frequency(1000000); bbram_write(); + cout<<"BBRAM Writen"<<ENDL; data_write(); + cout<<"Tx"<<ENDL; } \ No newline at end of file