View previous topic :: View next topic |
Author |
Message |
anandpv2009
Joined: 26 Jul 2009 Posts: 31
|
LCD Connection problem |
Posted: Sun Sep 27, 2009 10:25 am |
|
|
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
|
|
Posted: Sun Sep 27, 2009 10:52 am |
|
|
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
|
|
Posted: Sun Sep 27, 2009 10:56 am |
|
|
hi salgulsen
flexlcd works but i can't make any port pins high through my program.. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Sep 27, 2009 11:02 am |
|
|
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
|
|
Posted: Sun Sep 27, 2009 11:09 am |
|
|
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
|
|
Posted: Sun Sep 27, 2009 11:16 am |
|
|
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
|
|
Posted: Sun Sep 27, 2009 11:25 am |
|
|
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
|
|
Posted: Sun Sep 27, 2009 12:02 pm |
|
|
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
|
|
Posted: Sun Sep 27, 2009 1:39 pm |
|
|
#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
|
|
Posted: Sun Sep 27, 2009 2:05 pm |
|
|
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
|
|
Posted: Mon Sep 28, 2009 12:46 am |
|
|
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 . 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
|
|
Posted: Mon Sep 28, 2009 1:33 am |
|
|
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
|
|
Posted: Wed Sep 30, 2009 9:58 pm |
|
|
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
|
|
Posted: Thu Oct 01, 2009 6:01 am |
|
|
Have you set up the TRIS registers for the port you are using? |
|
|
|