【文件属性】:
文件名称:msp 430 五线键盘 led显示
文件大小:3KB
文件格式:C
更新时间:2012-09-11 04:37:10
msp 430 五线键盘 led显示
msp 430 五线键盘 led显示
include
#define uint unsigned int
#define uchar unsigned char
void xianshi(uint temp);
uchar keyboard();
void delay(uint z);
//数码管7位段码:0--f
uchar table[16] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
//记录显示位数的全局变量
uchar cnt = 0;
uint temp=0;
/********************主函数********************/
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; //关闭看门狗
//P2SEL = 0x00;
P2DIR = 0xff;
P2OUT = 0x07;
P2DIR = 0xe7;
P2IES = 0xe7;
P2IFG = 0x00;
P2IE = 0x18;
P3DIR = 0xff; //设置P4,P5的IO方向为输出
P4DIR = 0xff;
P4OUT = 0x00; //设置P4,P5的输出初值
P3OUT = 0xff;
_EINT();
while(1)
{
xianshi(temp);
}
}
void xianshi(uint temp)
{ uchar bai1,shi1,ge1,bai2,shi2,ge2;
uint a1,b1;
a1=temp/1000;