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 Hardware not working properly

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







LCD Hardware not working properly
PostPosted: Thu Jan 22, 2009 2:06 am     Reply with quote

Hi, I'm running a program for LCD (as below). The simulation working properly but when running on hardware the display appear intermittently. Most of the times LCD show full block display on first row. I need to touch the IC leg 1 and 2 and suddenly the display appear.

Please help!

Code:
#include <16f877a.h>
#use delay (clock = 20000000)
#fuses hs,noprotect,nowdt,nolvp
#BYTE PORTA=5
#BYTE PORTB=6
#BYTE PORTC=7
#include <flex_lcd.c>


void main()
{

   set_tris_a (0);
   

   lcd_init();
   lcd_gotoxy(1, 1);
   lcd_putc("VOTE\n");
   delay_ms(1000);
   lcd_putc("READY\n");
   

   while(TRUE)
   {
      int8 value;
      value = input_b();
      switch(value)
               {
               case 0b00000001: lcd_putc("Yes"); break;
               case 0b00000011: lcd_putc("No"); break;

               }
              delay_ms(100);


   }
             
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 22, 2009 2:22 pm     Reply with quote

Quote:
I need to touch the IC leg 1 and 2 and suddenly the display appear
.
1. On the LCD, those pins are the Ground and Power pins. On the PIC,
pin 1 is the MCLR pin. You need to fix your hardware. Check the wires
and make sure you have good connections. Make sure you have a
pull-up resistor on the MCLR pin of the PIC.

2. The lcd advances the cursor after each character is displayed with
the lcd_putc() function. After a few characters are displayed in your
while() loop, the LCD cursor will be off the screen. You need to reset
the cursor to coordinates (1, 1) at the start of the while() loop.
Guest








PostPosted: Fri Jan 23, 2009 12:56 am     Reply with quote

thanks! i wired wrong to MCLR. The problem solved.
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