MSP430F449用段式液晶显示ASCII码
#include
# define uint unsigned int
# define uchar unsigned char
uchar time_buffer[3]={17,35,0};
uchar key_do=0;
uchar key_buffer=0;
uchar input_buffer[6]={0};
uchar input_con=0;
uchar time_sec01=0;
uchar lcdflash_temp=0;
uchar disp_buffer[6]={0};
uchar alr1[3]={06,30,00};
uchar alr2[3]={12,30,00};
uchar alr_flg=0;
uchar fun_con=2;
uchar adc_f = 0 ;
# define a 0x10
# define b 0x20
# define c 0x40
# define d 0x80
# define e 0x1
# define f 0x2
# define g 0x4
# define h 0x8
const char distab_asc[]=
{
a+e+f+d+c, f, e+c+f+h+d, 0, c+f+h, 0, c+f+h+d, f, //abcd
a+e+c+f+h,0, a+e+c+f, 0, a+e+h+c+d, f, e+c+f+d, f, //efgh
d, f, d+h, f, d, f+e+h, e+f+h,0, //ijkl
e+f+a+d, f+a+b+c, e+f+b, b+c+h, c+f+h+d, 0, a+e+f+c, f, //mnop
a+e+d+c, f+d, d, a+f+b+g+h,a+e+c+d+h, 0, a+d, a+f, //qrst
e+f+h+d, f, e+f+g, e, e+f+h+d, f+d+b+c, b+g, e+h, //uvwx
b+d, e, c+g+h, 0 //yz
};
const char distab_mi[]=
{
0x1b,0xf0,
0x80,0x2,
0x5a,0xb4,
0x58,0xf4,
0xc1,0x06,
0x59,0xd4,
0x5b,0xd4,
0x10,0x70,
0x5b,0xf4,
0x59,0xf4
};
////////////////////////////
// 160 lcd
////////////////////////////
const char distab[]=
{
0xaf,0x06,0x6d,0x4f,
0xc6,0xcb,0xeb,0x0e,
0xef,0xcf, 0xee,0xe3,
0x61,0x67,0xe9,0xe8
};
void delay(int x) // 5*x+12 nop
{ //128- 23 256-49
while(x--);
} //192- 36 280- 54 448- 87
void time_dis(void)
{
LCDMEM[0]= 0xFF;//distab[0];
LCDMEM[1]= distab[1];
LCDMEM[2]= distab[2];
LCDMEM[3]= distab[3];
LCDMEM[4]= distab[4];
LCDMEM[7]=0xa;
LCDMEM[8]=0x90;
//LCDMEM[9]=0x12;
//LCDMEM[10]=0x80;
LCDMEM[8]=distab_asc[0];
LCDMEM[9]=distab_asc[1];
LCDMEM[11]=0x2;
LCDMEM[12]=0x93;
LCDMEM[13]=0x72;
LCDMEM[14]=0x5b;
LCDMEM[15]=0x94;
}
void clrlcd(void)
{
uchar i=0;
for(i=0;i<20;i++)
LCDMEM[i]=0;
}
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
LCDCTL = 0XFD;
BTCTL = BTFRFQ1; // STK LCD freq
P5SEL = 0xFC; // Common and Rxx all selected
FLL_CTL0 |= XCAP14PF; // Configure load caps
TACTL = TASSEL0 + TACLR; // ACLK, clear TAR
CCTL0 = CCIE; // CCR0 interrupt enabled
CCR0 = 66;
P5DIR |= 0x02; // P5.1 output
TACTL |= MC1; // Start Timer_A in continuous mode
P1DIR = 0XFF ;
P6DIR = 0XFF ;
P6SEL = 0X01 ;
P6OUT = 0XFF ;
P2DIR=0xf0;
P2OUT=0X00;
P2IE=0X0f;
P2IES=0x0f;
P2IFG=0;
clrlcd();
time_dis();
for(;;)
{
//_BIS_SR(LPM3_bits); // CPU off
_NOP(); // Required only for C-spy
}
}
MSP430F449段式液晶ASCII 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)