|
在應用ADF4360-7時找到的學習應用資料,用的是MSP430F149單片機。
資料包括
官方資料:芯片數據手冊、應用手冊、開發板資料等
原理圖:ADF4360-7及控制部分原理圖(Altium Designer Winter 09 格式和PDF格式),所需元件封裝庫等
控制程序:基于MSP430F149的控制程序及其他參考程序
單片機源程序如下:
- /***********************************************************************************************
- 文件:ADF4370.H
- 作者:沨
- 用途:集成鎖相環ADF4360-7控制程序
- MCU: MSP430F149 晶振:8MHz
- 編譯器:IAR Ror MSP430 5.10
- 硬 件:2011_10_06
- 說明:
- 日期:下午 02:56 2011-12-5
- ***********************************************************************************************/
- #define uchar unsigned char
- #define uint unsigned int
- #define PLL_SET_CE() P5OUT |= BIT0 //P5.0->CE
- #define PLL_CLR_CE() P5OUT &=~BIT0
- #define PLL_SET_DATA() P5OUT |= BIT1 //P5.1->DATA
- #define PLL_CLR_DATA() P5OUT &=~BIT1
- #define PLL_SET_DATA_OUT() P5DIR |= BIT1
- #define PLL_SET_DATA_IN() P5DIR &=~BIT1
- #define PLL_DATA_IN (P5IN & BIT1)
- #define PLL_SET_SCL() P5OUT |= BIT3 //P5.3->SCL
- #define PLL_CLR_SCL() P5OUT &=~BIT3
- #define PLL_SET_LE() P5OUT |= BIT4 //P5.4->LE
- #define PLL_CLR_LE() P5OUT &=~BIT4
- #define PLL_LD_IN (P5IN & BIT5)
- #define PLL_IO_SET P5DIR = 0xDB; //PLL端口配置
- //===========================變量定義=======================================
- /*-------------------------------------400MHz---------------------------------------------
- ----------------------------------------------------------------------------------------*/
- unsigned char CONTROL_LATCH[3] ={0x0F,0xF1,0x20};
- unsigned char N_COUNTER_LATCH[3] ={0x00,0x0A,0X02};
- unsigned char R_COUNTER_LATCH[3] ={0x30,0x00,0x09};
- void delay (unsigned int length)
- {
- while (length >0)
- length--;
- }
- //--------------------------------------------------------------------------------
- void DelaymS(uint ms)
- {
- uint i;
- while(ms--)
- {
- for(i=1;i<(uint)(8*143-2);i++)
- ;
- }
- }
- //---------------------------------
- //void WriteToADF4350(unsigned char count,unsigned char *buf);
- //---------------------------------
- //Function that writes to the ADF4350 via the SPI port. 函數,該函數通過SPI端口寫入ADF4350。
- //--------------------------------------------------------------------------------
- void WriteToADF4360(unsigned char count, unsigned char *buf)
- {
- unsigned char ValueToWrite = 0;
- unsigned char i = 0;
- unsigned char j = 0;
-
- PLL_SET_DATA_OUT();
-
- delay(10);
- PLL_CLR_SCL();
- PLL_CLR_LE();
- delay(10);
- for(i=0;i<count;i++)
- {
- ValueToWrite = *(buf + i);
- for(j=0; j<8; j++)
- {
- if(0x80 == (ValueToWrite & 0x80))
- {
- PLL_SET_DATA(); //Send one to SDO pin
- }
- else
- {
- PLL_CLR_DATA(); //Send zero to SDO pin
- }
- delay(10);
- PLL_SET_SCL();
- delay(10);
- ValueToWrite <<= 1; //Rotate data
- PLL_CLR_SCL();
- }
- }
- PLL_CLR_DATA();
- delay(10);
- PLL_SET_LE();
- delay(10);
- PLL_CLR_LE();
- }
- //---------------------------------
- //void ReadFromADF4350(unsigned char count,unsigned char *buf)從ADF4350讀取
- //---------------------------------
- //Function that reads from the ADF4350 via the SPI port. 該函數通過SPI端口從ADF4350中讀取數據。
- //--------------------------------------------------------------------------------
- void ReadFromADF4360(unsigned char count, unsigned char *buf)
- {
- unsigned char i = 0;
- unsigned char j = 0;
- unsigned int iTemp = 0;
- unsigned char RotateData = 0;
- PLL_SET_DATA_IN();
-
- delay(1);
- PLL_CLR_SCL();
- PLL_CLR_LE();
- delay(1);
- for(j=0; j<count; j++)
- {
- for(i=0; i<8; i++)
- {
- RotateData <<= 1; //Rotate data
- delay(1);
- iTemp = PLL_DATA_IN; //Read DATA of ADF4350
- PLL_SET_SCL();
- if(iTemp)
- {
- RotateData |= 1;
- }
- delay(1);
- PLL_CLR_SCL();
- }
- *(buf + j)= RotateData;
- }
- delay(1);
- PLL_SET_LE();
- delay(1);
- PLL_CLR_LE();
- }
- void PLL_set_frq (void)
- { DelaymS(20);
- PLL_SET_CE();
- WriteToADF4360(3,R_COUNTER_LATCH);
- WriteToADF4360(3,CONTROL_LATCH); //
- DelaymS(50); //需大于10mS
- WriteToADF4360(3,N_COUNTER_LATCH); //
- }
復制代碼 |
-
123.png
(6.79 KB, 下載次數: 212)
下載附件
2019-6-19 10:23 上傳
-
-
ADF4360-7應用資料.rar
2019-6-19 10:21 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
4.5 MB, 下載次數: 18, 下載積分: 黑幣 -5
評分
-
查看全部評分
|