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

flex_lcd

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



Joined: 20 Apr 2007
Posts: 111

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

flex_lcd
PostPosted: Fri Jun 15, 2007 1:02 pm     Reply with quote

I am trying use driver flex_lcd.c but do not work up to now.

my code is

#include <16f877.h>
#use delay(clock=4000000)
#fuses nowdt,noput,nobrownout,nolvp,noprotect
#define use_portb_lcd 1
#include <flex_lcd.c>

#use standard_io (B)


void main(void)
{
lcd_init(); //Inicia LCD
set_tris_b(0x00); /*PortB saida*/

lcd_putc("Teste"); //Escreve texto
}

The design is:

http://pg.photos.yahoo.com/ph/fernandoazevedo.rm/detail?.dir=5108re2&.dnm=546cre2.jpg&.src=ph

when I try compile appear the follow message:

undefined identifier LCD_DB4

Does anyone here can help me pls?

thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jun 15, 2007 1:31 pm     Reply with quote

Quote:
When I try compile appear the follow message:
undefined identifier LCD_DB4

Look at the driver code. It has the #define statements for the pins at
the start of the file. You must have those lines there. Don't delete them.
Based on your drawing, here are the #define statements for your board:
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_B5
#define LCD_RS    PIN_B7
#define LCD_RW    PIN_B6

#define USE_LCD_RW   1



Quote:

#define use_portb_lcd 1
#include <flex_lcd.c>

#use standard_io (B)

The "use_portb_lcd" line is not used with the Flex LCD driver. It's for the CCS LCD driver. Delete it.


Also, in your drawing, you have connected the LCD contrast pin (pin 3)
to +5v. That's wrong. It should be between 0v and 0.5v. Probably
a voltage of 0.4v will give the best contrast. Use a trimpot or a two
resistors (arranged as a voltage divider) to set the contrast voltage.


Finally, you are missing the oscillator fuse setting. You need to add
XT to the fuses as shown in bold below:
Quote:

#include <16f877.h>
#fuses XT,nowdt,noput,nobrownout,nolvp,noprotect
#use delay(clock=4000000)



There's another error. In your drawing, capacitor C2 is 1 nF.
That's wrong. It should be 22 pf, just like capacitor C1.
Change it.

Also, you have connected pin RA5 to ground. Why ?
Remove that connection.
nina



Joined: 20 Apr 2007
Posts: 111

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

perfect
PostPosted: Fri Jun 15, 2007 2:06 pm     Reply with quote

many thanks pcm programmer...

It is working now.

I saw also if I took the line

set_tris_b(0x00);

also work without problem

thanks again
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