CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

LCD DISLPLAY QUESTION

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
WHUNG.JOHN
Guest







LCD DISLPLAY QUESTION
PostPosted: Sat Jan 27, 2007 10:47 am     Reply with quote

TODAY .
I WRITTEN A SAMPLE LCD DISPLAY PROGRAM.AND NOT USE LCD.C (LIBRARY PROGRAM).
I used lcd.c library program .display any value correct.
but i tried written lcd display,and writted into pic16f877 chip.
the lcd dont display any vlaue.
my writted program. follow as .
i dont find error.please help me again.


#include <16F877.h>
#use delay(clock=10000000)
#fuses NOWDT,HS

void del (void)
{
int j;
for (j=0;j<20;j++);
}


void en1(void)
{
output_high(pin_d0);
del();
output_low(pin_d0);
del();
}

void write_com(unsigned char C)
{
output_d(C);
output_LOW(pin_d1); en1();C<<=4;
output_d(C);output_LOW(pin_d1);en1();
}

void init_lcd1(void)
{
output_d(0x30); en1();
output_d(0x30); en1();
output_d(0x30); en1();
output_d(0x20); en1();
write_com(0x28);
write_com(0x08);
write_com(0x01);
write_com(0x0c);
//write_com(0x0F);
delay_ms(100);




}

void write_data(unsigned char C)
{
output_d(C);
output_high(pin_d1); en1();C<<=4;
output_d(C);output_high(pin_d1);en1();
}

void pr(char x,char *y)
{
int i;
if (x==1)
{
write_com(0x80);
for(i=0;i<16;i++) write_data(' ');
write_com(0x80);}
else
{write_com(0xc0);
for (i=0;i<16;i++) write_data(' ');
write_com(0xc0);}

do {write_data(*y++);}
while(*y!='\0');
}

pr1(char t,char w)
{
write_com(0x80+t);
write_data(w);
}


void main()
{
char p[]="1234";
char k[]="5678";
output_low(pin_d0);
delay_ms(100);
init_lcd1();
pr(2,p);
pr1(5,k);

while(1)
{

}

}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jan 28, 2007 4:01 pm     Reply with quote

Quote:
the lcd dont display any value.
my writted program. follow as .
i dont find error.please help me again.

When you're a beginner, use an LCD driver that's already known to work:
http://www.ccsinfo.com/forum/viewtopic.php?t=24661


Quote:
#include <16F877.h>
#use delay(clock=10000000)
#fuses NOWDT,HS

Also, use the NOLVP fuse. The default state in your #fuses statement
is the same as if you had the LVP fuse enabled. That's why it's
important to specify NOLVP.

A small number of people use a "low voltage programmer" that they
built by themselves. These people will use the LVP fuse.
Everyone else (about 99% of PIC users) should use the NOLVP fuse.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group