《STM32F030控制AD9851产生10Mhz正弦波.docx》由会员分享,可在线阅读,更多相关《STM32F030控制AD9851产生10Mhz正弦波.docx(5页珍藏版)》请在三一办公上搜索。
1、AD9851是一个DDS芯片,主时钟周期达到180MHz,由外部时钟6倍频得到。输出频率范围可以从1Hz到70MHz,频率控制精度很高。参数如下:FEATURES180 MHz Clock Rate with Selectable 6x Reference Clock MultiplierOn-Chip High Performance 10-Bit DAC and High SpeedComparator with HysteresisSFDR 43 dB 70 MHz Aqut32-Bit Frequency Tuning WordSimplified Control Interface:
2、 Parallel or SerialAsynchronous Loading Format5-Bit Phase Modulation and Offset CapabilitvComparator Jitter 80 ps p-p 20 MHz2.7 V to 5.25 V Single-Supply OperationLow Power: 555 mW 180 MHzPower-Down Function, 4 mW 2.7 VUhrasmall 28-Lead SSOP PackagingAPPLICATIONSFrequency/Phase-Agile SineWave Svnthe
3、sisClock Recovery and Locking Circuitry for Digital CommunicationsDigitally Corlrolled ADC Encode GeneratorAgile Local Oscillator Applications in CommunicationsQuadrature OscillatorCW, AM. FM, FSK, MSK Mo de TransmitterFUNCTIONAL BLOCK DIAGRAMAD9B51o-Bx REFCLK MULTIPLIERHIGH &PEED4DDSV+VSGNDMASTERRE
4、SETREFCLOCK IN、矿 PHASE* AND CONTROL WORfJSFREQUENC/PHASE DATA REGISTERGTATA INPUT F1EGISTEF132-BIT TUNING WORDFREQUENCYUPDATE/DATAAEGISTERPARALLEL LOADWORD LOAD CLOCKSERIAL a LOAD -61 BIT x8 BITS x40 LOADS5 LOADSFREQUENCY, PHASEAND CONTROL DATA INPUTDAC RjETANALOGCLOCK OUTCLOCK OUTCDMPARATOF11O-BIT
5、DACANALOG OUT输出频率的计算公式如下:二俗 Phase X Sysrem Clock)where睫-decimal value of 32-bit frequency tuning word.在这里采用datasheet里用的数据使输出频率为10MHz,更改频率控制字W1W2W3W4可以得到其他频率。复位时序:SYMBOLDEFINITIONMIN SPECtfiHGLK DELAY AFTER RESET RISING EDGEIIRESET falling ede aftea clkRRRECOVERY FROM RESET2 SVSCLK CYCLESMINIMUM RESE
6、T WIDTH5 SV5CLK CYCLESt0LHESET OUTPUT LATE NG?13SYSCLK CYCLESSPECinCATIOKS DDhlffT APPLY WHEN THE REF CLOC 0; reset_i-);GPIO_ResetBits(GPIOC , GPIO_Pin_2);for(reset_i=200; reset_i0; reset_i-);/step2:write the frequency and phase parameter to the ad9851void set_ad9851(uint32 ad9851_freg)uint8 w5;uint
7、8 i=0;int set_i;w0=9;w1=(ad9851_freg&0xff000000)24;w=(ad9851_freg&0x00ff0000)16;w3=(ad9851_freg&0x0000ff00)8;w4=(ad9851_freg&0x000000ff);GPIO_ResetBits(GPIOC , GPIO_Pin_1);for(i=0;i0; set_i-);GPIO_Write(GPIOA,wi);for(set_i=20; set_i0; set_i-);GPIO_SetBits(GPIOC , GPIO_Pin_0);for(set_i=20; set_i0; se
8、t_i-);/dont forger to reset the fqud port after write fqud parameterGPIO_ResetBits(GPIOC , GPIO_Pin_1);for(set_i=20; set_i0; set_i-);GPIO_SetBits(GPIOC , GPIO_Pin_1);for(set_i=20; set_i0; set_i-);GPIO_ResetBits(GPIOC , GPIO_Pin_1);#ifdef USE_FULL_ASSERT/* brief Reports the name of the source file an
9、d the source line number* where the assert_param error has occurred.* param file: pointer to the source file name* param line: assert_param error line source number* retval None*/void assert_failed(uint8_t* file, uint32_t line)/* User can add his own implementation to report the file name and line number, ex: printf(Wrong parameters value: file %s on line %drn, file, line) */* Infinite loop */while (1)#endif附上实物拍照及正弦波波形图:TigdM Pos: 0.000sTTekSAVE REC动祚存图像格式JPEG关于存图像选择文件夹储存TEK0000.JPG怎么样,是不是很漂亮。A_AM 50.0nsCH1 Z 1.11V