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 CCS Technical Support

Help needed regarding 2x16 JHD162A LCD and PIC16f877 code

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



Joined: 18 Nov 2009
Posts: 10

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

Help needed regarding 2x16 JHD162A LCD and PIC16f877 code
PostPosted: Tue Dec 08, 2009 7:58 am     Reply with quote

Hi Very Happy
I've been working with PIC16F877 and 2x16 JHD162A LCD module for the past 3 days. No success yet.
All that I get is black boxes in row one. And after sometime a portion of black boxes in row 2 is displayed and nothing else happens.

I monitored my EN bit, RS bit, RW bit and busy bit(DB7) with leds. Even the data bus. They are working fine. The PIC controller and ICD2 programmer are fine.

I suspect a bug in my program. Please help me identify the bug. Guess its in the initializing routine. Tried with various delay values. No success.
_________________
Regards
Karthi


Last edited by karthi27 on Thu Dec 17, 2009 11:29 pm; edited 1 time in total
anandpv2009



Joined: 26 Jul 2009
Posts: 31

View user's profile Send private message

PostPosted: Tue Dec 08, 2009 8:39 am     Reply with quote

Use the following code

Code:
Code:
#include<16f877a.h>

#USE delay(clock=4000000) //SETTING CLOCK FREQUENCY
#FUSES XT,NOWDT,NOBROWNOUT,NOPROTECT,NOPUT //SETTING FUSES

#include<lcd.c>

void main()
{
     
     delay_ms(100);
     lcd_init();
     delay_ms(100);
 
     printf(lcd_putc,"\fHello");
     while(1);

}



connection
//// #define LCD_ENABLE_PIN PIN_B0 ////
//// #define LCD_RS_PIN PIN_B1 ////
//// #define LCD_RW_PIN PIN_B2 ////
//// #define LCD_DATA4 PIN_B4 ////
//// #define LCD_DATA5 PIN_B5 ////
//// #define LCD_DATA6 PIN_B6 ////
//// #define LCD_DATA7 PIN_B7


There is no need to use 8 bit interfacing use 4 bit interfacing...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Dec 08, 2009 3:52 pm     Reply with quote

You're trying to write your own LCD driver, I assume in 8-bit mode.
You're sort of trying to re-invent the wheel. Most people won't be
interested in that. Nisar has posted an 8-bit driver here:
http://www.ccsinfo.com/forum/viewtopic.php?t=38367
I haven't tested it, so I don't know if it works. But you could compare
it to your driver.

To prove that your hardware is wired correctly, you could test it with
the Flex LCD driver in the CCS code library. Though, it only will test
the upper 4-bits of the LCD data bus. It's a 4-bit mode driver.
http://www.ccsinfo.com/forum/viewtopic.php?t=24661

I don't want to debug your 8-bit driver for you.
karthi27



Joined: 18 Nov 2009
Posts: 10

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

Reg... Flex Driver
PostPosted: Tue Dec 08, 2009 8:29 pm     Reply with quote

This is what my project files include

Source files ----> lcdt.c (the test prog for flex_lcd.c driver)
Header files ----> 16f877.h
other files -----> lcdt.sta, ldct.sym, lcdt.tre

Should i include anything else?
_________________
Regards
Karthi
karthi27



Joined: 18 Nov 2009
Posts: 10

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

Not working
PostPosted: Tue Dec 08, 2009 8:59 pm     Reply with quote

The Busy bit(DB7) and RS bits always high... the enable bit is always low(monitored them on LEDs). As usual only the first row is lit up.
This is driving me crazy. This is why I wrote my own LCD prog. Even that isn't working. Please help me in this concern to show some signs of life on my LCD.

This is how I modified... My project files include as stated above.
Code:

#=====Pin modified details in flex_lcd.c=======
#BYTE portb=6   //LOCATION OF REGISTER PORT B
#BYTE portc=7   //LOCATION OF REGISTER PORT C

#bit LCD_DB4=portb.4
#bit LCD_DB5=portb.5
#bit LCD_DB6=portb.6
#bit LCD_DB7=portb.7

#bit LCD_RS=portc.0
#bit LCD_E=portc.1
#bit LCD_RW=portc.2

_________________
Regards
Karthi
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Dec 08, 2009 9:14 pm     Reply with quote

I have no idea what you're doing. You're not using the flex lcd driver.
It has several #define statements at the top where you are supposed
to list your PIC pins that are connected to the LCD.
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