AD9834初始化
0赞
发表于 3/12/2012 11:20:41 PM
阅读(2317)
函数名称:Init_AD9850
功 能:初始化AD9850
参 数:无
返回值 :无
*********************************************/
void Init_AD9850(void)
{
#ifdef MODE_SEIAL //串行模式
GPIO_InitTypeDef GPIO_InitStructure ;
GPIO_InitStructure.GPIO_Pin = AD9850_WCLK | AD9850_FQUD | AD9850_RST | AD9850_DATA ;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz ;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(AD9850_CONTROL_PORT ,&GPIO_InitStructure) ;
AD9850_Reset_Sreial() ;
#endif
#ifdef MODE_PARALLEL //并行模式
GPIO_InitTypeDef GPIO_InitStructure ;
GPIO_InitStructure.GPIO_Pin = AD9850_WCLK | AD9850_FQUD | AD9850_RST ;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz ;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(AD9850_CONTROL_PORT ,&GPIO_InitStructure) ;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All ;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz ;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(AD9850_DATA_PORT ,&GPIO_InitStructure) ;
AD9850_Reset_Parallel() ;
#endif
}
#define AD9850_CONTROL_PORT GPIOA #define AD9850_FQUD GPIO_Pin_2 #define AD9850_WCLK GPIO_Pin_3 #define AD9850_RST GPIO_Pin_4 #ifdef MODE_PARALLEL //并行模式数据口0~7 #define AD9850_DATA_PORT GPIOC #endif #ifdef MODE_SEIAL //串行模式数据口 #define AD9850_DATA GPIO_Pin_5 #define AD9850_DATA_Write_1 GPIO_WriteBit(AD9850_CONTROL_PORT,AD9850_DATA,Bit_SET) #define AD9850_DATA_Write_0 GPIO_WriteBit(AD9850_CONTROL_PORT,AD9850_DATA,Bit_RESET) #endif #define AD9850_WCLK_SET GPIO_WriteBit(AD9850_CONTROL_PORT,AD9850_WCLK,Bit_SET) #define AD9850_WCLK_CLR GPIO_WriteBit(AD9850_CONTROL_PORT,AD9850_WCLK,Bit_RESET) #define AD9850_FQUD_SET GPIO_WriteBit(AD9850_CONTROL_PORT,AD9850_FQUD,Bit_SET) #define AD9850_FQUD_CLR GPIO_WriteBit(AD9850_CONTROL_PORT,AD9850_FQUD,Bit_RESET) #define AD9850_RST_SET GPIO_WriteBit(AD9850_CONTROL_PORT,AD9850_RST,Bit_SET) #define AD9850_RST_CLR GPIO_WriteBit(AD9850_CONTROL_PORT,AD9850_RST,Bit_RESET) /* 串行模式操作函数 */ #ifdef MODE_SEIAL extern void AD9850_Reset_Sreial(void) ; extern void AD9850_Write_Serial(unsigned char W0,unsigned long freq) ; #endif /* 并行模式操作函数 */ #ifdef MODE_PARALLEL extern void AD9850_Reset_Parallel(void) ; extern void AD9850_Write_Parallel(unsigned char W0,unsigned long freq) ; #endif extern void Init_AD9850(void) ; #endif /* AD8950_H */
