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 support@ccsinfo.com

LCD on PICDEM 2 PLUS with PIC16Fxx

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



Joined: 28 Apr 2009
Posts: 6

View user's profile Send private message

LCD on PICDEM 2 PLUS with PIC16Fxx
PostPosted: Wed Apr 29, 2009 1:27 am     Reply with quote

Hello,

I'm using a PIC16Fxx Device and the PICDEM 2 Plus Board. Im tried to use the flex_lcd.c Code with some modification to use the LCD.

I'm using the 18-Pin Socket, which has no connection to the lcd. Because of that I connect it with cables over the other two sockets:
Code:
28-PIN-Socket        40-PIN-Socket
------------------------------------------------
21 -> 19
22 -> 20
23 -> 21
24 -> 22
25 -> 27
26 -> 28
27 -> 29
28 -> 30



In the flex_lcd I've corrected the beginning part with port declaration:
Code:
// These pins are for the Microchip PicDem2-Plus board,
// which is what I used to test the driver.  Change these
// pins to fit your own board.

#define LCD_DB4   PIN_B0
#define LCD_DB5   PIN_B1
#define LCD_DB6   PIN_B2
#define LCD_DB7   PIN_B3

#define LCD_E     PIN_B6
#define LCD_RS    PIN_B5
#define LCD_RW    PIN_B4

// 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     


No I hopped this should work with the following code in the main.c:

Code:
   output_high(LCD_POWER);  // Turn on power to LCD
   output_low(LCD_RW);      // Set R/W pin on LCD to a low level
   lcd_init();  // Always call this first.

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




What's wrong? Can somebody help or have somebody also tried to use a PIC16 Device with the LCD?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Apr 29, 2009 11:01 am     Reply with quote

First, I need to know which version PicDem2-Plus you have.

The new Rohs version looks like this. It has silver pads in the bottom of
the prototyping area on the right side of the board:
http://www.microchipdirect.com/ProductSearch.aspx?Keywords=DM163022

The older non-Rohs version doesn't have that. It looks like this:
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en010072

Which board do you have ?
snwbnd



Joined: 28 Apr 2009
Posts: 6

View user's profile Send private message

PostPosted: Wed Apr 29, 2009 11:07 am     Reply with quote

I have the new Rohs Version from 2006!

Since i've wrote the thread, I've changed some pins. I saw that RB6 and 7 are used for Debugging and RB0 is connected to S3.

RA1...RA3 -> RS, R/W and E
RB1...RB4 -> DB4...DB7
RB5 -> VCC Transistor to activate the Display

This connections are made and tested on the hardware


in the flex_lcd I've wrote this:
Code:
#define LCD_DB4   PIN_B1
#define LCD_DB5   PIN_B2
#define LCD_DB6   PIN_B3
#define LCD_DB7   PIN_B4

#define LCD_E     PIN_A3
#define LCD_RS    PIN_A1
#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 


In main.c I've added this:

Code:
#define LCD_POWER  PIN_B5
output_high(LCD_POWER);  // Turn on power to LCD
   output_low(LCD_RW);      // Set R/W pin on LCD to a low level
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Apr 29, 2009 11:13 am     Reply with quote

Post your PIC and your compiler version.
snwbnd



Joined: 28 Apr 2009
Posts: 6

View user's profile Send private message

PostPosted: Thu Apr 30, 2009 2:11 am     Reply with quote

CCS Version 4.057
MPLAB Version 8.00
PIC16F87
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Apr 30, 2009 12:12 pm     Reply with quote

You jumpered Port B to Port D on a 1:1 basis. The LCD uses pins
on Port D only. The connections are shown in the schematic in the
back of the PicDem2-Plus User's Guide. So to create the new #define
statements, you simply have to edit the table shown in this post
http://www.ccsinfo.com/forum/viewtopic.php?t=24661&start=51
and change PIN_Dx into PIN_Bx. Also, the #define for the power pin
should be changed in the same way. Do it like this:
Code:

#define LCD_DB4   PIN_B0
#define LCD_DB5   PIN_B1
#define LCD_DB6   PIN_B2
#define LCD_DB7   PIN_B3

#define LCD_E     PIN_B6
#define LCD_RS    PIN_B4
#define LCD_RW    PIN_B5

// 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 

#define LCD_POWER  PIN_B7

If you copy this code exactly, it should work. But to be safe, remove
jumper J6. There are 4 LEDs on pin B0 to B3. It's possible that these
might interfere with the LCD operation if they are connected. If you
remove jumper J6, they will be disabled.
snwbnd



Joined: 28 Apr 2009
Posts: 6

View user's profile Send private message

PostPosted: Thu Apr 30, 2009 12:24 pm     Reply with quote

No, I jumpered it like this:
RA1...RA3 -> RS, R/W and E
RB1...RB4 -> DB4...DB7
RB5 -> VCC Transistor to activate the Display

I removed J6 and I don't want to usw RB0 because of the connection to the RB0 Button and RB6&7 because they are used for the Debugger....
I've changed the code like my post before:
Code:
#define LCD_DB4   PIN_B1
#define LCD_DB5   PIN_B2
#define LCD_DB6   PIN_B3
#define LCD_DB7   PIN_B4

#define LCD_E     PIN_A3
#define LCD_RS    PIN_A1
#define LCD_RW    PIN_A2


Also the Power Pin is changed!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Apr 30, 2009 12:30 pm     Reply with quote

So you changed the jumpers ? Here is your previous list of jumpers.
Quote:
28-PIN-Socket 40-PIN-Socket
------------------------------------------------
21 -> 19
22 -> 20
23 -> 21
24 -> 22
25 -> 27
26 -> 28
27 -> 29
28 -> 30

Apparently this is no longer in effect.

Post the exact list of pin-to-pin jumpers (not names) that you currently have.
snwbnd



Joined: 28 Apr 2009
Posts: 6

View user's profile Send private message

PostPosted: Thu Apr 30, 2009 12:36 pm     Reply with quote

At the moment, I've released the connections to test the lcd with a 40pin device, which is working perfectly by the way.

I've always made the connections from the 40pin to the 28pin socket and after I've tested them with a multimeter. Directly measured from my 16f87 and the LCD Connections.

Did you ever used the lcd on the picdem 2 with a 18pin PIC device?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Apr 30, 2009 12:38 pm     Reply with quote

No.
snwbnd



Joined: 28 Apr 2009
Posts: 6

View user's profile Send private message

PostPosted: Thu Apr 30, 2009 12:43 pm     Reply with quote

So I test it tomorrow again, the connections are correct...
Do you think it should work like I said here:
Quote:
No, I jumpered it like this:
RA1...RA3 -> RS, R/W and E
RB1...RB4 -> DB4...DB7
RB5 -> VCC Transistor to activate the Display

I removed J6 and I don't want to usw RB0 because of the connection to the RB0 Button and RB6&7 because they are used for the Debugger....
I've changed the code like my post before:
Code:

#define LCD_DB4   PIN_B1
#define LCD_DB5   PIN_B2
#define LCD_DB6   PIN_B3
#define LCD_DB7   PIN_B4

#define LCD_E     PIN_A3
#define LCD_RS    PIN_A1
#define LCD_RW    PIN_A2


Also the Power Pin is changed!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Apr 30, 2009 12:52 pm     Reply with quote

It will probably work, provided that it's jumpered correctly.
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