Skip to content

Instantly share code, notes, and snippets.

View krisfans's full-sized avatar

krisfans

  • 西安电子科技大学
View GitHub Profile
@krisfans
krisfans / adc01.c
Created April 8, 2022 11:27
20222-4-8-MSP430F5529单片机ADC测试代码
#include <msp430.h>
unsigned int voltage[4];
int main(void) {
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P6SEL = BIT1; // P6.1 ADC option select
// P1DIR |= BIT0; // P1.0 output
ADC12CTL0 = ADC12SHT02 + ADC12ON; // Sampling time, ADC12 on
ADC12CTL1 = ADC12SHP; // Use sampling timer