?? ad9954.h
字號:
#ifndef __ad9954_h__
#define __ad9954_h__
//-------------include files----------------------------//
#include "..\header\arm.h"
//-------------AD9954 register define------------------//
//Instruction Byte Define
#define INSTRUCTION_CFR1 0x00 //Function Register 1
#define INSTRUCTION_CFR2 0x01 //Function Register 2
#define INSTRUCTION_ASF 0x02 //Channel Frequency Tuning Word
#define INSTRUCTION_ARR 0x03 //Channel Phase Offset Word
#define INSTRUCTION_FTW0 0x04 //Amplitude Control
#define INSTRUCTION_POW0 0x05 //Linear Sweep Ramp Rate
#define INSTRUCTION_FTW1 0x06 //LSR Rising Delta
#define INSTRUCTION_RSCW0 0x07 //LSR Falling Delta
#define INSTRUCTION_RSCW1 0x08
#define INSTRUCTION_RSCW2 0x09
#define INSTRUCTION_RSCW3 0x0A
#define INSTRUCTION_RAM 0x0B
//------------Hardware Define--------------------------//
//PIN initialize;
#define AD9954_CS_PORT_NUMBER 17 /* P1 */
#define AD9954_UPDATE_PORT_NUMBER 16 /* P1 */
#define AD9954_DDSSDI_PORT_NUMBER 18 /* P1 */
#define AD9954_DDSCR_PORT_NUMBER 31 /* P0 */
#define AD9954_DDSCLK_PORT_NUMBER 27 /* P0 */
#define AD9954_DDSSYN_PORT_NUMBER 28 /* P0 */
#define AD9954_DDSOSK_PORT_NUMBER 19 //P1
//control direction of the shaped on-off keying function when programmed for operation.
#define INITIALIZE_AD9954_PORT IO1DIR|=(1<<AD9954_CS_PORT_NUMBER); \
IO1DIR|=(1<<AD9954_UPDATE_PORT_NUMBER); \
IO1DIR|=(1<<AD9954_DDSSDI_PORT_NUMBER); \
IO1DIR|=(1<<AD9954_DDSOSK_PORT_NUMBER); \
IO0DIR|=(1<<AD9954_DDSCR_PORT_NUMBER); \
IO0DIR|=(1<<AD9954_DDSCLK_PORT_NUMBER); \
IO0DIR|=(1<<AD9954_DDSSYN_PORT_NUMBER);
//PIN control;
#define AD9954_CS_PORT (p1.bits.bit17) //
#define AD9954_UPDATE_PORT (p1.bits.bit16)
//In update_port rising edge transfer the contents of the buffer to I/Oregister;
#define AD9954_DDSSDI_PORT (p1.bits.bit18)
#define AD9954_DDSCR_PORT (p0.bits.bit31) //dds reset pin
#define AD9954_DDSCLK_PORT (p0.bits.bit27)
#define AD9954_DDSSYN_PORT (p0.bits.bit28)
//Add osk pin p1.9;
#define AD9954_DDSOSK_PORT (p1.bits.bit19) //DDS OSK PIN p1.9;
#define AD9954_CS_ON AD9954_CS_PORT=1; \
IO1PIN=p1.value;
#define AD9954_CS_OFF AD9954_CS_PORT=0; \
IO1PIN=p1.value;
#define AD9954_UPDATE_ON AD9954_UPDATE_PORT=1; \
IO0PIN=p0.value;
#define AD9954_UPDATE_OFF AD9954_UPDATE_PORT=0; \
IO0PIN=p0.value;
#define AD9954_DDSCR_ON AD9954_DDSCR_PORT=1; \
IO0PIN=p0.value;
#define AD9954_DDSCR_OFF AD9954_DDSCR_PORT=0; \
IO0PIN=p0.value;
#define AD9954_DDSSYN_ON AD9954_DDSSYN_PORT=1; \
IO0PIN=p0.value;
#define AD9954_DDSSYN_OFF AD9954_DDSSYN_PORT=0; \
IO0PIN=p0.value;
#define AD9954_DDSCLK_ON AD9954_DDSCLK_PORT=1; \
IO0PIN=p0.value;
#define AD9954_DDSCLK_OFF AD9954_DDSCLK_PORT=0; \
IO0PIN=p0.value;
#define AD9954_DDSSDI_ON AD9954_DDSSDI_PORT=1; \
IO1PIN=p1.value;
#define AD9954_DDSSDI_OFF AD9954_DDSSDI_PORT=0; \
IO1PIN=p1.value;
/*****************Add osk pin controlling***********************************/
#define AD9954_DDSOSK_ON AD9954_DDSOSK_PORT=1; \
IO1PIN=p1.value;
#define AD9954_DDSOSK_OFF AD9954_DDSOSK_PORT=0; \
IO1PIN=p1.value;
//-------------Software define----------------------//
#define AD9954_PLL_MULTIPLE 6
#define AD9954_CLOCK 20*100000*6
//-------------Extern Function----------------------//
//extern int set_ad9954_pll( int mult) ;
extern void AD9954_init(void) ;
extern int set_frequency(int chan,double freq) ;
extern int set_phase(int chan,double pha) ;
extern void write_CFR1(unsigned char w1,unsigned char w2,unsigned char w3,unsigned char w4) ;
extern void write_FTW0(unsigned char w1,unsigned char w2,unsigned char w3,unsigned char w4) ;
extern void write_CFR2(unsigned char w1,unsigned char w2,unsigned char w3) ;
extern void write_ASF(unst16 w1,unst16 w2);
extern void write_POW0(unst16 w1,unst16 w2);
#endif //edif __ad9954_h__
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -