📄 msp430dayii_dac12_01.c
字号:
//*******************************************************************************
// MSP-430-Day II Demo - DAC12.0 Output 1V
//
// Description; Using DAC12.0 and 2.5V ADC12REF reference with a gain of 1,
// output 1V on A8 (VERef+). Ouput accuracy is specified by that of the ADC12REF.
// ACLK = 32768, MCLK = SMCLK = default DCO = 1048576, ADC12CLK = ADC12OSC
// //*An external watch crystal on XIN XOUT is required for ACLK*//
// //*MSP430FG439 Device Required*//
//
// MSP430FG439
// -----------------
// /|\| XIN|-
// | | | 32KHz
// --|RST XOUT|-
// | |
// | DAC0 (VERef+)|--> 1V
// | |
//
// M.Buccini
// Texas Instruments, Inc
// February 2004
// Updated for IAR Embedded Workbench Version: 2.21B
//******************************************************************************
#include <msp430xG43x.h>
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
FLL_CTL0 |= XCAP14PF; // Set load capacitance
ADC12CTL0 = REF2_5V + REFON; // Internal 2.5V ref on
DAC12_0CTL = DAC12OPS + DAC12IR + DAC12AMP_5 + DAC12ENC; // VERef+, Int ref gain 1
DAC12_0DAT = 0x0666; // 1V
_BIS_SR(LPM0_bits + GIE); // Enter LPM0 w/ interrupt
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -