P Teclado
P Teclado
h>
#include "derivative.h"
void main(void) {
SOPT1=0x12;
MCUinit();
KBIinit();
EnableInterrupts;
init_LCD();
for(;;) {
}
}
void enable(void){
E=1;
retardoRTI();
E=0;
}
void init_LCD(void){
unsigned char i=0;
unsigned char tabla[7]={0x33, 0x32, 0x28, 0x0F, 0x06, 0x01, 0x00};
while(i!=7){
comando(tabla[i]);
i++;
}
}
//FILA 1
while(filas == 0x0E){
PTBD = 0xE0;
if(PTBD == 0xEE){
dato('1');
while(PTBD == 0x0E){}
filas =0x00;
}
PTBD = 0xD0;
if(PTBD == 0xDE){
dato('2');
while(PTBD == 0x0E){}
filas =0x00;
}
PTBD = 0xB0;
if(PTBD == 0xBE){
dato('3');
while(PTBD == 0x0E){}
filas =0x00;
}
PTBD = 0x70;
if(PTBD == 0x7E){
dato('A');
while(PTBD == 0x0E){}
filas =0x00;
}
//FILA 2
while(filas == 0x0D){
PTBD = 0xE0;
if(PTBD == 0xED){
dato('4');
while(PTBD == 0x0D){}
filas =0x00;
}
PTBD = 0xD0;
if(PTBD == 0xDD){
dato('5');
while(PTBD == 0x0D){}
filas =0x00;
}
PTBD = 0xB0;
if(PTBD == 0xBD){
dato('6');
while(PTBD == 0x0D){}
filas =0x00;
}
PTBD = 0x70;
if(PTBD == 0x7D){
dato('B');
while(PTBD == 0x0D){}
filas =0x00;
}
}
//FILA 3
while(filas == 0x0B){
PTBD = 0xE0;
if(PTBD == 0xEB){
dato('7');
while(PTBD == 0x0B){}
filas =0x00;
}
PTBD = 0xD0;
if(PTBD == 0xDB){
dato('8');
while(PTBD == 0x0B){}
filas =0x00;
}
PTBD = 0xB0;
if(PTBD == 0xBB){
dato('9');
while(PTBD == 0x0B){}
filas =0x00;
}
PTBD = 0x70;
if(PTBD == 0x7B){
dato('C');
while(PTBD == 0x0B){}
filas =0x00;
}
//FILA 4
while(filas == 0x07){
PTBD = 0xE0;
if(PTBD == 0xE7){
dato('*');
while(PTBD == 0x07){}
filas =0x00;
}
PTBD = 0xD0;
if(PTBD == 0xD7){
dato('0');
while(PTBD == 0x07){}
filas =0x00;
}
PTBD = 0xB0;
if(PTBD == 0xB7){
dato('#');
while(PTBD == 0x07){}
filas =0x00;
}
PTBD = 0x70;
if(PTBD == 0x77){
dato('D');
while(PTBD == 0x07){}
filas =0x00;
}
PTBD=0x00;
EnableInterrupts;
}