程序是
********************************************************************/
#include <msp430x16x.h>
#include "Config.h" //开发板配置头文件,主要配置IO端口信息
static int Sin_tab[100] = {1638,1740,1843,1944,2045,2143,2240,2335,2426,2515,2600,2681,2758,2831,2899,2962,3020,3072,3119,3160,3195,3224,3246,
3262,3272,3272,3263,3247,3224,31963161,3120,3074,3021,2964,2901,2833,2760,2683,2602,2517,2429,2337,2243,2146,2047,1947,1845,1743,1640,1537,
1435,1333,1233,1134,1037,943,851,762,677,596,519,446,378,314,256,204,157,116,81,52,29,13,3,0,2,12,28,50,78,113,154,200,252,310,373,440,513,590,
671,756,756,844,936,1030,1127,1225,1326,1427,1529,};
/********************************************************************
主程序
********************************************************************/
void main(void)
{
WDT_Init(); // 关闭看门狗
Clock_Init(); //时钟系统初始化,设置为外部时钟
P5SEL=0XFF;
ADC12CTL0 = REFON | REF2_5V ; // 参考电压为内部2.5v
DMA0SA = (int) Sin_tab; // 源地址寄存器
DMA0DA = DAC12_0DAT_; // 目的地址寄存器
DMA0SZ = 100; // 传输基本单元的个数
DMACTL0 = DMA0TSEL_5; // DAC12_0CTL的DAC12IFG标志
DMA0CTL = DMADT_4 + DMASRCINCR_3 + DMAEN; // DMADT_4:重复的块传输方式 Rpt, inc src, word-word
DAC12_0CTL = DAC12LSEL_2 + DAC12IR + DAC12AMP_5 + DAC12IFG + DAC12ENC; // Config
// **force first interrupt**
DAC12_0DAT = 0x0000; //DAC初值为0,更新这个寄存器就可以更改DAC输出数据
CCTL1 = OUTMOD_3; // Set/reset置位/复位模式,用于设定频率
CCR1 = 1; // PWM Duty Cycle
CCR0 = 8-1; // ~1kHz Clock period
TACTL = TASSEL_2 + MC_1; // SMCLK, up-mode
_BIS_SR(LPM0_bits); // Enter LPM0
}
输出波形为什么只有1500以上的值,1500以下就没有波形了,是哪里没有设置吗? |