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 Connection 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 Connection problem
PostPosted: Sun Sep 27, 2009 10:25 am     Reply with quote

Hi,
I want to connect my LCD to PORT A of my pic16f84 mc but I think the connection is only possible through port B. But my port B is reserved for interrupts. I tried flexible lcd driver but it doesn't work properly. Anyone know any other ways.
salgulsen



Joined: 16 Sep 2009
Posts: 21

View user's profile Send private message

PostPosted: Sun Sep 27, 2009 10:52 am     Reply with quote

Did you disable all the other functions of the pins you are using? I remember PIC16F84 has a comparator and a timer function in portA...You should disable them with :

setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);

Besides that, flex_lcd driver is an easy to use driver...you just change the pin definitions and : voila!
anandpv2009



Joined: 26 Jul 2009
Posts: 31

View user's profile Send private message

PostPosted: Sun Sep 27, 2009 10:56 am     Reply with quote

hi salgulsen
flexlcd works but i can't make any port pins high through my program..
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Sep 27, 2009 11:02 am     Reply with quote

Quote:

I remember PIC16F84 has a comparator and a timer function in portA.

It does not have a comparator. The T0CKI pin does not affect the
usage of pin A4 as an i/o pin. You don't have to disable the Timer to
use pin A4. Please read the data sheet before making recommendations.

Pin A4 is an open-drain pin. It can't be driven high by the PIC. If you
want to use it as an output pin, and you want it to be able to go high,
then you need to add an external pull-up resistor to it. (Use 4.7K ohms).
anandpv2009



Joined: 26 Jul 2009
Posts: 31

View user's profile Send private message

PostPosted: Sun Sep 27, 2009 11:09 am     Reply with quote

Please understand me the problem is

When i use the flexible lcd driver i can't make high any of port pins(PORT A / PORT B)....
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Sep 27, 2009 11:16 am     Reply with quote

Are you using a real hardware board, or are you using Proteus ?
If it's Proteus, then post a link to the schematic for your project.

If it's a board, did you build the board by yourself, or did you buy it ?
If you bought the board, post the manufacturer and model number of
the board, and post a link to the website for it.
anandpv2009



Joined: 26 Jul 2009
Posts: 31

View user's profile Send private message

PostPosted: Sun Sep 27, 2009 11:25 am     Reply with quote

My problem is simple sir.

i were interfaced a lcd with my 16f84(also checked with PIC16F877A,PIC16F873A)

The lcd works fine with ccs lcd driver(lcd.c) and i can make any port pin to high or light a led. But when i use flexible lcd driver (instead of lcd.c) the lcd works but i can't light the led...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Sep 27, 2009 12:02 pm     Reply with quote

Post your test program that shows the problem. Post the list of #define
statements for the Flex LCD driver, that shows the pins that it uses.

Post your compiler version.

Don't post the Flex driver code. I know where it is.
anandpv2009



Joined: 26 Jul 2009
Posts: 31

View user's profile Send private message

PostPosted: Sun Sep 27, 2009 1:39 pm     Reply with quote

#DEFINE
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_B6
#define LCD_RW    PIN_B7



code
Code:

#include <16F84.h>   
#use delay(clock = 4000000) //----------4 MHZ XT
#define use_portb_lcd TRUE
#include "flcd.c" 
void main()
{   
\\some codes
   printf(lcd_putc,"\fTemperature in C\n%d 'C",c);

output_high(PIN_A0);    \\not working
delay_ms(100);
output_low(PIN_A0);
}


code
Code:

#include <16F84.h>   
#use delay(clock = 4000000) //----------4 MHZ XT
#define use_portb_lcd TRUE
#include "lcd.c" 
void main()
{   
\\some codes
   printf(lcd_putc,"\fTemperature in C\n%d 'C",c);

output_high(PIN_A0);    \\working
delay_ms(100);
output_low(PIN_A0);
}


CCS version :4.057
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Sep 27, 2009 2:05 pm     Reply with quote

That is not a complete program.

1. It's missing the #fuses statement.

2. It's missing the call to the lcd_init() function.

Quote:
printf(lcd_putc,"\fTemperature in C\n%d 'C",c);

3. This text is more than 16 characters. It can't fit on a 16x2 LCD.
What lcd are you using ?

4. You didn't answer the question: Are you using Proteus or some other
simulator ? Are you using real hardware ?


I suspect you are using Proteus or Oshonsoft.
anandpv2009



Joined: 26 Jul 2009
Posts: 31

View user's profile Send private message

PostPosted: Mon Sep 28, 2009 12:46 am     Reply with quote

I am using real hardware and sorry for the mistakes.
Usually I am writing programs without #fuses. I will set it in the burning software.

All the lcd init and other codes are done in some code area and 'Temperature in C' still has 16 chars Exclamation . and as I said earlier my problem is with the
Code:
output_high(PIN_B0);

instruction....The ins works with LCD.C and not with FLEXLCD.C
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Sep 28, 2009 1:33 am     Reply with quote

I can't help you. You keep changing everything. In your previous code
you used PIN_A0. Now it's PIN_B0. I can't help you anymore. Maybe
somebody else can help.
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Wed Sep 30, 2009 9:58 pm     Reply with quote

Anand, post a _complete_ version of your most recent working and non-working code. Also post the fuse configuration. It is generally not recommended to set fuses in the burning software unless you really know what you are doing. Stick to setting fuses in the CCS or MPLAB IDE.

Rohit
Neddie
Guest







PostPosted: Thu Oct 01, 2009 6:01 am     Reply with quote

Have you set up the TRIS registers for the port you are using?
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