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

lcd_putc() works only when I touch the PICmicro

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



Joined: 08 Sep 2008
Posts: 84

View user's profile Send private message

lcd_putc() works only when I touch the PICmicro
PostPosted: Thu Aug 13, 2009 12:24 pm     Reply with quote

everybody Hi,

I'm facing a very weird behaviour of my microcontroller

my PIC 16F877A PICmicro can't execute the LCD control functions (init_lcd() and lcd_putc) without touching its case with my finger or touching the Ground with my finger or a metallic object.

I tested the PIC with various codes including features like RB interruptions , timers interruptions , CCP modules and it worked well.

the PIC is in a card (stepper motor control) and connected to and LCD through the 7 known pins :

compiler version : PCW 4.057

in the code, I used the flex_lcd driver

Code:


#include <16F877A.h>

#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 20000000)
#use rs232 (baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,ERRORS,bits=8)



#include "flex_lcd.c"



void main()
{

lcd_init();

delay_ms(1000);

lcd_putc("READY...\n");


while(1)
{}

}







is there any solution to make the PIC running without touching it ?




here is a schematic and a photo:





your help will be much appreciated.

thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Aug 13, 2009 12:38 pm     Reply with quote

Put a 10K pull-up on the MCLR pin. (Or use 47K if you're using the
CCS ICD-U40).

The MCLR pull-up resistor is important. Put it in all your designs with the 16F877A.
newguy



Joined: 24 Jun 2004
Posts: 1908

View user's profile Send private message

PostPosted: Thu Aug 13, 2009 12:57 pm     Reply with quote

If the MCLR pullup doesn't work, there may be a bad connection between your PIC and the LCD. The LCD driver routine features a wait - there's a while (pin low) or something like that which will cause the routine to appear to stall while the PIC waits for the proper condition.
Salenko



Joined: 08 Sep 2008
Posts: 84

View user's profile Send private message

PostPosted: Thu Aug 13, 2009 1:08 pm     Reply with quote

PCM programmer wrote:
Put a 10K pull-up on the MCLR pin. (Or use 47K if you're using the
CCS ICD-U40).

The MCLR pull-up resistor is important. Put it in all your designs with the 16F877A.


thank you PCM for your quick answer,

I already have a MCLR pull-up in the card, here is the schematic of my RESET circuit, I found it somewhere in internet and I think it is recommended by Microchip (if I'm not wrong).



is there a problem with it ?

another thing to add : I use a 16F877 as a spare PIC of the card.


Last edited by Salenko on Thu Aug 13, 2009 1:41 pm; edited 3 times in total
Salenko



Joined: 08 Sep 2008
Posts: 84

View user's profile Send private message

PostPosted: Thu Aug 13, 2009 1:16 pm     Reply with quote

newguy wrote:
If the MCLR pullup doesn't work, there may be a bad connection between your PIC and the LCD. The LCD driver routine features a wait - there's a while (pin low) or something like that which will cause the routine to appear to stall while the PIC waits for the proper condition.


thank you newguy for you help,

I'll verify again the PIC-LCD connections
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Thu Aug 13, 2009 1:27 pm     Reply with quote

ive been having similar problems...

sugestions on how to control such erratic behavior can be found on most of the threads ive started...

check them out.. some of the guys here posted some pretty good advice

im using the same pic as you are...

gabriel.
_________________
CCS PCM 5.078 & CCS PCH 5.093
Salenko



Joined: 08 Sep 2008
Posts: 84

View user's profile Send private message

PostPosted: Thu Aug 13, 2009 1:35 pm     Reply with quote

Gabriel wrote:
ive been having similar problems...

sugestions on how to control such erratic behavior can be found on most of the threads ive started...

check them out.. some of the guys here posted some pretty good advice

im using the same pic as you are...

gabriel.


Thank you Gabriel, I'll check them .
Guest








PostPosted: Fri Aug 14, 2009 2:21 pm     Reply with quote

I had almost the same problem...
in my case the LCD was init. too soon (when I touch the board pic was somehow reseted and send the init command again so the LCD was init properly). It was solved by delay_ms(100) before lcd_init(); ... its the time LCD need after power up (its in the lcd datasheet).
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