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

write lcd display on myself 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







write lcd display on myself question !
PostPosted: Sat Jan 06, 2007 11:50 am     Reply with quote

hi!everybody!
one day . i am start rewrite a lcd diaplay 16*2 program.
and not use ccs DEMO Embarassed inclue lcd.c program.
but i find my diaplay driver ,dont ready display my set value or char word.
i had read the lcd display datasheets.and i use 4bit program command.
my lcd display datasheets id SDEC 16*2 (LMC-SSC2E16-01)
my written content follow as :

#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(0x01);
write_com(0x04);
write_com(0x0c);
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: Sat Jan 06, 2007 1:43 pm     Reply with quote

Study all the LCD drivers in the Code Library forum:
http://www.ccsinfo.com/forum/viewforum.php?f=2
Notice what they do. Look for differences between those
drivers and your code.

Or, just use one of the drivers in the Code Library.
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