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 CCS Technical Support

LCD problem in PIC18F452

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



Joined: 29 Oct 2012
Posts: 2

View user's profile Send private message

LCD problem in PIC18F452
PostPosted: Mon Oct 29, 2012 11:55 am     Reply with quote

Hello,
I want to connect LCD 2*16 but microcontroller PIC18F452 does not work.
The codes are
Code:

#include <18F452.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=16000000)

#include <lcd.c>

#define LCD_ENABLE_PIN  PIN_C0                                   
#define LCD_RS_PIN      PIN_C1                                   
#define LCD_RW_PIN      1                                 
#define LCD_DATA4       PIN_D4                                   
#define LCD_DATA5       PIN_D5                                   
#define LCD_DATA6       PIN_D6                                   
#define LCD_DATA7       PIN_D7             

void main()
{
lcd_init();  // Always call this first.

lcd_putc("\fHello World\n");
lcd_putc("Line Number 2");

 do{
   output_high(PIN_B2);
   Delay_ms(1000);
   output_low(PIN_B2);
   Delay_ms(1000);
 }while(1);

}

Hardware is correct because it is ok with MikroC Pro. When I erase the codes that related to lcd, led works good (pin B2 is connected to led).
What is problem?
Thanks a lot
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Mon Oct 29, 2012 12:15 pm     Reply with quote

Hint.
How is lcd.c, going to know about your pin definitions?....

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 29, 2012 2:23 pm     Reply with quote

See this thread for more information about how to use the CCS lcd driver:
http://www.ccsinfo.com/forum/viewtopic.php?t=47663
Note that a pin constant must be specifed for LCD_RW_PIN. This is
shown in the link above. (Don't use #define LCD_RW_PIN 1 ).

Also, it appears that you are trying to mix the CCS lcd.c driver with the
example code for the Flex lcd driver (in the Code library forum).
You can do that, and it will work. But just remember that these are
two separate lcd drivers. The CCS driver is called lcd.c and the flex
driver is called flex_lcd.c.

The CCS lcd.c driver is in this directory. I assume your program uses
this driver:
c:\program files\picc\drivers\lcd.c

The Flex lcd driver is at this link:
http://www.ccsinfo.com/forum/viewtopic.php?t=24661

They are different drivers and require different #define statements for
the pins.
aryio



Joined: 29 Oct 2012
Posts: 2

View user's profile Send private message

PostPosted: Tue Oct 30, 2012 1:32 am     Reply with quote

thanks for your kind support.

yes my problem was RW pin of LCD i had tied it to ground but again i connected it to micro and it is ok.

i think for understanding about this problem i should look at lcd.c section of RW of the LCD.

thanks
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