#include<msp430x14x.h>
#include"5110.h"
#include"function.h"
#include"BoardConfig.h"
#define keyin (P1IN & 0x0f)
char key_sig[] = {0x31,0x32,0x33,0x2b,0x34,0x35,0x36,0x2d,
0x37,0x38,0x39,0x2a,0x2e,0x30,0x3d,0x2f};
unsigned char keyval;
unsigned char m = 0,m1 = 0,m2 = 0;
void main()
{
BoardConfig(0xb8);
WDTCTL = WDTPW + WDTHOLD;
P1IE = 0x0f;
P1IES = 0x0f;
P1IFG = 0;
P1DIR = 0xf0;
P1OUT = 0xff;
P6DIR = 0x7f;
P2DIR = BIT0;
P2OUT &= ~BIT0;
// UART();
init_LCD();
_EINT();
while(1)
{
LPM1;
display_English_String(m1,m2,(key_sig+m));
}
}
#pragma vector = PORT1_VECTOR
__interrupt void port1(void)
{
P2OUT ^= BIT0;
display_English_String(0,4,"L");
if(P1IFG & 0x0f)
{
switch(P1IFG)
{
case 0x01:
switch(keyin)
{
case 0x0e:
if(keyin == 0x0e)
{
delay(12000);
if(keyin == 0x0e)
{
while(keyin != 0x0f);
keyval = 0;
LPM1_EXIT;
P1IFG = 0;
}
}break;
case 0x0d:
if(keyin == 0x0d)
{
delay(12000);
if(keyin == 0x0d)
{
while(keyin != 0x0f);
keyval = 5;
LPM1_EXIT;
P1IFG = 0;
}
}break;
case 0x0b:
if(keyin == 0x0b)
{
delay(12000);
if(keyin == 0x0b)
{
while(keyin != 0x0f);
keyval = 9;
LPM1_EXIT;
P1IFG = 0;
}
}break;
case 0x07:
if(keyin == 0x07)
{
delay(12000);
if(keyin == 0x07)
{
while(keyin != 0x0f);
keyval = 13;
LPM1_EXIT;
P1IFG = 0;
}
}break;
}break;
case 0x02:
switch(keyin)
{
case 0x0e:
if(keyin == 0x0e)
{
delay(12000);
if(keyin == 0x0e)
{
while(keyin != 0x0f);
keyval = 2;
LPM1_EXIT;
P1IFG = 0;
}
}break;
case 0x0d:
if(keyin == 0x0d)
{
delay(12000);
if(keyin == 0x0d)
{
while(keyin != 0x0f);
keyval = 6;
LPM1_EXIT;
P1IFG = 0;
}
}break;
case 0x0b:
if(keyin == 0x0b)
{
delay(12000);
if(keyin == 0x0b)
{
while(keyin != 0x0f);
keyval = 10;
LPM1_EXIT;
P1IFG = 0;
}
}break;
case 0x07:
if(keyin == 0x07)
{
delay(12000);
if(keyin == 0x07)
{
while(keyin != 0x0f);
keyval = 14;
LPM1_EXIT;
P1IFG = 0;
}
}break;
}break;
case 0x40:
switch(keyin)
{
case 0x0e:
if(keyin == 0x0e)
{
delay(12000);
if(keyin == 0x0e)
{
while(keyin != 0x0f);
keyval = 3;
LPM1_EXIT;
P1IFG = 0;
}
}break;
case 0x0d:
if(keyin == 0x0d)
{
delay(12000);
if(keyin == 0x0d)
{
while(keyin != 0x0f);
keyval = 7;
LPM1_EXIT;
P1IFG = 0;
}
}break;
case 0x0b:
if(keyin == 0x0b)
{
delay(12000);
if(keyin == 0x0b)
{
while(keyin != 0x0f);
keyval = 11;
LPM1_EXIT;
P1IFG = 0;
}
}break;
case 0x07:
if(keyin == 0x07)
{
delay(12000);
if(keyin == 0x07)
{
while(keyin != 0x0f);
keyval = 15;
LPM1_EXIT;
P1IFG = 0;
}
}break;
}break;
case 0x08:
switch(keyin)
{
case 0x0e:
if(keyin == 0x0e)
{
delay(12000);
if(keyin == 0x0e)
{
while(keyin != 0x0f);
keyval = 4;
LPM1_EXIT;
P1IFG = 0;
}
}break;
case 0x0d:
if(keyin == 0x0d)
{
delay(12000);
if(keyin == 0x0d)
{
while(keyin != 0x0f);
keyval = 8;
LPM1_EXIT;
P1IFG = 0;
}
}break;
case 0x0b:
if(keyin == 0x0b)
{
delay(12000);
if(keyin == 0x0b)
{
while(keyin != 0x0f);
keyval = 12;
LPM1_EXIT;
P1IFG = 0;
}
}break;
case 0x07:
if(keyin == 0x07)
{
delay(12000);
if(keyin == 0x07)
{
while(keyin != 0x0f);
keyval = 16;
LPM1_EXIT;
P1IFG = 0;
}
}break;
}break;
}
m1++;if(m1 > 83)m1 = 0;
m2++;if(m2 > 5) m2 = 0;
m++;if(m > 16) m = 0;
}
}
此帖出自
小平头技术问答
一周热门 更多>