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 Problem
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
faizanbrohi



Joined: 20 Sep 2006
Posts: 19

View user's profile Send private message

LCD Problem
PostPosted: Sun Apr 22, 2007 12:58 am     Reply with quote

Hello , i just bought a LCD with Blue Black light . the LCD is GDM1602A . the datasheet is here [url] http://users.ece.gatech.edu/~hamblen/UP3/GDM1602A.pdf [/url] , i have tried everything to run it , but it just displays boxes on the LCD screen and it flickers when it gets data , but no character is displayed , what could be the problem . Here is the code



Code:
 #include <16F628.h>


#FUSES NOWDT                    //No Watch Dog Timer
#FUSES XT                       //Crystal osc <= 4mhz
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOBROWNOUT                 //Reset when brownout detected
#FUSES NOMCLR                     //Master Clear pin enabled
#FUSES NOLVP                    //Low Voltage Programming on B3(PIC16) or B5(PIC18)
#FUSES NOCPD                    //No EE protection
//#FUSES NOLVP

#use delay(clock=4000000)
//#use rs232(baud=9600,parity=N,xmit=PIN_A3,rcv=PIN_A2,bits=8)

#define D0 PIN_A0
#define D1 PIN_A1
#define D2 PIN_A2
#define D3 PIN_A3
#define D4 PIN_A4
#define D5 PIN_A5
#define D6 PIN_A6
#define D7 PIN_A7

//#define LCD_TYPE 2
#include <LCD.c>

void main()
{

 
output_high(D0);
delay_ms(1000);
output_low(D0);
delay_ms(1000);
output_high(D0);
delay_ms(1000);


While(TRUE){
 

output_high(D0);

lcd_init();

delay_ms(1000);

lcd_putc("\fHello World...");

output_low(D0);

delay_ms(1000);

 }

   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);

}


i think that by looking at the datasheet , the DDRAM Address for accessing the character might be different , so how should i add this in LCD.c
GoodEmbed'



Joined: 14 Apr 2007
Posts: 11

View user's profile Send private message

PostPosted: Sun Apr 22, 2007 5:54 am     Reply with quote

lcd_putc expects only one char at a time as far as I know. I use my tutors LCD driver, but I except its functionally the same.

Try
Code:
printf(lcd_putc,"\fHello, World!");


I noticed that although you've defined the pins for the data connection, you have not connected up the control lines RW/RS/EN.
faizanbrohi



Joined: 20 Sep 2006
Posts: 19

View user's profile Send private message

PostPosted: Sun Apr 22, 2007 11:26 am     Reply with quote

No i have connected the RS/RW/EN pins and data pins also , it is defined in LCD.c . So no problem there . still i don't think so the statement is going to change anything . It is displaying boxes , i.e it is not reading data. , or is not synchronized , but i have checked the data pins and RS/RW/EN pins , they are transmitting data. , what could be the problem.
GoodEmbed'



Joined: 14 Apr 2007
Posts: 11

View user's profile Send private message

PostPosted: Sun Apr 22, 2007 11:35 am     Reply with quote

AH ha!

you're using port A!! (I thought you were using port D from your notation - but 16f628 is a small device of course)

Pin A5 cannot send data.

lame, I know. Check the data sheet and use the bookmarks on the left to find section 5.0 (I/O) to read up on the matter.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Apr 22, 2007 11:37 am     Reply with quote

1. Where does the "LCD.c" file come from ? Is it the CCS driver ?

2. What pins are you using for the LCD ? Post the list of connections
between the PIC pins and the LCD pins.

3. Do you have a trimpot on the LCD's contrast pin ? What voltage
have you applied to the contrast pin ?
faizanbrohi



Joined: 20 Sep 2006
Posts: 19

View user's profile Send private message

PostPosted: Sun Apr 22, 2007 12:01 pm     Reply with quote

I am using the Default Port B for the PIC16F628 . i have tried the LCD.c Driver supplied by CCS , the pin connection is as follows ,

PIC PIN6/B0 ---> LCD PIN 6/EN
PIC PIN7/B1 ---> LCD PIN 4/RS
PIC PIN8/B2 ---> LCD PIN 5/RW
PIC PIN10/B4 ---> LCD PIN 10/D4
PIC PIN11/B5 ---> LCD PIN 11/D5
PIC PIN12/B6 ---> LCD PIN 12/D6
PIC PIN13/B7 ---> LCD PIN 13/D7

10k trimpot used for contrast . and the contrast is adjusting perfectly i.e when not connected to pic it displays boxes in 1 line and i can change the contrast easily by varying the trimpot . As for the Backlight , it is also connected. i have also used another driver for the LCD for the Samsung controller based LCD posted on this forum but no result . Could there be some problem with the driver. Please help , what could be the problem.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Apr 22, 2007 1:37 pm     Reply with quote

Post your compiler version.
faizanbrohi



Joined: 20 Sep 2006
Posts: 19

View user's profile Send private message

PostPosted: Sun Apr 22, 2007 9:16 pm     Reply with quote

it is 4.018
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Apr 23, 2007 12:25 am     Reply with quote

I can test this tomorrow, but my advice is to use the Flex LCD driver
in the Code Library. It's more likely to work, and it's easier than trying
to setup the CCS driver.
faizanbrohi



Joined: 20 Sep 2006
Posts: 19

View user's profile Send private message

PostPosted: Mon Apr 23, 2007 8:50 am     Reply with quote

I have tried the Flex LCD Driver , with this driver the LCD shifts to the second line but no characters are displayed. i have checked everything , and i have changed the pin configration accordingly also . what i am guess is that my LCD is 5x8 dots and it has a different address for characters , that might be the problem please can you see this and tell me if that is the problem , the DDRAM Address is given in the LCD Datasheet. it is located here http://users.ece.gatech.edu/~hamblen/UP3/GDM1602A.pdf
Thank you
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Apr 23, 2007 11:34 am     Reply with quote

Try increasing the delay in the lcd_init() function to 50 ms. See if
that helps. See this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=27518
faizanbrohi



Joined: 20 Sep 2006
Posts: 19

View user's profile Send private message

PostPosted: Mon Apr 23, 2007 8:14 pm     Reply with quote

Still it shifts to the next line partly distorted i.e , the second line blocks are half filled but still nothing only boxes appear., have checked with every time delay. what could be the problem.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Apr 24, 2007 12:35 am     Reply with quote

Maybe you should try a different LCD. In this thread here, we go on
and on with him, and finally he buys a different LCD and corrects a
problem with the connections and it starts working:
http://www.ccsinfo.com/forum/viewtopic.php?t=22713


This thread has more help on getting an LCD working:
http://www.ccsinfo.com/forum/viewtopic.php?t=30026

Also, there are some things in your posted code that are not correct,
such as the commenting out of NOLVP:
Quote:
//#FUSES NOLVP

The NOLVP fuse needs to be put back in.
faizanbrohi



Joined: 20 Sep 2006
Posts: 19

View user's profile Send private message

PostPosted: Tue Apr 24, 2007 1:06 pm     Reply with quote

the NOLVP fuse is on , check the code again . but i still did not find any solution , now i am trying to change the LCD or mail the manufacturer for a complete datasheet and then build my own driver for the LCD. the controller is the S6A0069 or the KS0066U .
faizanbrohi



Joined: 20 Sep 2006
Posts: 19

View user's profile Send private message

PostPosted: Wed Apr 25, 2007 8:38 am     Reply with quote

This is turning out to be a mysterious problem , i have changed the LCD and now i am using a simple 16x1 LCD , and still boxes appear on the LCD. something wrong with the chip or the program , what should i do.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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