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

pin mapping in LCD.C

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



Joined: 26 Aug 2009
Posts: 4
Location: Padova - Italy

View user's profile Send private message

pin mapping in LCD.C
PostPosted: Wed Aug 26, 2009 1:29 am     Reply with quote

I'm trying to use LCD.C driver with a LCD module connected to a PIC16F876 with the following connections:
Quote:
LCD <---> micro
D4 <---> RB0
D5 <---> RB1
D6 <---> RB2
D7 <---> RB3
E <---> RB4
RS <---> RB5
R / W <---> ground


I edit LCD.C driver in this way:
Quote:
// Un-comment the following define to use port B
#define use_portb_lcd TRUE


struct lcd_pin_map {
int data : 4; // assegna le linee dati del LCD ai pin RB0 - RB3
BOOLEAN enable; // assegna ENABLE al pin RB4
BOOLEAN rs; // assegna RS (dati/istruzioni) al pin RB5
// BOOLEAN rw; // RW a massa
BOOLEAN unused1; // lascia libero il pin RB6
BOOLEAN unused2; // lascia libero il pin RB7
} lcd;

and I comment 3 lines with " lcd.rw = 0;"

This is the simple test program I'm using:
Quote:
#include <16F876.h> //richiama il file di impostazioni per il PIC16F876

#use delay(clock=4000000) //questa spam è necessaria perché LCD_DEMO.C usa delay_us()

#include <LCD_DEMO.C> //edited version of LCD.C


void main() {

lcd_init();
lcd_gotoxy(1,1);
lcd_putc("PRIMA spam");

}
but I don't see any character in the screen. It seems (not sure) that LCD is initialized.

May be the problem is in the line with " int data : 4;" ?
Is there an alternative way to specify the data lines of LCD ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Aug 26, 2009 1:43 am     Reply with quote

Use the flex driver:
http://www.ccsinfo.com/forum/viewtopic.php?t=24661
Edit the #define statements at the top of the driver to match the pins that
you're using, and comment out this line in the driver:
Quote:
// #define USE_LCD_RW 1

Make sure your contrast voltage is set correctly. A good starting point
is about 0.5 volts.
giopic



Joined: 26 Aug 2009
Posts: 4
Location: Padova - Italy

View user's profile Send private message

PostPosted: Wed Aug 26, 2009 10:05 am     Reply with quote

It works and it's easy to configure. Thank you very much.
Just to know would it possible to use LCD.c for the same application ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Aug 26, 2009 11:40 am     Reply with quote

Quote:

Just to know would it possible to use LCD.c for the same application ?

Read this thread and the link in it.
http://www.ccsinfo.com/forum/viewtopic.php?p=45146
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