View previous topic :: View next topic |
Author |
Message |
meme
Joined: 29 Jun 2005 Posts: 13
|
LCD - first line is black |
Posted: Thu Jul 21, 2005 1:57 am |
|
|
I have connected my LCD (KS0070B-00) at port B. The 3-rd pin (contrast) is connected through a variable resistor. I use the CCS drivers for LCD. In lcd.c I uncommented the define port B statement to use port B for the LCD. But when i try to write something on the lcd with the lcd_putc command, all I see is the first line black. Next is the code:
Code: | #include "C:\Program Files\PICC\LCD_test\lcd_test.h"
#include <LCD.C>
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
output_high(PIN_A0); //this is a blinking LED
lcd_init();
delay_ms(200);
output_low(PIN_A0);
while(1){
output_high(PIN_A0);
delay_ms(1000);
output_low(PIN_A0);
delay_ms(1000);
lcd_gotoxy(1,1);
lcd_putc("T");
}
} |
my fuses are:
#fuses NOWDT,XT, PUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT
Could it be because of the LCD controller wichis not a HD44780 ?
thank you |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Thu Jul 21, 2005 7:59 am |
|
|
Did you try adjusting the pot. (variable resister) that controls the contrast? |
|
|
meme
Joined: 29 Jun 2005 Posts: 13
|
|
Posted: Thu Jul 21, 2005 8:41 am |
|
|
yes. I adjusted the resistor untill the black line appeared. then I left it on the same position. when I try to send a character... nothing happens.
I connected pins 4 5 6 and 7 of portB with the pins DB4-DB7 of the LCD. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Jul 21, 2005 11:00 am |
|
|
On a four line display, the first and third lines appear all black on power up. On a two line display, the top line will appear all black on power up.
That controller is compatiable with a HD44780 and it should work. How do you have it connected. Be specific.
What use delay value are you using? |
|
|
meme
Joined: 29 Jun 2005 Posts: 13
|
|
Posted: Thu Jul 21, 2005 11:48 am |
|
|
#use delay(clock=4000000)
connections are as follows:
pic16F877-A -> LCD
pinB0 -> E
pinB1 -> RS
pinB2 -> R/W
pinB3 -> not connected
pinB4 -> pin11
pinB5 -> pin12
pinB6 -> pin13
pinB7 -> pin14
the pins 15 and 16 of the LCD are not connected (as said in the datasheet) |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jul 21, 2005 12:01 pm |
|
|
Quote: | But when i try to write something on the lcd with the lcd_putc
command, all I see is the first line black |
This long LCD thread discusses your problem. It goes over all the
details that you need to check.
http://www.ccsinfo.com/forum/viewtopic.php?t=22713 |
|
|
meme
Joined: 29 Jun 2005 Posts: 13
|
|
Posted: Thu Jul 21, 2005 1:50 pm |
|
|
thank you for the link but... it didn't help. or maybe I have to buy another type of LCD. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Jul 21, 2005 2:22 pm |
|
|
Does your LED blink? |
|
|
meme
Joined: 29 Jun 2005 Posts: 13
|
|
Posted: Fri Jul 22, 2005 12:05 am |
|
|
yes, the led is blinking as intended, but the lcd shows the first line filled, then both right halfs of the 2 lines filled. and then loops to the first line filled. |
|
|
behemoth Guest
|
|
Posted: Fri Jul 22, 2005 2:06 am |
|
|
I also have some problem with interfacing with LCD.
I manage with it by add additional delay before init_LCD command,like that:
#include <16f628A.h>
#fuses HS,NOWDT,PUT,NOPROTECT,NOBROWNOUT,NOLVP,MCLR,NOCPD
#use delay(clock=20000000)
#include <lcd.c>
#define LAMPKA PIN_A2
#define LAMPKA1 PIN_A3
main()
{
setup_adc_ports (NO_ANALOGS);
delay_ms(50);
lcd_init();
while(true)
{
output_high(LAMPKA);
output_low(LAMPKA1);
lcd_putc("\fkurcze-linia numer 1");
delay_ms(500);
output_low(LAMPKA);
lcd_putc("\f\nkurcze-linia numer 2-ok-");
output_high(LAMPKA1);
delay_ms(500);
}
}
After this everything started to work properly. |
|
|
behemoth Guest
|
|
Posted: Fri Jul 22, 2005 2:08 am |
|
|
I also have some problem with interfacing with LCD.
I manage with it by add additional delay before init_LCD command,like that:
#include <16f628A.h>
#fuses HS,NOWDT,PUT,NOPROTECT,NOBROWNOUT,NOLVP,MCLR,NOCPD
#use delay(clock=20000000)
#include <lcd.c>
#define LAMPKA PIN_A2
#define LAMPKA1 PIN_A3
main()
{
setup_adc_ports (NO_ANALOGS);
delay_ms(50);
lcd_init();
while(true)
{
output_high(LAMPKA);
output_low(LAMPKA1);
lcd_putc("\fkurcze-linia numer 1");
delay_ms(500);
output_low(LAMPKA);
lcd_putc("\f\nkurcze-linia numer 2-ok-");
output_high(LAMPKA1);
delay_ms(500);
}
}
After this everything started to work properly. |
|
|
|