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

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



Joined: 26 Jul 2009
Posts: 31

View user's profile Send private message

LCD problem
PostPosted: Sun Nov 29, 2009 10:35 am     Reply with quote

I am using a 20x4 lcd, it works fine with PIC16F877A with the below program

But not with PIC18F4520 and PIC18F4550

Code:
#include<18F4520.h> //#include<18F4550.h>

#fuses HS,NOLVP,NOWDT
#use delay(clock=20M)
 
#include<LCD420.C >

 

void main()


lcd_init();
delay_ms(100);
output_high(pin_b3);

printf(lcd_putc,"test");

while(true);
}



I tested the above program with PIC18F2550 PIC18F4520 with the same PIC16F877a arrangement.

Anyone know the reason..
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 12:26 pm     Reply with quote

1. Post a list of the pin connections between the PIC and the LCD.

2. Post your compiler version.

3. Are you doing this testing in Proteus ?
anandpv2009



Joined: 26 Jul 2009
Posts: 31

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 12:43 pm     Reply with quote

B0 enable
B1 rs
B2 rw
B3 I am using this pin to turn on/off back light (through transistor)
B4 D4
B5 D5
B6 D6
B7 D7

16th pin of LCD - vdd
15th PIC of LCD - vss (The back light pin connection is not same as others)

compiler version
IDE 4.057
PC 4.068
PCM 4.068
PCH 4.068
PCD 4.057

I am using real circuit.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 12:58 pm     Reply with quote

Quote:
struct lcd_pin_map { // This structure is overlayed
BOOLEAN enable; // on to an I/O port to gain
BOOLEAN rs; // access to the LCD pins.
BOOLEAN rw; // The bits are allocated from
BOOLEAN unused; // low order up. ENABLE will
int data : 4; // be pin B0.
} lcd;

#byte lcd = 6 // This puts the entire structure

In your version of the compiler, the lcd420 driver is hard-coded to use
the port address for the 16F-series PICs, as shown by the line in bold.
The 18F PICs use a different address, and that is why your code does
not work.

In later versions of the compiler, the line shown below is used.
It will get the actual address used by the specified PIC (16F or 18F).
Code:
#locate lcd = getenv("SFR:PORTB")     
anandpv2009



Joined: 26 Jul 2009
Posts: 31

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 1:06 pm     Reply with quote

Thanks for fast reply..


How I can correct this problem...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 1:21 pm     Reply with quote

Start by reading my post.
anandpv2009



Joined: 26 Jul 2009
Posts: 31

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 1:28 pm     Reply with quote

I didn't find the port address for PIC18F4550 (in data sheet and devices folder of CCS)...

Where can i get it...
anandpv2009



Joined: 26 Jul 2009
Posts: 31

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 1:52 pm     Reply with quote

Thank uuuuuuuuuuuuuu sir...

Finally i found it


addr of PORTB is 0xF81 .....Ha Ha...

Now it works fine..........
Guest








PostPosted: Sun Nov 29, 2009 3:00 pm     Reply with quote

Thank u anand and PCM programmer.........

Yes it works
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