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

Ask for help on LCD driver

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
applecon2000



Joined: 29 Jul 2007
Posts: 31
Location: UK

View user's profile Send private message Send e-mail MSN Messenger

Ask for help
PostPosted: Sun Jul 29, 2007 6:13 pm     Reply with quote

Dear all.
This is WenJun Xia who is doing my project which was serial interface within LCD module.
During the PIC C language compiling I have one question about LCD.C:
Can any friend explain the meaning of following code for me:
''BYTE const LCD_INIT_STRING[4] = {0x20 | (lcd_type << 2), 0xc, 1, 6};
// These bytes need to be sent to the LCD
// to start it up.''

And now I will compile my own code with this driver together in MPLAB 7.60, so another question is where should I put this driver in, in the source file or other file, but header file.
I have already read the 16x2 LCD module working principle and CCS C help file and still can not understand the code shown above, please give tell me the means of "start it up" in the code explaination in detail.
I do thank you for your help.
_________________
Enjoy our EEE
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jul 31, 2007 1:22 pm     Reply with quote

Quote:

Can any friend explain the meaning of following code for me:
BYTE const LCD_INIT_STRING[4] = {0x20 | (lcd_type << 2), 0xc, 1, 6};

Look in the code listing for the "Flex" driver here:
http://www.ccsinfo.com/forum/viewtopic.php?t=24661
It has a short comment on each of those initialization bytes.


Quote:

another question is where should I put this driver in, in the source file or other file, but header file.

Use an #include statement to include it in the main source file.
Example:
Code:
#include <18F452.H>
#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 20000000)
//#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

#include "flex_lcd.c"
   
//==========================
void main()
{
lcd_init();

printf(lcd_putc, "\fHello World\nLine 2");

while(1);



Quote:
please give tell me the means of "start it up" in the code explaination in detail.

The LCD requires a special sequence of command bytes to initialize it,
before it can be used to display characters in your program. The
lcd_init() function sends the special initialization commands to the LCD.
applecon2000



Joined: 29 Jul 2007
Posts: 31
Location: UK

View user's profile Send private message Send e-mail MSN Messenger

thanks
PostPosted: Tue Jul 31, 2007 7:05 pm     Reply with quote

the link for explaination was absolutely clear.
thank you very much, wish to make friend with you.
applecon2000@hotmail.com is my MSN account and also be my private e-mail address. Hope to chat with you.
_________________
Enjoy our EEE
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jul 31, 2007 7:22 pm     Reply with quote

No, I only talk on the CCS forum. Sorry.
applecon2000



Joined: 29 Jul 2007
Posts: 31
Location: UK

View user's profile Send private message Send e-mail MSN Messenger

help
PostPosted: Fri Aug 03, 2007 5:30 pm     Reply with quote

Dear all,
For my dissertation, I need journal paper about LCD module with serial communication interface which means transmitting serial data in SPI, RS232 and I2C modes.
If someone among you know the link of those journal papers please upload them here.
For my research, i just used lots of datasheet and CCS website for all information retriving. That's why I need your helps right now.
Thanks million for your helps.
_________________
Enjoy our EEE
Tuga
Guest







error in mplab
PostPosted: Wed Aug 08, 2007 7:19 am     Reply with quote

Dear all,

I am using mplab and my compiler ccs indicates an error in the following line:
int8 const LCD_INIT_STRING[4] =
{
0x20 | (lcd_type << 2), // Func set: 4-bit, 2 lines, 5x8 dots
0xc, // Display on
1, // Clear display
6 // Increment cursor
};

the message error is:
*** Error 128 "C:\Users\Carlos\Documents\Escola\ProjII\PIC\exp\flex_lcd.c" Line 28(1,42): A #DEVICE required before this line

How I can decide this problem?

Thanks
applecon2000



Joined: 29 Jul 2007
Posts: 31
Location: UK

View user's profile Send private message Send e-mail MSN Messenger

reply
PostPosted: Wed Aug 08, 2007 8:06 am     Reply with quote

Delete #include <xxxxx.h>in you main code if you have already written that in your LCD.c file.
Because compiler can not compile same header file existing in both source file.
if your LCD.c file has already included header file, you can not write #device xxxxxx in it , cause the header file has contained #device
_________________
Enjoy our EEE
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