ADF7023-mbed

Dependencies:   mbed

Committer:
dheerajmpai23
Date:
Mon Jun 29 09:35:25 2015 +0000
Revision:
2:9958a83be730
Parent:
1:7d363b744c5f
Child:
3:09638e7d0923
Read and writing data in every While loop;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dheerajmpai23 0:3d0c404a914f 1 #include "mbed.h"
dheerajmpai23 0:3d0c404a914f 2 #define ENDL "\r" << endl
dheerajmpai23 0:3d0c404a914f 3 #include<iostream>
dheerajmpai23 0:3d0c404a914f 4 DigitalOut led(LED_RED);
dheerajmpai23 0:3d0c404a914f 5 DigitalOut CS(D10);
dheerajmpai23 0:3d0c404a914f 6
dheerajmpai23 0:3d0c404a914f 7
dheerajmpai23 0:3d0c404a914f 8 SPI adf(PTD6, PTD7, PTD5); // mosi, miso, sclk
dheerajmpai23 0:3d0c404a914f 9
dheerajmpai23 0:3d0c404a914f 10
dheerajmpai23 0:3d0c404a914f 11 void bbram_write()
dheerajmpai23 0:3d0c404a914f 12 {
dheerajmpai23 0:3d0c404a914f 13 CS=0;
dheerajmpai23 0:3d0c404a914f 14 // To bring in off state
dheerajmpai23 0:3d0c404a914f 15 adf.write(0xB0);
dheerajmpai23 1:7d363b744c5f 16 wait_ms(2);
dheerajmpai23 0:3d0c404a914f 17 CS=1;
dheerajmpai23 0:3d0c404a914f 18
dheerajmpai23 0:3d0c404a914f 19 // Write bbram
dheerajmpai23 0:3d0c404a914f 20 CS=0;
dheerajmpai23 0:3d0c404a914f 21 adf.write(0x19);
dheerajmpai23 0:3d0c404a914f 22 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 23 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 24 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 25
dheerajmpai23 0:3d0c404a914f 26 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 27 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 28 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 29 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 30
dheerajmpai23 0:3d0c404a914f 31 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 32 adf.write(0x33);
dheerajmpai23 0:3d0c404a914f 33 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 34 adf.write(0xF4);
dheerajmpai23 0:3d0c404a914f 35
dheerajmpai23 0:3d0c404a914f 36 adf.write(0xC2);
dheerajmpai23 0:3d0c404a914f 37 adf.write(0x10);
dheerajmpai23 0:3d0c404a914f 38 adf.write(0xC0);
dheerajmpai23 0:3d0c404a914f 39 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 40
dheerajmpai23 0:3d0c404a914f 41 adf.write(0x30);
dheerajmpai23 0:3d0c404a914f 42 adf.write(0x31);
dheerajmpai23 0:3d0c404a914f 43 adf.write(0x07);
dheerajmpai23 0:3d0c404a914f 44 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 45
dheerajmpai23 0:3d0c404a914f 46 adf.write(0x01);
dheerajmpai23 0:3d0c404a914f 47 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 48 adf.write(0x7F);
dheerajmpai23 0:3d0c404a914f 49 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 50
dheerajmpai23 0:3d0c404a914f 51 adf.write(0x0B);
dheerajmpai23 0:3d0c404a914f 52 adf.write(0x37);
dheerajmpai23 0:3d0c404a914f 53 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 54 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 55 adf.write(0x40);
dheerajmpai23 0:3d0c404a914f 56 adf.write(0x0C);
dheerajmpai23 0:3d0c404a914f 57 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 58 adf.write(0x05);
dheerajmpai23 0:3d0c404a914f 59 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 60 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 61 adf.write(0x18);
dheerajmpai23 0:3d0c404a914f 62 adf.write(0x12);
dheerajmpai23 0:3d0c404a914f 63 adf.write(0x34);
dheerajmpai23 0:3d0c404a914f 64 adf.write(0x56);
dheerajmpai23 0:3d0c404a914f 65 adf.write(0x10);
dheerajmpai23 0:3d0c404a914f 66 adf.write(0x10);
dheerajmpai23 0:3d0c404a914f 67 adf.write(0xC4); // Different
dheerajmpai23 0:3d0c404a914f 68 adf.write(0x14);
dheerajmpai23 0:3d0c404a914f 69 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 70 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 71 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 72 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 73 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 74 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 75 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 76 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 77 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 78 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 79 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 80 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 81 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 82 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 83 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 84 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 85 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 86 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 87 adf.write(0x04);
dheerajmpai23 0:3d0c404a914f 88 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 89 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 90 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 91 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 92 adf.write(0x00);
dheerajmpai23 0:3d0c404a914f 93 CS=1;
dheerajmpai23 1:7d363b744c5f 94 wait(1);
dheerajmpai23 0:3d0c404a914f 95
dheerajmpai23 0:3d0c404a914f 96 // Testmode register
dheerajmpai23 0:3d0c404a914f 97 CS=0;
dheerajmpai23 0:3d0c404a914f 98 adf.write(0x09);
dheerajmpai23 0:3d0c404a914f 99 adf.write(0x39);
dheerajmpai23 0:3d0c404a914f 100 adf.write(0x10);
dheerajmpai23 0:3d0c404a914f 101 CS=1;
dheerajmpai23 1:7d363b744c5f 102 wait_ms(2);
dheerajmpai23 0:3d0c404a914f 103
dheerajmpai23 0:3d0c404a914f 104 //CMD_CONFIG_DEV
dheerajmpai23 0:3d0c404a914f 105 CS=0;
dheerajmpai23 0:3d0c404a914f 106 adf.write(0xBB);
dheerajmpai23 0:3d0c404a914f 107 CS=1;
dheerajmpai23 2:9958a83be730 108 wait_ms(2);
dheerajmpai23 0:3d0c404a914f 109 CS=0;
dheerajmpai23 0:3d0c404a914f 110 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 111 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 112 CS=1;
dheerajmpai23 2:9958a83be730 113 wait_ms(2);
dheerajmpai23 0:3d0c404a914f 114 }
dheerajmpai23 0:3d0c404a914f 115
dheerajmpai23 0:3d0c404a914f 116 void data_write()
dheerajmpai23 0:3d0c404a914f 117 {
dheerajmpai23 0:3d0c404a914f 118 // PHY_ON
dheerajmpai23 0:3d0c404a914f 119 CS=0;
dheerajmpai23 0:3d0c404a914f 120 adf.write(0xB1);
dheerajmpai23 0:3d0c404a914f 121 CS=1;
dheerajmpai23 0:3d0c404a914f 122 wait(0.1);
dheerajmpai23 0:3d0c404a914f 123 CS=0;
dheerajmpai23 0:3d0c404a914f 124 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 125 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 126 CS=1;
dheerajmpai23 0:3d0c404a914f 127 wait(0.1);
dheerajmpai23 0:3d0c404a914f 128 // TRANSMIT_DATA LENGTH
dheerajmpai23 0:3d0c404a914f 129 CS=0;
dheerajmpai23 0:3d0c404a914f 130 adf.write(0x08);
dheerajmpai23 0:3d0c404a914f 131 adf.write(0x14);
dheerajmpai23 0:3d0c404a914f 132 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 133 CS=1;
dheerajmpai23 0:3d0c404a914f 134 wait(0.1);
dheerajmpai23 0:3d0c404a914f 135 CS=0;
dheerajmpai23 0:3d0c404a914f 136 adf.write(0x08);
dheerajmpai23 0:3d0c404a914f 137 adf.write(0x15);
dheerajmpai23 0:3d0c404a914f 138 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 139 CS=1;
dheerajmpai23 0:3d0c404a914f 140 wait(0.1);
dheerajmpai23 0:3d0c404a914f 141 // TX_BASE ADDRESS
dheerajmpai23 0:3d0c404a914f 142 CS=0;
dheerajmpai23 0:3d0c404a914f 143 adf.write(0x09);
dheerajmpai23 0:3d0c404a914f 144 adf.write(0x24);
dheerajmpai23 0:3d0c404a914f 145 adf.write(0x20);
dheerajmpai23 0:3d0c404a914f 146 CS=1;
dheerajmpai23 0:3d0c404a914f 147 wait(0.1);
dheerajmpai23 0:3d0c404a914f 148 // BUFFER SIZE
dheerajmpai23 0:3d0c404a914f 149 CS=0;
dheerajmpai23 0:3d0c404a914f 150 adf.write(0x09);
dheerajmpai23 0:3d0c404a914f 151 adf.write(0x37);
dheerajmpai23 0:3d0c404a914f 152 adf.write(0xE0);
dheerajmpai23 0:3d0c404a914f 153 CS=1;
dheerajmpai23 0:3d0c404a914f 154 wait(0.1);
dheerajmpai23 0:3d0c404a914f 155 CS=0;
dheerajmpai23 0:3d0c404a914f 156 adf.write(0x09);
dheerajmpai23 0:3d0c404a914f 157 adf.write(0x36);
dheerajmpai23 0:3d0c404a914f 158 adf.write(0x70);
dheerajmpai23 0:3d0c404a914f 159 CS=1;
dheerajmpai23 0:3d0c404a914f 160 wait(0.1);
dheerajmpai23 0:3d0c404a914f 161 // PACKET WRITE
dheerajmpai23 0:3d0c404a914f 162 CS=0;
dheerajmpai23 0:3d0c404a914f 163 adf.write(0x18);
dheerajmpai23 0:3d0c404a914f 164 adf.write(0x20);
dheerajmpai23 0:3d0c404a914f 165 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 166 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 167 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 168 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 169 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 170 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 171 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 172 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 173 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 174 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 175 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 176 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 177 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 178 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 179 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 180 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 181 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 182 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 183 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 184 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 185 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 186 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 187 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 188 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 189 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 190 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 191 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 192 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 193 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 194 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 195 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 196 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 197 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 198 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 199 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 200 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 201 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 202 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 203 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 204 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 205 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 206 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 207 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 208 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 209 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 210 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 211 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 212 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 213 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 214 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 215 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 216 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 217 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 218 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 219 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 220 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 221 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 222 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 223 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 224 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 225 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 226 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 227 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 228 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 229 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 230 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 231 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 232 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 233 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 234 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 235 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 236 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 237 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 238 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 239 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 240 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 241 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 242 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 243 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 244 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 245 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 246 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 247 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 248 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 249 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 250 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 251 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 252 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 253 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 254 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 255 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 256 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 257 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 258 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 259 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 260 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 261 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 262 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 263 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 264 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 265 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 266 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 267 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 268 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 269 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 270 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 271 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 272 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 273 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 274 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 275 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 276 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 277 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 278 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 279 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 280 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 281 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 282 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 283 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 284 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 285 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 286 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 287 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 288 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 289 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 290 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 291 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 292 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 293 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 294 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 295 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 296 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 297 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 298 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 299 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 300 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 301 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 302 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 303 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 304 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 305 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 306 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 307 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 308 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 309 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 310 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 311 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 312 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 313 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 314 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 315 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 316 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 317 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 318 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 319 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 320 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 321 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 322 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 323 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 324 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 325 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 326 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 327 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 328 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 329 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 330 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 331 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 332 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 333 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 334 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 335 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 336 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 337 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 338 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 339 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 340 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 341 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 342 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 343 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 344 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 345 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 346 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 347 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 348 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 349 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 350 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 351 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 352 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 353 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 354 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 355 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 356 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 357 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 358 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 359 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 360 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 361 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 362 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 363 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 364 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 365 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 366 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 367 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 368 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 369 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 370 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 371 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 372 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 373 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 374 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 375 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 376 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 377 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 378 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 379 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 380 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 381 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 382 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 383 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 384 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 385 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 386 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 387 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 388 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 389 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 390 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 391 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 392 adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 393 CS=1;
dheerajmpai23 2:9958a83be730 394 wait_ms(2);
dheerajmpai23 0:3d0c404a914f 395 // TX MODE
dheerajmpai23 0:3d0c404a914f 396 CS=0;
dheerajmpai23 0:3d0c404a914f 397 adf.write(0xB5);
dheerajmpai23 0:3d0c404a914f 398 CS=1;
dheerajmpai23 2:9958a83be730 399 wait_ms(20);
dheerajmpai23 0:3d0c404a914f 400 while(1)
dheerajmpai23 0:3d0c404a914f 401 {
dheerajmpai23 2:9958a83be730 402 pool_irq();
dheerajmpai23 0:3d0c404a914f 403 CS=0;
dheerajmpai23 0:3d0c404a914f 404 adf.write(0x2B);
dheerajmpai23 0:3d0c404a914f 405 adf.write(0x36);
dheerajmpai23 0:3d0c404a914f 406 int irq1 = adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 407 int irq2 = adf.write(0xFF);
dheerajmpai23 0:3d0c404a914f 408 CS=1;
dheerajmpai23 0:3d0c404a914f 409 wait_us(500);
dheerajmpai23 2:9958a83be730 410 cout<<irq1<<"/t"<<irq2<<ENDL;
dheerajmpai23 0:3d0c404a914f 411 }
dheerajmpai23 0:3d0c404a914f 412
dheerajmpai23 0:3d0c404a914f 413 }
dheerajmpai23 0:3d0c404a914f 414
dheerajmpai23 2:9958a83be730 415
dheerajmpai23 2:9958a83be730 416 void pool_irq(void){
dheerajmpai23 2:9958a83be730 417
dheerajmpai23 2:9958a83be730 418 adf.write(0x0B);
dheerajmpai23 2:9958a83be730 419 adf.write(0x36);
dheerajmpai23 2:9958a83be730 420 adf.write(0x98);
dheerajmpai23 2:9958a83be730 421
dheerajmpai23 2:9958a83be730 422 adf.write(0x09);
dheerajmpai23 2:9958a83be730 423 adf.write(0x00);
dheerajmpai23 2:9958a83be730 424 adf.write(0x98);
dheerajmpai23 2:9958a83be730 425
dheerajmpai23 2:9958a83be730 426 adf.write(0x29);
dheerajmpai23 2:9958a83be730 427 adf.write(0x00);
dheerajmpai23 2:9958a83be730 428 adf.write(0x00);
dheerajmpai23 2:9958a83be730 429 adf.write(0x00);
dheerajmpai23 2:9958a83be730 430 adf.write(0x00);
dheerajmpai23 2:9958a83be730 431 adf.write(0xFF);
dheerajmpai23 2:9958a83be730 432 adf.write(0xFF);
dheerajmpai23 2:9958a83be730 433
dheerajmpai23 2:9958a83be730 434 adf.write(0x2B);
dheerajmpai23 2:9958a83be730 435 adf.write(0x36);
dheerajmpai23 2:9958a83be730 436 adf.write(0x36);
dheerajmpai23 2:9958a83be730 437 adf.write(0x36);
dheerajmpai23 2:9958a83be730 438 adf.write(0x36);
dheerajmpai23 2:9958a83be730 439 adf.write(0xFF);
dheerajmpai23 2:9958a83be730 440 adf.write(0xFF);
dheerajmpai23 2:9958a83be730 441
dheerajmpai23 2:9958a83be730 442 }
dheerajmpai23 2:9958a83be730 443
dheerajmpai23 0:3d0c404a914f 444 int main()
dheerajmpai23 0:3d0c404a914f 445 {
dheerajmpai23 0:3d0c404a914f 446 adf.format(8,0);
dheerajmpai23 0:3d0c404a914f 447 adf.frequency(1000000);
dheerajmpai23 0:3d0c404a914f 448 bbram_write();
dheerajmpai23 0:3d0c404a914f 449 data_write();
dheerajmpai23 2:9958a83be730 450
dheerajmpai23 0:3d0c404a914f 451 }