Ir ao conteúdo
  • Cadastre-se

Display JHD 162A não inicializa


André GRA

Posts recomendados

Fiz um programa em no MPLAB X usando o C18. Quando testo no Proteus ele comanda o LCD perfeitamente, mas quando monto o circuito o display fica com a linha de baixo toda preenchida e não faz mais nada, aparentemente meu programa nem inicializa o display.

esse é meu programa:


#include <string.h>
#include "lcd.h"
#include <xlcd.h>
#include <delays.h>
#pragma config OSC = XT //clock interno
#pragma config WDT = OFF //desliga watchdog
#pragma config LVP = OFF //desliga programação em baixa tensão
void lcd_texto(char *texto);
void main (void)
{

char dado [20];
int x;
char y;

lcd_inic();
TRISAbits.RA4=1;
TRISAbits.RA3=1;
TRISEbits.RE3=0;
PORTEbits.RE0=0;
y=17;
volta:
x=1;
lcd_locate(1,1);
strcpypgm2ram(dado,"Hospital Pasteur");
lcd_texto(dado);

/*************************************************************************
** **
** QUARTOS 1~10 **
** **
**************************************************************************/
if (PORTA==0B00000001)
{

/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
lcd_locate(2,1);
strcpypgm2ram(dado,"C101");
lcd_texto(dado);
Delay10KTCYx(50);


}

if(PORTA==0B00000010)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C102");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00000011)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C103");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00000100)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C104");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00000101)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C105");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00000110)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C106");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00000111)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C107");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00001000)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C108");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00001001)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C109");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00001010)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C110");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00001011)
{
/*lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P101");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00001100)
{
/* lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P102");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00001101)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P103");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00001110)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P104");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00001111)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P105");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00010000)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P106");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00010001)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P107");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00010010)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P108");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00010011)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P109");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00010100)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P110");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00010101)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E101");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00010110)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E102");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00010111)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E103");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B0001100)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E104");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00011001)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E105");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00011010)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E106");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00011011)
{
/* lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E107");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00011100)
{
/*lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E108");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00011101)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E109");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTA==0B00011110)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E110");
lcd_texto(dado);
Delay10KTCYx(50);
}

/*************************************************************************
** **
** QUARTOS 11~20 **
** **
**************************************************************************/
if(PORTB==0B00000001)
{

/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
lcd_locate(2,1);
strcpypgm2ram(dado,"C111");
lcd_texto(dado);
Delay10KTCYx(50);


}

if(PORTB==0B00000010)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C112");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTB==0B00000011)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C113");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00000100)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C114");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00000101)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C115");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00000110)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C116");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00000111)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C117");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00001000)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C118");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00001001)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C119");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00001010)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C120");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00001011)
{
/*lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P111");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00001100)
{
/* lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P112");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00001101)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P113");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00001110)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P114");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00001111)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P115");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00010000)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P116");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00010001)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P117");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00010010)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P118");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00010011)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P119");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00010100)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P120");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00010101)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E111");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00010110)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E112");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00010111)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E113");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00011000)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E114");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00011001)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E115");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00011010)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E116");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00011011)
{
/* lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E117");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00011100)
{
/*lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E118");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00011101)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E119");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTB==0B00011110)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E120");
lcd_texto(dado);
Delay10KTCYx(50);
}

/*************************************************************************
** **
** QUARTOS 21~30 **
** **
**************************************************************************/
if(PORTC==0B00000001)
{

/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
lcd_locate(2,1);
strcpypgm2ram(dado,"C121");
lcd_texto(dado);
Delay10KTCYx(50);


}

if(PORTC==0B00000010)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C122");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTC==0B00000011)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C123");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00000100)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C124");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00000101)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C125");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00000110)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C126");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00000111)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C127");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00001000)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C128");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00001001)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C129");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B000010110)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C130");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00001011)
{
/*lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P121");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00001100)
{
/* lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P122");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00001101)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P123");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00001110)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P124");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00001111)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P125");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00010000)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P126");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00010001)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P127");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00010010)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P128");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00010011)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P129");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00010100)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P130");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00010101)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E121");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00010110)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E122");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00010111)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E123");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00011000)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E124");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00011001)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E125");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00011010)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E126");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00011011)
{
/* lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E127");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00011100)
{
/*lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E128");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00011101)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E129");
lcd_texto(dado);
Delay10KTCYx(50);
}

if(PORTC==0B00011110)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E130");
lcd_texto(dado);
Delay10KTCYx(50);
}

/*************************************************************************
** **
** QUARTOS 31~40 **
** **
**************************************************************************/
if(PORTBbits.RB5==1 &&
PORTBbits.RB6==0 &&
PORTBbits.RB7==0 &&
PORTCbits.RC5==0 &&
PORTCbits.RC6==0)

{

/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
lcd_locate(2,1);
strcpypgm2ram(dado,"C131");
lcd_texto(dado);
Delay10KTCYx(50);


}

if(PORTBbits.RB5==0 &&
PORTBbits.RB6==1 &&
PORTBbits.RB7==0 &&
PORTCbits.RC5==0 &&
PORTCbits.RC6==0)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C132");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==1 &&
PORTBbits.RB6==1 &&
PORTBbits.RB7==0 &&
PORTCbits.RC5==0 &&
PORTCbits.RC6==0)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C133");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==0 &&
PORTBbits.RB6==0 &&
PORTBbits.RB7==1 &&
PORTCbits.RC5==0 &&
PORTCbits.RC6==0)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C134");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==1 &&
PORTBbits.RB6==0 &&
PORTBbits.RB7==1 &&
PORTCbits.RC5==0 &&
PORTCbits.RC6==0)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C135");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==0 &&
PORTBbits.RB6==1 &&
PORTBbits.RB7==1 &&
PORTCbits.RC5==0 &&
PORTCbits.RC6==0)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C136");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==1 &&
PORTBbits.RB6==1 &&
PORTBbits.RB7==1 &&
PORTCbits.RC5==0 &&
PORTCbits.RC6==0)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C137");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==0 &&
PORTBbits.RB6==0 &&
PORTBbits.RB7==0 &&
PORTCbits.RC5==1 &&
PORTCbits.RC6==0)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C138");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==1 &&
PORTBbits.RB6==0 &&
PORTBbits.RB7==0 &&
PORTCbits.RC5==1 &&
PORTCbits.RC6==0)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C139");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==0 &&
PORTBbits.RB6==1 &&
PORTBbits.RB7==0 &&
PORTCbits.RC5==1 &&
PORTCbits.RC6==0)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,1);
strcpypgm2ram(dado,"C140");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==1 &&
PORTBbits.RB6==1 &&
PORTBbits.RB7==0 &&
PORTCbits.RC5==1 &&
PORTCbits.RC6==0)
{
/*lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P131");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==0 &&
PORTBbits.RB6==0 &&
PORTBbits.RB7==1 &&
PORTCbits.RC5==1 &&
PORTCbits.RC6==0)
{
/* lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P132");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==1 &&
PORTBbits.RB6==0 &&
PORTBbits.RB7==1 &&
PORTCbits.RC5==1 &&
PORTCbits.RC6==0)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P133");
lcd_texto(dado);
Delay10KTCYx(50);
}

if( PORTBbits.RB5==0 &&
PORTBbits.RB6==1 &&
PORTBbits.RB7==1 &&
PORTCbits.RC5==1 &&
PORTCbits.RC6==0)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P134");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==1 &&
PORTBbits.RB6==1 &&
PORTBbits.RB7==1 &&
PORTCbits.RC5==1 &&
PORTCbits.RC6==0)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P135");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==0 &&
PORTBbits.RB6==0 &&
PORTBbits.RB7==0 &&
PORTCbits.RC5==0 &&
PORTCbits.RC6==1)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P136");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==1 &&
PORTBbits.RB6==0 &&
PORTBbits.RB7==0 &&
PORTCbits.RC5==0 &&
PORTCbits.RC6==1)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P137");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==0 &&
PORTBbits.RB6==1 &&
PORTBbits.RB7==0 &&
PORTCbits.RC5==0 &&
PORTCbits.RC6==1)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P138");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==1 &&
PORTBbits.RB6==1 &&
PORTBbits.RB7==0 &&
PORTCbits.RC5==0 &&
PORTCbits.RC6==1)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P139");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==0 &&
PORTBbits.RB6==0 &&
PORTBbits.RB7==1 &&
PORTCbits.RC5==0 &&
PORTCbits.RC6==1)
{
lcd_locate(2,6);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,6);
strcpypgm2ram(dado,"P140");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==1 &&
PORTBbits.RB6==0 &&
PORTBbits.RB7==1 &&
PORTCbits.RC5==0 &&
PORTCbits.RC6==1)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E131");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==0 &&
PORTBbits.RB6==1 &&
PORTBbits.RB7==1 &&
PORTCbits.RC5==0 &&
PORTCbits.RC6==1)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E132");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==1 &&
PORTBbits.RB6==1 &&
PORTBbits.RB7==1 &&
PORTCbits.RC5==0 &&
PORTCbits.RC6==1)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E133");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==0 &&
PORTBbits.RB6==0 &&
PORTBbits.RB7==0 &&
PORTCbits.RC5==1 &&
PORTCbits.RC6==1)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E134");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==1 &&
PORTBbits.RB6==0 &&
PORTBbits.RB7==0 &&
PORTCbits.RC5==1 &&
PORTCbits.RC6==1)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E135");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==0 &&
PORTBbits.RB6==1 &&
PORTBbits.RB7==0 &&
PORTCbits.RC5==1 &&
PORTCbits.RC6==1)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E136");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==1 &&
PORTBbits.RB6==1 &&
PORTBbits.RB7==0 &&
PORTCbits.RC5==1 &&
PORTCbits.RC6==1)
{
/* lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E137");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==0 &&
PORTBbits.RB6==0 &&
PORTBbits.RB7==1 &&
PORTCbits.RC5==1 &&
PORTCbits.RC6==1)
{
/*lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E138");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==1 &&
PORTBbits.RB6==0 &&
PORTBbits.RB7==1 &&
PORTCbits.RC5==1 &&
PORTCbits.RC6==1)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E139");
lcd_texto(dado);
Delay10KTCYx(50);
}

if (PORTBbits.RB5==0 &&
PORTBbits.RB6==1 &&
PORTBbits.RB7==1 &&
PORTCbits.RC5==1 &&
PORTCbits.RC6==1)
{
lcd_locate(2,11);
strcpypgm2ram(dado," ");
lcd_texto(dado);
/* y=y+1;
if (y==11)
{ Fazer a andar no display
y=1;
}*/
lcd_locate(2,11);
strcpypgm2ram(dado,"E140");
lcd_texto(dado);
Delay10KTCYx(50);
}


if(PORTA==0B00000000 && PORTB==0B00000000 && PORTC==0B00000000)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
y=y-1;
if (y==-14)
{ //Fazer a andar no display
y=17;
}
lcd_locate(2,y);
strcpypgm2ram(dado,"GRA MONITORACAO");
lcd_texto(dado);
PORTEbits.RE0=0;
Delay10KTCYx(50);
}

else
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
PORTEbits.RE0=1;
}

goto volta;

}

void lcd_texto(char *texto)
{
do
{
lcd_dado(*texto);
*texto++;
}while(*texto);
}
#include <p18f4620.h>            //Aqui é informado o processador que será utilizado pelo projeto

Link para o comentário
Compartilhar em outros sites

desculpe mas não tenho como Colocar a foto. Mas a situação é bem simples tenho um display JHD162A que não inicializa sua 1° linha fica toda preenchida (correção não era a 2° linha) e a segunda fica toda em branco. estou tentando um código só pra mostrar um simples frase em cada linha mas fico na mesma. segue o código:

#include <p18f4620.h>       //Aqui é informado o processador que será utilizado pelo projeto
#include <string.h>
#include "lcd.h"

#pragma config OSC = XT //Clock interno
#pragma config WDT = OFF //Desliga Watchdog
#pragma config LVP = OFF //Desliga programação em baixa tensão

void lcd_texto(char *texto);

void main(void)
{
char dado[20];

lcd_inic();

lcd_locate(1,1);
strcpypgm2ram(dado,"Cerne Tecnologia");
lcd_texto(dado);

lcd_locate(2,1);
strcpypgm2ram(dado,"cerne-tec.com.br");
lcd_texto(dado);

while(1);
}



void lcd_texto(char *texto)
{
do
{
lcd_dado(*texto);
*texto++;
}while(*texto);
}

#include <p18f4620.h> //Aqui é informado o processador que será utilizado pelo projeto
#include <delays.h>
#include "lcd.h"

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Rotina de Inicialização do LCD *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

void lcd_inic(void)
{
ADCON1=0b00001111;
TRISD= 0b00000000;
TRISE= 0b00000000;

lcd_cmd(0x30);
Delay1KTCYx(3);
lcd_cmd(0x30);
lcd_cmd(0x30);
lcd_cmd(0x38);
lcd_cmd(0x01);
Delay1KTCYx(1);
lcd_cmd(0x0C);
lcd_cmd(0x06);

}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Rotina de Envio de Comando para o LCD *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

void lcd_cmd(unsigned char dado)
{
PORTEbits.RE2=0; // Põe pino de RS em baixo, modo comando
PORTD=dado; // Põe o dado no portd
Delay1TCY(); // Aguarda 2 us, acomodação
PORTEbits.RE1=1; // Gera pulso de clock
Delay1TCY();
PORTEbits.RE1=0;
Delay1KTCYx(1);
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Rotina de Envio de Dados para o LCD *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

void lcd_dado(unsigned char dado)
{
PORTEbits.RE2=1; // Seta o pino RS, modo dado
PORTD=dado; // Põe o dado no portd
Delay1TCY(); // Aguarda 2us, acomodação
Delay1TCY();
PORTEbits.RE1=1; // Gera pulso de clock
Delay1TCY();
Delay1TCY();
PORTEbits.RE1=0;
Delay1KTCYx(1);
}


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Rotina de Envio de posição de curso para o LCD *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

void lcd_locate(char linha,char coluna)
{
coluna--;

if(linha==1)
linha=0x80 + coluna;
else
linha=0xC0 + coluna;

lcd_cmd(linha);
}

Link para o comentário
Compartilhar em outros sites

1 - Ja tentou ajustar o contraste do LCD?

2 - insira um led a piscar no seu circuito para ter a certeza que o pic está funcionando.

3 - tente iniciar o lcd da seguinte forma:


void lcd_inic(void)
{
ADCON1=0b00001111;
TRISD= 0b00000000;
TRISE= 0b00000000;

lcd_cmd(0x38);
lcd_cmd(0x0C);
lcd_cmd(0x06);
lcd_cmd(0x01);
Delay1KTCYx(1);

Link para o comentário
Compartilhar em outros sites

Muito obrigado Moley!!!! era o clock mesmo, troquei para

#pragma config OSC = INTIO67 //Clock interno

e o display inicializou!! Meu problema agora é que ele está mostrando caracteres que não são os que deveriam.

Isso ocorre sempre? São todos os caracteres? Poderia digitar os caracteres que aparecem?

Link para o comentário
Compartilhar em outros sites

  • 3 semanas depois...

Projetos_afg Obrigado pelo interesse mas ja resolvi o problema dos caracteres, no entanto parece que ainda estou longe de me livrar deles, estão acontecendo coisas estranhas, e eu preciso tabem de uma logica "menos burra" pro meu programa.

o que eu estou vendo de estranho é que no meu programa eu fiz com que uma frase ficasse passado na segunda linha do display, funciona normal do proteus, mas no lcd a frase em vez de rodar continuamente roda ate certa parte fica um tempo parada e depois da um salto para onde deveria estar...

esta parte esta dessa forma:

if(PORTA==0B00000000 && PORTB==0B00000000 && PORTC==0B00000000)
{
lcd_locate(2,1);
strcpypgm2ram(dado," ");
lcd_texto(dado);
y=y-1;
if (y==-14)
{ //Fazer a andar no display
y=17;
}
lcd_locate(2,y);
strcpypgm2ram(dado,"GRA MONITORACAO");
lcd_texto(dado);
PORTEbits.RE0=0;
Delay10KTCYx(25);
}

acontece tambem que essa linha as vezes some e fica um tempão sem aparecer, parece que fica lerdo, não sei.

Link para o comentário
Compartilhar em outros sites

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...