/********************************************************************
//DM430-L型最小系统板控制1602液晶模块显示测试程序
//直接将1602插入1602接口即可
//注意选择液晶的电源,位于电位器附近,可选5V或3.3V,根据液晶电压进行选择
//调试环境:EW430 V5.30
//作者:阿迪 www.avrgcc.com
//时间:2011.09.19
********************************************************************/
#include <msp430x14x.h>
#define CPU_F ((double)8000000)
#define delay_us(x) __delay_cycles((long)(CPU_F*(double)x/1000000.0))
#define delay_ms(x) __delay_cycles((long)(CPU_F*(double)x/1000.0))
#define uchar unsigned char
#define uint unsigned int
#define ulong unsigned long
// lcd1602
#define P55 5
#define P56 6
#define P57 7
#define RS_CLR P5OUT &= ~(1 << P55) //RS置低
#define RS_SET P5OUT |= (1 << P55) //RS置高
#define RW_CLR P5OUT &= ~(1 << P56) //RW置低
#define RW_SET P5OUT |= (1 << P56) //RW置高
#define EN_CLR P5OUT &= ~(1 << P57) //E置低
#define EN_SET P5OUT |= (1 << P57) //E置高
#define DataPort P4OUT //P4口为数据口
// adc12
#define DataDir P2DIR
// #define DataPort P2OUT
#define Busy 0x80
#define CtrlDir P6DIR
#define CLR_RS P6OUT&=~BIT3; //RS=P6.3
#define SET_RS P6OUT|=BIT3;
#define CLR_RW P6OUT&=~BIT4;//RW=P6.4
#define SET_RW P6OUT|=BIT4;
#define CLR_EN P6OUT&=~BIT5;//EN=P6.5
#define SET_EN P6OUT|=BIT5;
#define Num_of_Results 32
uchar shuzi[]={"0123456789."};
uchar tishi[]={"The volt is:"};
static uint results[Num_of_Results];//保存ADC转换结果的数组
static uint results1[Num_of_Results];//保存ADC转换结果的数组
static uint results2[Num_of_Results];//保存ADC转换结果的数组
static uint results3[Num_of_Results];//保存ADC转换结果的数组
void Trans_val(uint Hex_Val);
void Trans_val1(uint Hex_Val);