ADF7023

Dependencies:   mbed

Committer:
dheerajmpai23
Date:
Thu Jul 09 06:54:58 2015 +0000
Revision:
0:ce145b9eae71
ADF7023;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dheerajmpai23 0:ce145b9eae71 1 #include <mbed.h>
dheerajmpai23 0:ce145b9eae71 2 #include <iostream>
dheerajmpai23 0:ce145b9eae71 3 using namespace std;
dheerajmpai23 0:ce145b9eae71 4 #define ENDL "\r" << endl
dheerajmpai23 0:ce145b9eae71 5
dheerajmpai23 0:ce145b9eae71 6 //DigitalOut ledr(LED_RED);
dheerajmpai23 0:ce145b9eae71 7
dheerajmpai23 0:ce145b9eae71 8 DigitalIn clk(D8);
dheerajmpai23 0:ce145b9eae71 9 DigitalOut DT(D9);
dheerajmpai23 0:ce145b9eae71 10 int j=0;
dheerajmpai23 0:ce145b9eae71 11 /*unsigned char data [] = {
dheerajmpai23 0:ce145b9eae71 12 0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,
dheerajmpai23 0:ce145b9eae71 13 0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,
dheerajmpai23 0:ce145b9eae71 14 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
dheerajmpai23 0:ce145b9eae71 15 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
dheerajmpai23 0:ce145b9eae71 16 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,
dheerajmpai23 0:ce145b9eae71 17 0xE5,0xEE,0x00,0x72,0xE1,0x5A,0x2F,0xCE,0xB8,0x2F,
dheerajmpai23 0:ce145b9eae71 18 0xAD,0xB7,0x42,0x6B,0x65,0x1B,0x07,0xD4,0x6A,0x6C,
dheerajmpai23 0:ce145b9eae71 19 0x15,0x15,0x3C,0xAA,0x38,0xAE,0x66,0x7E,0x9B,0x66,
dheerajmpai23 0:ce145b9eae71 20 0x58,0x79,0xBC,0xB8,0x0A,0xB2,0x04,0x34,0x00,0x00,
dheerajmpai23 0:ce145b9eae71 21 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,
dheerajmpai23 0:ce145b9eae71 22 0xE5,0xEE,0x00,0x0D,0x60,0xFF,0x40,0xFA,0xF7,0xDC,
dheerajmpai23 0:ce145b9eae71 23 0x92,0xEB,0xA4,0xC6,0x8C,0x08,0xB7,0x82,0x96,0xBD,
dheerajmpai23 0:ce145b9eae71 24 0x58,0xC0,0x1C,0x10,0x06,0x36,0x82,0xD0,0x95,0x98,
dheerajmpai23 0:ce145b9eae71 25 0x51,0xBD,0xAA,0xE5,0x94,0x61,0x26,0xA0,0x00,0x00,
dheerajmpai23 0:ce145b9eae71 26 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
dheerajmpai23 0:ce145b9eae71 27 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
dheerajmpai23 0:ce145b9eae71 28 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
dheerajmpai23 0:ce145b9eae71 29 0x00,0x01,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x59,
dheerajmpai23 0:ce145b9eae71 30 0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x58,0x00,0x00,
dheerajmpai23 0:ce145b9eae71 31 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
dheerajmpai23 0:ce145b9eae71 32 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
dheerajmpai23 0:ce145b9eae71 33 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
dheerajmpai23 0:ce145b9eae71 34 0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x59,0x97,0x4C,
dheerajmpai23 0:ce145b9eae71 35 0x18,0x22,0xEF,0x9F,0x34,0x58,0x00,0x00,0x00,0x00,
dheerajmpai23 0:ce145b9eae71 36 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
dheerajmpai23 0:ce145b9eae71 37 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
dheerajmpai23 0:ce145b9eae71 38 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
dheerajmpai23 0:ce145b9eae71 39 };
dheerajmpai23 0:ce145b9eae71 40 */
dheerajmpai23 0:ce145b9eae71 41 //isr=5
dheerajmpai23 0:ce145b9eae71 42 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,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xCC,0xB3,0xB2,0x5B,0x96,0x38,0x71,0x96,0x54,0xE2,0x4A,0x7F,0xC9,0xB7,0x1E,0x56,0x09,0x30,0x18,0x5A,0x84,0xFA,0xC1,0x9D,0xA6,0x6A,0x17,0x50,0x6F,0xD4,0x34,0x1D,0xF0,0xE0,0xE2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0x78,0xC9,0x9A,0x09,0xE2,0x34,0xF9,0x39,0x61,0x36,0x9C,0xC2,0x98,0xB9,0x54,0xC0,0xDC,0xE6,0x90,0xF6,0xF6,0x88,0xD1,0xA5,0x5A,0x75,0x83,0x78,0x08,0xD6,0x9D,0xDE,0xB8,0x58,0xD4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0x13,0x3F,0x78,0xD9,0x4E,0xB7,0xE8,0xD6,0x0D,0x1E,0xF1,0xC4,0xB9,0xAB,0x90,0x39,0x6A,0x9E,0x8A,0xB8,0xC9,0xAF,0x5E,0x85,0x66,0xBF,0x4E,0xB3,0xD3,0x54,0x9B,0x7D,0xA3,0x3A,0x1A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0x81,0x83,0x7B,0x88,0x8A,0xAB,0x31,0x91,0x8F,0xA0,0x91,0x05,0x17,0xC2,0xD2,0xB9,0xC1,0xEE,0x97,0xCE,0x66,0xE9,0x8A,0xA4,0xBC,0xB1,0xFC,0xCB,0x3B,0x24,0x6E,0x5B,0x87,0x19,0x64,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,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};
dheerajmpai23 0:ce145b9eae71 43 //without eos with isr=5
dheerajmpai23 0:ce145b9eae71 44 //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,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xCC,0xB3,0xB2,0x5B,0x96,0x38,0x71,0x96,0x54,0xE2,0x4A,0x7F,0xC9,0xB7,0x1E,0x56,0x09,0x30,0x18,0x5A,0x84,0xFA,0xC1,0x9D,0xA6,0x6A,0x17,0x50,0x6F,0xD4,0x34,0x1D,0xF0,0xE0,0xE2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0x78,0xC9,0x9A,0x09,0xE2,0x34,0xF9,0x39,0x61,0x36,0x9C,0xC2,0x98,0xB9,0x54,0xC0,0xDC,0xE6,0x90,0xF6,0xF6,0x88,0xD1,0xA5,0x5A,0x75,0x83,0x78,0x08,0xD6,0x9D,0xDE,0xB8,0x58,0xD4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0x13,0x3F,0x78,0xD9,0x4E,0xB7,0xE8,0xD6,0x0D,0x1E,0xF1,0xC4,0xB9,0xAB,0x90,0x39,0x6A,0x9E,0x8A,0xB8,0xC9,0xAF,0x5E,0x85,0x66,0xBF,0x4E,0xB3,0xD3,0x54,0x9B,0x7D,0xA3,0x3A,0x1A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0x81,0x83,0x7B,0x88,0x8A,0xAB,0x31,0x91,0x8F,0xA0,0x91,0x05,0x17,0xC2,0xD2,0xB9,0xC1,0xEE,0x97,0xCE,0x66,0xE9,0x8A,0xA4,0xBC,0xB1,0xFC,0xCB,0x3B,0x24,0x6E,0x5B,0x87,0x19,0x64,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
dheerajmpai23 0:ce145b9eae71 45 //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,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,0xF2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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,0xD6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0x84,0xAE,0xDE,0xD1,0x76,0x86,0x85,0x22,0x4F,0x94,0x20,0x75,0xB7,0x25,0x46,0x32,0x85,0x42,0xE1,0x82,0x89,0x14,0x28,0xF2,0x66,0x27,0x27,0x2D,0x5D,0x62,0xA0,0x72,0x16,0xA0,0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0x55,0x04,0x27,0xCF,0xA2,0x11,0x37,0x3A,0xE7,0x02,0xB5,0x05,0x60,0x37,0xFC,0xF3,0x86,0x71,0x46,0x6C,0x1D,0x57,0xBF,0x1C,0xB0,0x17,0xF7,0xCA,0x8F,0xAC,0xE0,0x86,0x5E,0x7F,0xD2,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,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};
dheerajmpai23 0:ce145b9eae71 46 //for without eos with isr=4
dheerajmpai23 0:ce145b9eae71 47 //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,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,0xF2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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,0xD6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0x84,0xAE,0xDE,0xD1,0x76,0x86,0x85,0x22,0x4F,0x94,0x20,0x75,0xB7,0x25,0x46,0x32,0x85,0x42,0xE1,0x82,0x89,0x14,0x28,0xF2,0x66,0x27,0x27,0x2D,0x5D,0x62,0xA0,0x72,0x16,0xA0,0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0x55,0x04,0x27,0xCF,0xA2,0x11,0x37,0x3A,0xE7,0x02,0xB5,0x05,0x60,0x37,0xFC,0xF3,0x86,0x71,0x46,0x6C,0x1D,0x57,0xBF,0x1C,0xB0,0x17,0xF7,0xCA,0x8F,0xAC,0xE0,0x86,0x5E,0x7F,0xD2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
dheerajmpai23 0:ce145b9eae71 48 void send_data(){
dheerajmpai23 0:ce145b9eae71 49 // static int current_byte = 0;
dheerajmpai23 0:ce145b9eae71 50 static int current_bit = 7;
dheerajmpai23 0:ce145b9eae71 51
dheerajmpai23 0:ce145b9eae71 52 DT = (data[j] >> current_bit) & 1;
dheerajmpai23 0:ce145b9eae71 53 --current_bit;
dheerajmpai23 0:ce145b9eae71 54
dheerajmpai23 0:ce145b9eae71 55 if(current_bit == -1){
dheerajmpai23 0:ce145b9eae71 56 current_bit = 7;
dheerajmpai23 0:ce145b9eae71 57 j++;
dheerajmpai23 0:ce145b9eae71 58 // cout<<"SENDING"<<ENDL;
dheerajmpai23 0:ce145b9eae71 59 if(j>=sizeof(data))
dheerajmpai23 0:ce145b9eae71 60 {
dheerajmpai23 0:ce145b9eae71 61 j=0;
dheerajmpai23 0:ce145b9eae71 62
dheerajmpai23 0:ce145b9eae71 63
dheerajmpai23 0:ce145b9eae71 64 // while(true);
dheerajmpai23 0:ce145b9eae71 65 }
dheerajmpai23 0:ce145b9eae71 66 }
dheerajmpai23 0:ce145b9eae71 67 }
dheerajmpai23 0:ce145b9eae71 68
dheerajmpai23 0:ce145b9eae71 69 int main(){
dheerajmpai23 0:ce145b9eae71 70
dheerajmpai23 0:ce145b9eae71 71 // cout<<"PHYJJJJJJJ"<<ENDL;
dheerajmpai23 0:ce145b9eae71 72 int state;
dheerajmpai23 0:ce145b9eae71 73 if(clk == 0){
dheerajmpai23 0:ce145b9eae71 74 state = 0;
dheerajmpai23 0:ce145b9eae71 75 }
dheerajmpai23 0:ce145b9eae71 76 else{
dheerajmpai23 0:ce145b9eae71 77 state = 1;
dheerajmpai23 0:ce145b9eae71 78 }
dheerajmpai23 0:ce145b9eae71 79
dheerajmpai23 0:ce145b9eae71 80
dheerajmpai23 0:ce145b9eae71 81 while(true){
dheerajmpai23 0:ce145b9eae71 82
dheerajmpai23 0:ce145b9eae71 83
dheerajmpai23 0:ce145b9eae71 84 if(clk == 0){
dheerajmpai23 0:ce145b9eae71 85 if(state == 1){
dheerajmpai23 0:ce145b9eae71 86 state = 0;
dheerajmpai23 0:ce145b9eae71 87 send_data();
dheerajmpai23 0:ce145b9eae71 88 }
dheerajmpai23 0:ce145b9eae71 89 }
dheerajmpai23 0:ce145b9eae71 90 else{
dheerajmpai23 0:ce145b9eae71 91 state = 1;
dheerajmpai23 0:ce145b9eae71 92 }
dheerajmpai23 0:ce145b9eae71 93 }}