/*本驱动程序在 STM32 平台上测试通过,前面部分为头文件,后面部分为驱动主函数,如
要用在 51 平台上,只需要#dene AD9851_W_FLK_H GPIO_ResetBits(GPIOB,GPIO_Pin_B)改为
相应的引脚定义即可,比如可以换为 sbit W_FLK P0^0 ; #dene AD9851_W_FLK_H W_FLK=0;
引脚需做相应修改*/
#ifndef _DDS_H
#dene _DDS_H
#dene AD9851_W_FLK_H GPIO_ResetBits(GPIOB,GPIO_Pin_10);
#dene AD9851_W_FLK_L GPIO_SetBits(GPIOB,GPIO_Pin_10);
#dene AD9851_FQ_UD_L GPIO_SetBits(GPIOB,GPIO_Pin_11);
#dene AD9851_FQ_UD_H GPIO_ResetBits(GPIOB,GPIO_Pin_11);
#dene AD9851_RESET_L GPIO_SetBits(GPIOB,GPIO_Pin_13);
#dene AD9851_RESET_H GPIO_ResetBits(GPIOB,GPIO_Pin_13);
#dene AD9851_Bit_Set GPIO_SetBits(GPIOD,GPIO_Pin_15);
#dene AD9851_Bit_Reset GPIO_ResetBits(GPIOD,GPIO_Pin_15);
void AD9851_Reset(void);
void AD9851_Reset_Serial(void);
void AD9851_Write_Word(unsigned char Word);
void AD9851_WR_Parrel(unsigned char W0,double Frequence);
void AD9851_WR_Serial(unsigned char W0,double Frequence);
void Sweep_Frequency(double Start_Frequency,double End_Frequency,unsigned int
Sweep_Speed_10Ms);
#endif
/*9851 是最较简单的 DDS,只有频率字跟相位字,将上面的头文件直接包含进工程的 main
文件里面,就可以直接调用下面的函数体了*/
#include "DDS.h"
#include <stm32f10x_lib.h>
extern void Delay(vu32 nCount);
//---------------------------------------------------//
// ad9851 复位(并口模式) //
//---------------------------------------------------//
void AD9851_Reset(void)
{
AD9851_W_FLK_L;
AD9851_FQ_UD_L;
AD9851_RESET_L;
AD9851_RESET_H;
评论0