AD9834 frequency sweeper based on msp430

Publisher:DelightfulGazeLatest update time:2012-08-22 Source: 51heiKeywords:msp430  AD9834 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
/*****************************************************
AD9834 Waveform Generation Program
*****************************************************/
#include

#define    FSYNCL   P2OUT &=  ~BIT5  
#define    FSYNCH   P2OUT |=   BIT5  
 
#define    SCLKL    P2OUT &= ~BIT6  
#define    SCLKH    P2OUT |=  BIT6  
#define    SDATAL   P2OUT &=  ~BIT7
#define    SDATAH   P2OUT |=   BIT7
double   data=1000 ;
#define FCLK 50
#define uchar unsigned char
#define uint  unsigned int
#define long unsigned long
int x;
/**************************
Send control word
**************************/
void Send_Con(uint Con_word)
{
flying i;
FSYNCL;
for(i=0;i<16;i++)
{

   if ((Con_word&0x8000)==0x8000)
   {SDATAH;}
     else
        SDATAL ;
    
Con_word<<=1;
SCLKL;
SCLKH;
}
FSYNCH;
}
/****************************************************
Initialization function:
-------------------------------------------------------------------
Function: software bit control, IOUT sine wave, SIGNBITOUT square wave, write FREQREG0, write PHASE0
Send_Con(0x2038) write FREQREG0 once
Send_Con(0x0038) rewrites the LSB of FREQREG0 alone
Send_Con(0x1038) rewrites the MSB of FREQREG0 alone
-------------------------------------------------------------------
Function: Software bit control, IOUT triangle wave write FREQREG0, write PHASE0
Send_Con(0x2002) write FREQREG0 once
Send_Con(0x0002) rewrites the LSB of FREQREG0 alone
Send_Con(0x1008) rewrite the MSB of FREQREG0 alone****************************/

/****************************
Send frequency word
****************************/
void Send_Freq(uint Freq_word)
{
flying i;
FSYNCL;
for(i=0;i<16;i++)
{
if ((Freq_word&0x8000)==0x8000)
   {SDATAH;}
  else
        SDATAL ;
Freq_word<<=1;
SCLKL;
SCLKH;
}
FSYNCH;
}

/*****************************  q
Send phase word
Note: According to the situation, you can set the input parameters and phase
*****************************/
void Send_Phase()
{
Send_Con(0xC000); //Set the initial phase to 0
}


/*******************************************************
Set the frequency value Freq_value(value)=Freq_data(data)*FCLK/2^28
2^28=268435456=0x10000000
*******************************************************/
void zhengxianbo(ulong Freq_value )
{
head value1,value2;
uint LSB_D,MSB_D;
SCLKH;
FSYNCH;
value1= Freq_value;
value2= Freq_value;


LSB_D=(value1%0x4000)+0x4000; //write LSB of FREQ0 REG
MSB_D=(value2/0x4000)+0x4000; //Write the MSB of FREQ0 REG

Send_Con(0x2038);    
//DDS initialization settings, IOUT sine wave, SIGNBITOUT square wave, one-time write FREQREG0
Send_Freq(LSB_D); 
Send_Freq(MSB_D);
void Send_Phase();

}
void main()
{uint n;
static ulong x=0;
 static ulong Freq_value;
 WDTCTL=WDTPW+WDTHOLD;
 P2DIR=0Xff;
  while(1)
  {
 

 
  for(x=0;x<10;x++)
  {
    if(x==9)
      data=1000;
    else
    data=data+1000*x;
  Freq_value=(ulong)(data*5.3687);
  zhengxianbo(Freq_value);
   for(n=0;n<20000;n++);
  }
  }
}
Keywords:msp430  AD9834 Reference address:AD9834 frequency sweeper based on msp430

Previous article:Application and design of SPCE061A in sensor test system
Next article:Application of MSP430 in frequency measurement system

Recommended ReadingLatest update time:2024-11-16 16:43

Clock signal of MSP430 microcontroller
  MSP430 has three clock signals: MCLK system main clock; SMCLK system sub-clock; ACLK auxiliary clock.      (1) MCLK system main clock. In addition to the CPU operation using this clock, peripheral modules can also use it. MCLK can select the clock signal generated by any oscillator and divide it by 1, 2, 4, or 8 as
[Microcontroller]
Design of SLED Control System Based on MSP430 Single Chip Microcomputer
Since Kurbativ et al. first prepared semiconductor SLED in 1971, SLED has achieved amazing development. Especially in recent years, it has been widely used in fiber optic gyroscopes, fiber optic sensors, optical time domain transmitters, etc. SLED has the advantages of both LD and LED. It is a spontaneous radiation
[Microcontroller]
How to solve the problem of "INF cannot find the required section" when installing MSP430 USB JTAG
I have done experiments before and found that the INF error of this emulator appeared on my computer. I guessed that it might be the system problem, because I have taken the emulator to a computer with the same non-simplified system and there was no problem. Today I finally found a solution: 1. First, follow the steps
[Microcontroller]
The necessity of learning MSP430
1. Advantages of 430 • Low power consumption, ultra-low power consumption, it has one active mode and five low power modes. In active mode, the power consumption is only 250us/MIPS, and the maximum leakage current of the I/O input port is only 50nA. • It has powerful data processing capabilities and uses a RISC (reduc
[Microcontroller]
The necessity of learning MSP430
MSP430 single-chip microcomputer system application structure design and selection
1 Introduction to MSP430 MSP430 is a 16-bit microcontroller series product launched by TI, which has unique advantages in battery-powered low-power applications. Its operating voltage is 1.8~3.6 V, and the power consumption can be controlled at about 200μA during normal operation. The low-power mode ca
[Microcontroller]
MSP430 single-chip microcomputer system application structure design and selection
MSP430F5529 (I) General I/O port settings-2
This section talks about external interrupts. Reading the introduction and understanding the program is the best way. External interrupts are the lowest priority interrupts of MSP430 and are maskable interrupts. They are relatively simple to use.   1.2.7 Simple port interrupts (external interrupts)                
[Microcontroller]
MSP430 porting printf and scanf
Hardware Introduction: The hardware part only needs character input and output devices: scanf reads characters from the input character device, and printf outputs to the character output device. Here, the character input device I chose is the hyperterminal, which is connected to the microcontroller through the serial
[Microcontroller]
MSP430 porting printf and scanf
Use of MSP430 MCU Watchdog
1. The watchdog has three working modes: stop mode, timer mode and watchdog mode. 2. The clock sources that can be selected in the latter two modes are: SMCLK and ACLK. 3. When using the last two modes, pay attention to whether the watchdog can work under the state of the MCU. For example, when the MCU is in LPM3,
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号