LCD Interface code for pic16f877a

Thread Starter

karthi keyan 9

Joined Apr 17, 2018
30
For one thing, the RS needs to be stable 100nS before E is active. Is it?
Getting some chars to display ok, but not others, makes me thing you are driving the display too fast. They are pretty slow devices.
That is assuming your code is correct.
Still its is not working
 

Thread Starter

karthi keyan 9

Joined Apr 17, 2018
30
Try the code in the attached file.
Thank you AlbertHall this code is working fine. I just added delay after that it is working fine.

i want you ask another question

Here i want to display the decimal value in the display after basic conversion.

what modification is required to achieve this??
 

Thread Starter

karthi keyan 9

Joined Apr 17, 2018
30
i included conversion in the lcd code but it is displaying some wrong values,

output in display:
cap sensorw&π&π ---------Line 1
orororw&π&π ----------------Line 2

Actually i should get 100 in the dispaly

Code ;
C:
//#include<htc.h>
#include<pic.h>

#define RS RB5
#define EN RB4
#define D4 RB0
#define D5 RB1
#define D6 RB2
#define D7 RB3


#define _XTAL_FREQ 11059200
#include "lcd.h"

__CONFIG (0xFF02);

Lcd4_Clear();
char a=100;
void main()
{
int i,b,c1,c2,c3;
char s[]={'C','a','p',' ','S','e','n','s','o','r',0};
TRISB = 0x00;
Lcd4_Init();
Lcd4_Clear();

Lcd4_Set_Cursor(1,1);

Lcd4_Write_String(s);

for(i=0;i<255;i++);

while(a)
{
b=a/100;
//c1=a%100;
//c2=c1/10;
//c3=c1%10;
Lcd4_Cmd(0x80);
Lcd4_Set_Cursor(2,1);
Lcd4_Write_String(b+0x30);
Lcd4_Write_String(c2+0x30);
Lcd4_Write_String(c3+0x30);
//Lcd4_Port(b+0x30);
//Lcd4_Port(c2+0x30);
//Lcd4_Port(c3+0x30);
for(i=0;i<500;i++);
}

}
Mod edit: code tags
 
Last edited by a moderator:
Top