ADF7023 Mbed

Dependencies:   mbed

Revision:
4:59971eae6b21
Parent:
3:7d87539f959a
Child:
5:0b8f6029c127
--- a/main.cpp	Fri Jul 03 09:35:37 2015 +0000
+++ b/main.cpp	Sat Jul 04 06:10:33 2015 +0000
@@ -8,15 +8,17 @@
 #define PI 3.14
 SPI adf(PTA16, PTA17, PTA15);
 //MOSI, MISO, CLOCK
-
-DigitalOut CS(D10);
+//Timeout t;
+//Ticker t;
+DigitalOut CS(PTD4);//D10==PTD4
 Serial PC(USBTX, USBRX);
 DigitalOut ledr(LED_RED);
-InterruptIn IRQ(D8);
+InterruptIn IRQ(PTE1);//D8==PTA13
 int src=0;
 int irqsrc = 0;
 int j = 0;
 int k = 0;
+int x=0;
 int irq1=0;
 unsigned char data[]={0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xCE,0x56,0x33,0x76,0x2D,0xD7,0x5F,0x0A,0x2D,0xD5,0x9D,0x36,0xD2,0x2C,0x97,0xB2,0xF1,0xA8,0xBE,0xE4,0x9F,0xE8,0x57,0x8C,0x01,0x27,0xB2,0x34,0x6B,0x5E,0x9A,0x30,0x5F,0x78,0x7C,0x0E,0xDC,0x0D,0x4B,0x78,0x00,0x13,0x09,0xDA,0xAD,0x9A,0x3C,0xD6,0xCC,0xB2,0x89,0x8C,0xB4,0xA0,0x0B,0xA4,0x14,0x09,0xEE,0x9C,0x62,0x86,0x53,0xBE,0x59,0x56,0xF7,0xF2,0x71,0x75,0x04,0xE4,0xC7,0x7B,0xBA,0xAC,0xE6,0x0A,0xB9,0x74,0x2B,0x87,0x2D,0x82,0x3D,0x3D,0xCF,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x59,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x59,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
 //FF 00 Gen data FF 00
@@ -27,6 +29,9 @@
 //unsigned int data[]={0x01,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x59,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x58,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x0F,0x20,0xE5,0xEE,0x00,0x7C,0xA8,0xFA,0xF8,0x20,0x65,0xE7,0xFD,0x2E,0xFE,0x19,0xB8,0x3B,0x73,0xFE,0x78,0x8D,0x40,0xF0,0xC2,0x46,0xE5,0xA0,0x73,0x2A,0x0C,0x8B,0x02,0x7F,0xD4,0xD2,0x96,0x37,0x05,0x0F,0x20,0xE5,0xEE,0x00,0xD7,0x22,0x9C,0xDD,0xCC,0x79,0xF2,0x70,0xDE,0x38,0x8E,0x08,0x68,0xBD,0x88,0x1B,0xBC,0x40,0xE7,0x14,0x3B,0xD0,0x9A,0x1F,0x62,0xAA,0xD8,0x53,0x67,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97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x59,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x58,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x0F,0x20,0xE5,0xEE,0x00,0x7C,0xA8,0xFA,0xF8,0x20,0x65,0xE7,0xFD,0x2E,0xFE,0x19,0xB8,0x3B,0x73,0xFE,0x78,0x8D,0x40,0xF0,0xC2,0x46,0xE5,0xA0,0x73,0x2A,0x0C,0x8B,0x02,0x7F,0xD4,0xD2,0x96,0x37,0x05,0x0F,0x20,0xE5,0xEE,0x00,0xD7,0x22,0x9C,0xDD,0xCC,0x79,0xF2,0x70,0xDE,0x38,0x8E,0x08,0x68,0xBD,0x88,0x1B,0xBC,0x40,0xE7,0x14,0x3B,0xD0,0x9A,0x1F,0x62,0xAA,0xD8,0x53,0x67,0x10,0x89,0x0F,0xDF,0x43,0x01,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x59,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x58,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x0F,0x20,0xE5,0xEE,0x00,0x7C,0xA8,0xFA,0xF8,0x20,0x65,0xE7,0xFD,0x2E,0xFE,0x19,0xB8,0x3B,0x73,0xFE,0x78,0x8D,0x40,0xF0,0xC2,0x46,0xE5,0xA0,0x73,0x2A,0x0C,0x8B,0x02,0x7F,0xD4,0xD2,0x96,0x37,0x05,0x0F,0x20,0xE5,0xEE,0x00,0xD7,0x22,0x9C,0xDD,0xCC,0x79,0xF2,0x70,0xDE,0x38,0x8E,0x08,0x68,0xBD,0x88,0x1B,0xBC,0x40,0xE7,0x14,0x3B,0xD0,0x9A,0x1F,0x62,0xAA,0xD8,0x53,0x67,0x10,0x89,0x0F,0xDF,0x43,0x01,0x97,0x4C,0x18,0x22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65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x0F,0x20,0xE5,0xEE,0x00,0x7C,0xA8,0xFA,0xF8,0x20,0x65,0xE7,0xFD,0x2E,0xFE,0x19,0xB8,0x3B,0x73,0xFE,0x78,0x8D,0x40,0xF0,0xC2,0x46,0xE5,0xA0,0x73,0x2A,0x0C,0x8B,0x02,0x7F,0xD4,0xD2,0x96,0x37,0x05,0x0F,0x20,0xE5,0xEE,0x00,0xD7,0x22,0x9C,0xDD,0xCC,0x79,0xF2,0x70,0xDE,0x38,0x8E,0x08,0x68,0xBD,0x88,0x1B,0xBC,0x40,0xE7,0x14,0x3B,0xD0,0x9A,0x1F,0x62,0xAA,0xD8,0x53,0x67,0x10,0x89,0x0F,0xDF,0x43,0x01,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x59,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x58,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x0F,0x20,0xE5,0xEE,0x00,0x7C,0xA8,0xFA,0xF8,0x20,0x65,0xE7,0xFD,0x2E,0xFE,0x19,0xB8,0x3B,0x73,0xFE,0x78,0x8D,0x40,0xF0,0xC2,0x46,0xE5,0xA0,0x73,0x2A,0x0C,0x8B,0x02,0x7F,0xD4,0xD2,0x96,0x37,0x05,0x0F,0x20,0xE5,0xEE,0x00,0xD7,0x22,0x9C,0xDD,0xCC,0x79,0xF2,0x70,0xDE,0x38,0x8E,0x08,0x68,0xBD,0x88,0x1B,0xBC,0x40,0xE7,0x14,0x3B,0xD0,0x9A,0x1F,0x62,0xAA,0xD8,0x53,0x67,0x10,0x89,0x0F,0xDF,0x43,0x01,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x59,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x58,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x0F,0x20,0xE5,0xEE,0x00,0x7C,0xA8,0xFA,0xF8,0x20,0x65,0xE7,0xFD,0x2E,0xFE,0x19,0xB8,0x3B,0x73,0xFE,0x78,0x8D,0x40,0xF0,0xC2,0x46,0xE5,0xA0,0x73,0x2A,0x0C,0x8B,0x02,0x7F,0xD4,0xD2,0x96,0x37,0x05,0x0F,0x20,0xE5,0xEE,0x00,0xD7,0x22,0x9C,0xDD,0xCC,0x79,0xF2,0x70,0xDE,0x38,0x8E,0x08,0x68,0xBD,0x88,0x1B,0xBC,0x40,0xE7,0x14,0x3B,0xD0,0x9A,0x1F,0x62,0xAA,0xD8,0x53,0x67,0x10,0x89,0x0F,0xDF,0x43};
 #define SPI_NOP 0xFF
 /***********************************************************************************/
+
+
+
 void bbram_write()
 {   
     CS=0;
@@ -137,13 +142,14 @@
     CS=0;
     adf.write(0x08);    // TRANSMIT_DATA LENGTH
     adf.write(0x14);
-    adf.write(0x99);
+    adf.write(0xFF);
     CS=1;
     wait_ms(2);
+    
     CS=0;
     adf.write(0x08);        // TRANSMIT_DATA LENGTH
     adf.write(0x15);
-    adf.write(0x99);
+    adf.write(0xFF);
     CS=1;
     wait_ms(2);
     
@@ -180,6 +186,22 @@
     
     }
     
+void write_data(void);
+
+     void poll(void){    
+        while(1){
+        x=IRQ;
+//     cout<<"in While Loop"<<ENDL;
+//     cout<<x<<ENDL;       
+     if(x){
+        irq1++;
+         write_data();
+         
+        }
+                
+    }
+}
+    
     
 /*int irq_src(void){
         
@@ -198,16 +220,19 @@
         }
   */  
 void write_data(void){
-    cout<<"3"<<ENDL;
+//    cout<<"3"<<ENDL;
 //    cout<<"irq detected"<<ENDL;
 //    src = irq_src();
-    wait_ms(5);
+//    wait_ms(5);
+//    t.detach();
+//    wait_us(1);
+//    t.attach_us(&poll,45000);
     CS=0;
     adf.write(0x0B);//IRQ_SOURCE_Random write //To read CMD = 2B 36 FF FF
     adf.write(0x36);//Address : 0x336
     adf.write(0xFF);//Put Low
     CS=1;
-    wait_us(80);
+//    wait_us(80);
     CS=0;
     
     
@@ -252,11 +277,9 @@
      if(j>=(sizeof(data)/112) )
      j=1;
      CS=1;
-     wait_us(1);
+     wait_us(5);
 }     
      
-        
-    
     
     
     
@@ -295,36 +318,28 @@
     adf.write(0xFF);
     adf.write(0xFF);
     CS=1;
-    wait_ms(2);
-    int x = IRQ;
-    while(1){
-        x=IRQ;
-//     cout<<"in While Loop"<<ENDL;
-//     cout<<x<<ENDL;       
-     if(x){
-         
-         write_data();
-         
-         }
+    wait_us(20);
+    poll();    
+//    t.attach_us(&poll,45000);
+//    int x = IRQ;
+/*        */
 //     IRQ.rise(&write_data);
-//     IRQ.fall(&print);
+
      
      } 
      
      
-    }
+    
     
     
     int main()
 {   
+
+//    IRQ.mode(PullDown);
     cout<<"in MAin"<<ENDL;
     adf.format(8,0);
     adf.frequency(1000000);
     bbram_write();
-    cout<<"bbram written"<<ENDL;
     initiate();
-    cout<<"Initiated to Rolling buffer mode"<<ENDL;
     send_data();
-    
-    
 } 
\ No newline at end of file