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

Flexible LCD driver
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Oct 04, 2008 12:31 pm     Reply with quote

Quote:
2. Compiler version: 4.013

Your version is at best, a Beta version of the vs. 4 compiler.
If your version has the bug that you describe, then it should display '00'
at the end of the output, with the test program shown below.
I don't have 4.013 to test, but vs. 4.014 and later, do not put a '00' at
the end. This is the output from a good version of the compiler:
Quote:
48 65 6C 6C 6F 20 57 6F 72 6C 64

Code:

#include <16F877.H>
#fuses XT,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay (clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

void lcd_putc(char c)
{
printf("%X ", c);
}

//=================================
void main()
{

lcd_putc("Hello World");

while(1);
}
DavidW



Joined: 26 Oct 2008
Posts: 1

View user's profile Send private message

PostPosted: Sun Oct 26, 2008 3:50 pm     Reply with quote

Hello PCM. I just want to say thanks for this custom LCD.C driver. I been having a tough time figuring out the CCS LCD driver since I am a beginner with PIC programming. I made some modifications to your original code to fit the I/O pins that were available on my PIC but when I compile the code I get an error

Error 128 "flex_lcd.c" Line 28(1,42): A #DEVICE required before this line

and the line with the error is in flex_lcd.c:
int8 const LCD_INIT_STRING[4] =

Do you know why I am getting this error?

I am using a PIC16F877A and a 2x16 HD44780 LCD display. Here are the only modifications I made to flex_lcd.c:

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

#define LCD_E PIN_C1
#define LCD_RS PIN_C2
#define LCD_RW PIN_C3

A little bit more information, I am using version 4.064 for the CCS C compiler. Thanks for your help!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Oct 26, 2008 4:19 pm     Reply with quote

Quote:
A #DEVICE required before this line

This type of question belongs in the main forum. If the following
information doesn't fix the problem, then post the question in the
main forum:


Are you using MPLAB ? If so, see these links:

How to use multiple source files with MPLAB:
http://www.ccsinfo.com/forum/viewtopic.php?t=34046

More detailed information on using multiple files with MPLAB.
Read all the links in this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=32221
ishmael



Joined: 02 Jun 2009
Posts: 4

View user's profile Send private message

hello again
PostPosted: Tue Jun 02, 2009 3:05 pm     Reply with quote

my question dissapeared.
can portA be used with this driver for a pic16f648A ? i port B is occupied with USART and 32khz.
Thank you.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jun 06, 2009 11:56 am     Reply with quote

Read the instructions in the first post. Any pin can be used, provided
that it has full i/o capabilities. Don't use input-only pins. If the pin
is open-drain, then an external pull-up resistor must be used on that pin.
BotBoy



Joined: 06 Nov 2009
Posts: 6

View user's profile Send private message

PostPosted: Tue Nov 10, 2009 1:15 pm     Reply with quote

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


Is possible after put these two lines on LCD...
write some word only on line 2 without clean line 1?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Nov 10, 2009 1:46 pm     Reply with quote

Quote:
Is possible after put these two lines on LCD...
write some word only on line 2 without clean line 1?

Call the following function in the LCD driver to set the cursor position.
The Origin is (1, 1) and it's in the upper left corner of the LCD.
Quote:
void lcd_gotoxy(int8 x, int8 y)


You can ask ordinary LCD questions (like this one) in the main forum.
yoda



Joined: 22 Dec 2009
Posts: 3

View user's profile Send private message

nothing happen
PostPosted: Tue Dec 29, 2009 5:06 am     Reply with quote

i'm using your flex_lcd and test it using your prog:

Code:
#include <16F877A.H>
#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 20000000)

#include <lcd flex driver.c>

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

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

while(1);
}


Code:
and change
#define LCD_DB4   PIN_C3
#define LCD_DB5   PIN_C2
#define LCD_DB6   PIN_C1
#define LCD_DB7   PIN_C0

#define LCD_E     PIN_D0
#define LCD_RS    PIN_D2
#define LCD_RW    PIN_D1
//change bcause of wiring i already made

It can be compiled and write to the pic but
nothing come up to the lcd. I checked the wiring and it all good.
I'm using pcw compiler and pic2kit.
yoda



Joined: 22 Dec 2009
Posts: 3

View user's profile Send private message

PostPosted: Thu Dec 31, 2009 1:23 am     Reply with quote

Ok the problem can be solved by connecting my Vee pin to ground.
At first I connect it to the trimpot to vary the lcd contrast. Why is this happening?
_________________
help me to help you to help me
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 31, 2009 1:59 am     Reply with quote

The normal setting for the LCD contrast is about 0.4 to 0.5 volts.
gonzalza



Joined: 23 Feb 2010
Posts: 12

View user's profile Send private message

Re: Flexible LCD driver
PostPosted: Tue Feb 23, 2010 5:43 pm     Reply with quote

Hi PCM Programmer how are you? I noticed the forum is quite old but, I'm interested on it, well, I'm good at c language and assembly however I have never programmed pic with c language. That's why if I'm doing so simple questions excuse me about it.

In the first code I saw this " / These pins are for the Microchip PicDem2-Plus board, " and I don't understand this. In fact I just bought a lcd 16x2 and already install the CCS plugin to MPLAB.

But now what kind of board are you talking about? Without knowing this I can't continue. Thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Feb 23, 2010 5:56 pm     Reply with quote

The original comments were written about this PicDem2-Plus board:
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en010072
That board has now been replaced by the PicDem2-Plus (Rohs update
version):
http://www.microchipdirect.com/ProductSearch.aspx?Keywords=DM163022

The first link has documentation for both boards (at the bottom of the
page).

The Flex LCD driver post has notes on how to make the driver work for
both boards.
http://www.ccsinfo.com/forum/viewtopic.php?t=24661

If you have more questions, please ask them in the General Discussion
forum. More people look at that forum. Here's the link:
http://www.ccsinfo.com/forum/viewforum.php?f=1
gonzalza



Joined: 23 Feb 2010
Posts: 12

View user's profile Send private message

PostPosted: Wed Mar 03, 2010 4:32 pm     Reply with quote

Dear PCM Programer


I want to test the LCD, but im not gonna work with the board from microchip and also i want to use the pic 16f874 or 877, 1.can i use the same port configuration PB and PA .


#define LCD_DB4 PIN_D0
#define LCD_DB5 PIN_D1
#define LCD_DB6 PIN_D2
#define LCD_DB7 PIN_D3

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

2. apart of it, i just have to use VDD and VSS Don't I? do i have to use another pin from LCD?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Mar 03, 2010 4:51 pm     Reply with quote

1. Use any available PIC i/o pins. (That can do both input and output).

2. Set the contrast pin on the LCD to about 0.4 volts.


If you have any more questions on LCDs, post them in the main forum.
matheuslps



Joined: 29 Sep 2010
Posts: 73
Location: Brazil

View user's profile Send private message MSN Messenger

PostPosted: Mon Jan 17, 2011 5:17 pm     Reply with quote

Is it possible change the pins that I need to use in the main code off a generic program, before ou after call the "#include <LCD_Flex.C>" without a modification on the original LCD_Flex.C?

I tried with #ifndef but it did not work. Sad

thanks
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 6 of 7

 
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