1-简介
简介MSP430单片机ADC12模块 序列单次采集的 应用范例。
2-例程
//******************************************************************************
//MSP430F149 ADC12模块+串行通讯的实验程序
//使用ADC12采集实验,将采集到数据送向PC.(序列单次采集)
//P3.4为发送,P3.5为接收 晶体使32768HZ/8MHZ. 串行波特率B/S
//使用SMCLK作为波特率发器时,不能使用LPM2,LPM3!
//以下程序已验证通过,初学者可直接使用.由时间仓促和水平有限,请读者批评指正.
//编写:www.Microcontrol.cn/DC
//******************************************************************************
#include <msp430x14x.h>
#define ADCOK 0x01 //B0为ADC12完成转换标志.
//********************************************
//表区
unsigned char number_table[]={'0','1','2','3','4','5','6','7','8','9'};
unsigned char display_buffer[]={0x00,0x00,0x00,0x00,0xff};
//*******************波特率***********300 600 1200 2400 4800 9600 19200 38400 76800 115200const
//************************************[0]**[1]**[2]*[3]**[4]**[5]***[6]***[7]****[8]***[9]*
unsigned char BaudrateUBR0[] ={0x6D,0x36,0x1B,0x0D,0x06,0x03, 0xA0, 0xD0, 0x68, 0x45};
unsigned const char BaudrateUBR1[] ={0x00,0x00,0x00,0x00,0x00,0x00, 0x01, 0x00, 0x00, 0x00};
unsigned const char BaudrateUMCTL[]={0x22,0xD5,0x03,0x6B,0x6F,0x4A, 0xC0, 0x40, 0x40, 0x4A};
unsigned char timp;
//变量区
unsigned int ADC0 ;
//子程序声明
void init (void); //初始化
void ADC12setup(void); //ADC12初始化
void BaudrateSetup(unsigned char U0); //UA