View previous topic :: View next topic |
Author |
Message |
applecon2000
Joined: 29 Jul 2007 Posts: 31 Location: UK
|
Ask for help |
Posted: Sun Jul 29, 2007 6:13 pm |
|
|
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
|
|
Posted: Tue Jul 31, 2007 1:22 pm |
|
|
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
|
thanks |
Posted: Tue Jul 31, 2007 7:05 pm |
|
|
the link for explaination was absolutely clear.
thank you very much, wish to make friend with you.
[email protected] 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
|
|
Posted: Tue Jul 31, 2007 7:22 pm |
|
|
No, I only talk on the CCS forum. Sorry. |
|
|
applecon2000
Joined: 29 Jul 2007 Posts: 31 Location: UK
|
help |
Posted: Fri Aug 03, 2007 5:30 pm |
|
|
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 |
Posted: Wed Aug 08, 2007 7:19 am |
|
|
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
|
reply |
Posted: Wed Aug 08, 2007 8:06 am |
|
|
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 |
|
|
|