InicioCiencia EducacionTeclado matricial, pantalla LCD y PIC16F4550
Sistemaque envíe el valor impreso en cada una de las teclas de un teclado matricial auna pantalla de cristal líquido, utilizando un PIC16F4550.



He aqui el codigo completo, pueden copiarlo e un .c , si no funciona soo creen un nuevo proyecto desde PICC.



#include <18F4550.h>
#device adc=8
 
#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOBROWNOUT               //No brownout reset
#FUSES BORV20                   //Brownout reset at 2.0V
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOCPD                    //No EE protection
#FUSES STVREN                   //Stack full/underflow will cause reset
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT                    //Program memory not write protected
#FUSES NOWRTD                   //Data EEPROM not write protected
#FUSES IESO                     //Internal External Switch Over mode enabled
#FUSES FCMEN                    //Fail-safe clock monitor enabled
#FUSES PBADEN                   //PORTB pins are configured as analog input channels on RESET
#FUSES NOWRTC                   //configuration not registers write protected
#FUSES NOWRTB                   //Boot block not write protected
#FUSES NOEBTR                   //Memory not protected from table reads
#FUSES NOEBTRB                  //Boot block not protected from table reads
#FUSES NOCPB                    //No Boot Block code protection
#FUSES MCLR                     //Master Clear pin enabled
#FUSES LPT1OSC                  //Timer1 configured for low-power operation
#FUSES NOXINST                  //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES PLL12                    //Divide By 12(48MHz oscillator input)
#FUSES CPUDIV4                  //System Clock by 4
#FUSES USBDIV                   //USB clock source comes from PLL divide by 2
#FUSES VREGEN                   //USB voltage regulator enabled
#FUSES ICPRT                    //ICPRT enabled
 
#use delay(clock=20000000)
#include <lcd.c>
 
int secuencia=0x01,aux,a,boton,valor=0;
 
int tecla(){
  if(secuencia==0x08)
   secuencia=0x01;
  else
   secuencia=secuencia*2;
   output_B(secuencia);
   delay_us(100);   //retardo del bit de corrimiento
   aux=secuencia;
    if(input(pin_B4))
      aux=aux+0x10;
    else if(input(pin_B5))
      aux=aux+0x20;
    else if(input(pin_B6))
      aux=aux+0x40;
//    else if(input(pin_B7)) //Para un Teclado de 4x4
//      aux=aux+0x80;
      if(aux==secuencia)
         return 0;
      else
         return aux;
}
 
char numero(a){
  switch(a){
   case 0x11:boton='1';break;
   case 0x21:boton='2';break;
   case 0x41:boton='3';break;
   case 0x12:boton='4';break;
   case 0x22:boton='5';break;
   case 0x42:boton='6';break;
   case 0x14:boton='7';break;
   case 0x24:boton='8';break;
   case 0x44:boton='9';break;
   case 0x18:boton='*';break;
   case 0x28:boton='0';break;
   case 0x48:boton='#';break;
   default:boton=' ';break;
   }
   return boton;
}
 
void main(){
   lcd_init();
   lcd_gotoxy(1,1);printf(lcd_putc,"fTecla presionada:";
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(FALSE);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_oscillator(False);
 
   
   while(TRUE){
 
    valor=tecla();
    numero(valor);
 
      if(valor!=0){
     
        while(tecla()!=0)
        {
        // antirrebotes
        }
        lcd_gotoxy(2,2);printf(lcd_putc,"      %c",boton);
     }
   }
}




He aqui el circuito




















Agradesco tus comentarios, puntos y aportaciones !!!!
Datos archivados del Taringa! original
12puntos
987visitas
0comentarios
Actividad nueva en Posteamelo
0puntos
2visitas
0comentarios
Dar puntos:

Dejá tu comentario

0/2000

Autor del Post

t
tonatin3991🇦🇷
Usuario
Puntos0
Posts6
Ver perfil →
PosteameloArchivo Histórico de Taringa! (2004-2017). Preservando la inteligencia colectiva de la internet hispanohablante.

CONTACTO

18 de Septiembre 455, Casilla 52

Chillán, Región de Ñuble, Chile

Solo correo postal

© 2026 Posteamelo.com. No afiliado con Taringa! ni sus sucesores.

Contenido preservado con fines históricos y culturales.