如题,代码如下:
ADC12CTL0 = REF2_5V + REFON; // Internal 2.5V ref
DMACTL0 = DMA0TSEL_5 + DMA1TSEL_5; // DAC12IFG trigger
DMA0SA = (int) Sin_tab; // Source block address
DMA0DA = (unsigned int)&DAC12_0DAT; // Destination single address
DMA0SZ = 0x20; // Block size
DMA0CTL = DMADT_4 + DMASRCINCR_3 + DMAEN; // Rpt, inc src, word-word
DAC12_0CTL = DAC12LSEL_3 + DAC12IR + DAC12AMP_5 + DAC12IFG + DAC12ENC ;//+ DAC12GRP
TBCCTL2 = OUTMOD_2; // CCR2 set/reset
TBCCR2 = 10; // CCR2 PWM Duty Cycle
TBCCR0 = 250-1; // Clock period of CCR0
TBCTL = TBSSEL_2 + MC_1; // SMCLK, upmode
DMA1SA = (int) Sin_tab; // Source block address
DMA1DA = (unsigned int)&DAC12_1DAT; // Destination single address
DMA1SZ = 0x20; // Block size
DMA1CTL = DMADT_4 + DMASRCINCR_3 + DMAEN; // Rpt, inc src, word-word
DAC12_1CTL = DAC12LSEL_2 + DAC12IR + DAC12AMP_6 + DAC12IFG + DAC12ENC;
TACCTL1 = OUTMOD_3; // CCR1 set/reset
TACCR1 = 1; // CCR1 PWM Duty Cycle
TACCR0 = 25-1; // Clock period of CCR0
TACTL = TASSEL_2 + MC_1; // SMCLK, upmode
DAC0用的TB定时,产生1k的正弦波,DAC1用的TA定时,产生10的正弦波,可是在示波器看到的两个波形都是1k的,请各位大神看一下,代码问他在哪里!谢谢了!
此帖出自
小平头技术问答
一周热门 更多>