#include"reg51.h" #define uchar unsigned char #define uint unsigned int bdata uchar BCC; bdata uchar BC; sbit buf=BCC^0; sbit RESET=P1^0; /*整体复位*/ sbit DAT=P1^4; /*数据口 RXD/D7*/ sbit W_CLOCK=P1^2; /*脉冲口 TXD/*/ sbit FQ_UD=P1^6; /*相位频率刷新控制端WR*/ delay(uint t) {while(--t);} void AD9850_init(void) { W_CLOCK=0; FQ_UD=0; delay(50); W_CLOCK=1; delay(50); W_CLOCK=0; delay(100); FQ_UD=1; delay(100); FQ_UD=0; } //========================================== void AD9850(uchar XiangW,long PinL) { uchar i; RESET=1; /*整机复位*/ delay(500); RESET=0; BCC=XiangW; /*myself*/ BC=PinL; /*myself*/ FQ_UD=0; W_CLOCK=0; for(i=0;i<8;i++) /*送相位控制字*/ { W_CLOCK=0; delay(100); if(XiangW&0x00000001) DAT=1; else DAT=0; delay(100); W_CLOCK=1; XiangW=BCC>>1; W_CLOCK=0; } for(i=0;i<32;i++) /*送频率控制字*/ { W_CLOCK=0; delay(100); if(PinL&0x00000001) DAT=1; else DAT=0; delay(100); W_CLOCK=1; PinL=BC>>1; W_CLOCK=0; } FQ_UD=1;delay(100);FQ_UD=0; } //============================================== main() { AD9850_init(); while(1) { AD9850(0,100); } } 帮我指点一下,为什么不出现波形,错误出现在哪里? 谢谢!!!!!
|