<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > c51單片機驅(qū)動AD9954的程序及調(diào)試

          c51單片機驅(qū)動AD9954的程序及調(diào)試

          作者: 時間:2012-10-24 來源:網(wǎng)絡(luò) 收藏

          下面是部分程序,與有興趣的朋友們一起分享(才起步,拙劣之處還請多多包涵):

          公共程序段:

          #include reg51.h>#include absacc.h>#include intrins.h>#define uchar unsigned charsbit ioupdate = P1^0;sbit sdio     = P1^1;sbit clk      = P1^2;sbit adcs     = P1^3;sbit adreset  = P1^4;sbit tlvcs    = P1^5;sbit ps0      = P1^6;void send(uchar dat){uchar i;for(i=0;i 8;i++){clk = 0;dat = _crol_(dat,1);sdio = dat0x01;clk = 1;}}程序1:(Single-Tone Mode)void main(){P1 = 0xff;adreset = 0;adcs = 0;send(0x00);        //CFR1send(0x02);        //bit1 OSK Enable,bit0 Auto OSK Enable;send(0x00);send(0x00);send(0x42);        //bit6 comp PD,bit1 SYNC_clk Disable;SYNC_clk = DDSclk/4;ioupdate = 0;ioupdate = 1;send(0x01);         //CFR2send(0x00);         //not used;send(0x08);         //bit3 High Speed SYNC Enable;send(0xa4);         //bit7-bit3 REF clk Multiplier factor;bit2 VCO Range  //(0:100-250;1:250-400);bit1-bit0 Charge Pump;send(0x02);        //ASF,when OSK Enabled(CFR1 bit25);send(0x3f);send(0xff);send(0x04);        //FTW0  0x 00 a3 d7 0a=1MHz  (0x ff ff ff ff ==> 400MHz)send(0x00);send(0xa3);send(0xd7);send(0x0a);send(0x05);        //POW0,Phase Initialsend(0x00);send(0x00);ioupdate = 0;ioupdate = 1;adcs = 1;adcs = 0;           //POW0.Phase shift 180 (0x 3f ff ==> 360)send(0x05);send(0x20);send(0x00);adcs = 1;ioupdate = 0;ioupdate = 1;}程序2:(Linear-Sweeping Mode)void main(){P1 = 0xff;adreset = 0;adcs = 0;send(0x00);         //CFR1send(0x00);send(0x20);         //bit5 Linear Sweeping Enablesend(0x00);send(0x46);         //bit2 Linear Sweeping No-Dwellioupdate = 0;ioupdate = 1;send(0x07);         //NLSCWsend(0x10);send(0x00);send(0x00);send(0x00);send(0x10);send(0x08);        //PLSCWsend(0x10);send(0x00);send(0x00);send(0x00);send(0x10);send(0x04);        //FTW0   0x 00 a3 d7 0a ==1MHz (0x ff ff ff ff ==> 400MHz)send(0x00);send(0xa3);send(0xd7);send(0x0a);send(0x06);        //FTW1  0x 01 68 72 b0 ==2.2MHz (0x ff ff ff ff ==> 400MHz))send(0x01);send(0x68);send(0x72);send(0xb0);adcs = 1;ioupdate = 0;ioupdate = 1;ps0 = ~ps0;        //Toggle ps0 to sweep;ps0 = ~ps0;}程序3:(_ADIcode)程序4:(RAM Mode) void main(){P1 = 0xff;ps0 = 0;adreset = 0;adcs = 0;send(0x01);       //CFR2send(0x00);       //not used;send(0x00);       //bit3 High Speed SYNC Enable;send(0xa4);       //bit7-bit3 REF clk Multiplier factor; bit1-bit0 Charge Pump;send(0x04);       //FTW0;send(0x12);send(0xf6);send(0x84);send(0xbe);ioupdate = 0;ioupdate = 1;send(0x00);       //CFR1send(0x80);       // bit7 RAM Enable;bit5-3 Internal Profile Controlsend(0x00);send(0x02);        //bit1 SDIO Only;send(0x00);        //bit6 comp PD,bit1 SYNC_clk Disable;SYNC_clk = DDSclk/4;send(0x02);        //ASF,when OSK Enabled(CFR1 bit25);send(0x3f);send(0xff);ioupdate = 0;ioupdate = 1;send(0x07);        //RSCW0;ps0 = 0; ps1 = 0;send(0xff);         //RAM Segment Address Ramp Rate 7:0>send(0xff);         //RAM Segment Address Ramp Rate 15:8>send(0x07);send(0x00);        //Segment0 Address:0x00000-0x00007send(0x00);        //RSCW0send(0x08);        //RSCW1;ps0 = 1; ps1 = 0;send(0xff);         //RAM Segment Address Ramp Rate 7:0>send(0xff);         //RAM Segment Address Ramp Rate 15:8>send(0x00);send(0x01);        //Segment1 Address:0x00000-0x00001send(0x04);adcs = 1;ioupdate = 0;ioupdate = 1;adcs = 0;send(0x0b);        //RAMsend(0x00);        //stall freq into RAM from the final address to beginning address;send(0xa3);send(0xd7);send(0x0a);                  //RAM0     1MHzsend(0x00);send(0xf5);send(0xc2);send(0x8f);                   //RAM1      1.5MHzsend(0x01);send(0x47);send(0xae);send(0x14);                   //RAM2       2MHzsend(0x01);send(0x99);send(0x99);send(0x99);                   //RAM3       2.5MHzsend(0x01);send(0xeb);send(0x85);send(0x1e);                   //RAM4       3MHzsend(0x02);send(0x3d);send(0x70);send(0xa3);                   //RAM5       3.5MHzsend(0x02);send(0x8f);send(0x5c);send(0x28);                   //RAM6       4MHzsend(0x02);send(0xe1);send(0x47);send(0xae);                   //RAM7       4.5MHzps0 = 1;send(0x0b);         //RAM Instruction Againsend(0x03);send(0x33);send(0x33);send(0x33);                   //RAM0       5MHzioupdate = 0;ioupdate = 1;send(0x07);         //RSCW0;ps0 = 0; ps1 = 0;send(0x00);         //RAM Segment Address Ramp Rate 7:0>send(0x04);         //RAM Segment Address Ramp Rate 15:8>send(0x07);send(0x00);send(0x60);         //RAM Mode of Operation: Continuous Bidirectional Rampadcs = 1;            //RSCW0ioupdate = 0;ioupdate = 1;}

          上一頁 1 2 下一頁

          關(guān)鍵詞: c51單片機 AD9954 RAM模式

          評論


          相關(guān)推薦

          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();