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 - first line is black

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



Joined: 29 Jun 2005
Posts: 13

View user's profile Send private message

LCD - first line is black
PostPosted: Thu Jul 21, 2005 1:57 am     Reply with quote

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

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

PostPosted: Thu Jul 21, 2005 7:59 am     Reply with quote

Did you try adjusting the pot. (variable resister) that controls the contrast?
meme



Joined: 29 Jun 2005
Posts: 13

View user's profile Send private message

PostPosted: Thu Jul 21, 2005 8:41 am     Reply with quote

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

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

PostPosted: Thu Jul 21, 2005 11:00 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jul 21, 2005 11:48 am     Reply with quote

#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

View user's profile Send private message

PostPosted: Thu Jul 21, 2005 12:01 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jul 21, 2005 1:50 pm     Reply with quote

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

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

PostPosted: Thu Jul 21, 2005 2:22 pm     Reply with quote

Does your LED blink?
meme



Joined: 29 Jun 2005
Posts: 13

View user's profile Send private message

PostPosted: Fri Jul 22, 2005 12:05 am     Reply with quote

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







PostPosted: Fri Jul 22, 2005 2:06 am     Reply with quote

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







PostPosted: Fri Jul 22, 2005 2:08 am     Reply with quote

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.
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