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

writing to 16x2 LCD with pic18f2520

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



Joined: 27 Jul 2007
Posts: 33

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

writing to 16x2 LCD with pic18f2520
PostPosted: Fri Jul 27, 2007 8:16 am     Reply with quote

Hello

i have been unable to write'hello' to the hd44780 compatible 16x2 LCD over 4 bit by using pic18f2520. The pin configuration is like this:

portb LCD

RB7-------DB7
RB6-------DB6
RB5-------DB5
RB4-------DB4

RB3-------E
RB2-------RS

r/w pin is grounded.

RB0 VE RB1 have been used as output for another aim.
is there anybody who can give me an idea?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 27, 2007 11:54 am     Reply with quote

Read this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=27618
pokiko



Joined: 27 Jul 2007
Posts: 33

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

PostPosted: Mon Jul 30, 2007 2:32 am     Reply with quote

Thank you for your help. I am new in CCS. I have made these following changes but i have been unable to write to LCD.

Code:

#define LCD_DB4   PIN_B4
#define LCD_DB5   PIN_B5
#define LCD_DB6   PIN_B6
#define LCD_DB7   PIN_B7

#define LCD_E     PIN_B3
#define LCD_RS    PIN_B2
//#define LCD_RW    PIN_A2

// If you only want a 6-pin interface to your LCD, then
// connect the R/W pin on the LCD to ground, and comment
// out the following line.

//#define USE_LCD_RW   1 


My code is here;

Code:

#include <18F2520.h>
#FUSES NOWDT,INTRC_IO, NOPROTECT, NOBROWNOUT,NOPUT,NOLVP
#use delay(clock=20000000)
#define use_portb_lcd 1
#include "flex_LCD.c"
#use fast_io (B)

void main()
{

 lcd_init();

printf(lcd_putc, "\f");
printf(lcd_putc, "Hello World! :)");

while(1);

}


could you tell me please where i am wrong? Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jul 30, 2007 2:42 am     Reply with quote

Quote:
#include <18F2520.h>
#FUSES NOWDT,INTRC_IO, NOPROTECT, NOBROWNOUT,NOPUT,NOLVP
#use delay(clock=20000000)
#define use_portb_lcd 1
#include "flex_LCD.c"
#use fast_io (B)


1. The internal oscillator without the PLL (INTRC_IO fuse) can run at
8 MHz maximum. You have to specify the #use delay() value that is
the same speed as the oscillator is running. Change it to this:
Code:
#use delay(clock=8000000)


2. The "Flex" driver doesn't use the "use_portb_lcd" constant.
Delete that line.

3. The "Flex" driver doesn't work with "fast_io" mode. Delete that line.
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