ADF7023

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
dheerajmpai23
Date:
Thu Jul 09 06:54:28 2015 +0000
Parent:
1:5a395f2fcdc8
Commit message:
Pubish

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 5a395f2fcdc8 -r ab1b1054c848 main.cpp
--- a/main.cpp	Fri Jun 26 12:48:23 2015 +0000
+++ b/main.cpp	Thu Jul 09 06:54:28 2015 +0000
@@ -5,7 +5,7 @@
 
 #define ENDL "\r" << endl;
 #define START_ADDRESS 0x020;
-
+#define PI 3.14
 SPI adf(PTD6, PTD7, PTD5);
 //MOSI, MISO, CLOCK
 
@@ -16,6 +16,39 @@
 #define SPI_NOP 0xFF
 
 
+void initialise(void){
+    
+//    CS=0;
+//    adf.write(0xB0);
+//    CS=1;
+//    wait_ms(2);
+//    
+//    CS=0;
+//    write_bbram_sequence();
+//    CS=1;
+//    wait_ms(2);
+    
+    
+/*    CS=0;
+    adf.write(0xBB);//CONFIGURE BBRAM DATA
+    CS=1;
+    wait_ms(2);*/
+    
+    CS=0;
+    adf.write(0xB1);
+    CS=1;
+    wait_ms(2);
+    
+    //
+//    CS=0;
+//    adf.write(0xB5);//PHY TX MODE
+//    CS=1;
+//    wait_ms(2);
+    
+    
+    }
+
+
 
 
 int main(){
@@ -24,7 +57,7 @@
     adf.format(8,0);
     adf.frequency( 1000000 );
     
-    cout << "Press s" << ENDL;
+    cout << " Press s" << ENDL;
     ledr = 1;
     char c = 'a';
     while( c != 's'){
@@ -34,6 +67,9 @@
     ledr = 0;
     int d=0;
     
+    
+    initialise();
+    
 
 
     while(true){
@@ -41,18 +77,22 @@
         d++;
         cout<<d<<ENDL;
   
-         
+      
+        //CS=0;
+        adf.write(0xB5);//PHY TX MODE
+        CS=1;
+        wait_ms(2);   
   
-    adf.write(0xB5);
-  
+//    adf.write(0xB5);
+        CS=0;  
         unsigned char reply1 = adf.write(0xFF);
         unsigned char reply2 = adf.write(0xFF);
-                
+        CS=1;        
         std::bitset<8> b = reply1;
         cout << b << " \t ";
         b = reply2;
         cout << b << " \t " << ENDL;
-        
+ 
 
     }