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

16F689 dies when connected to lcd?

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



Joined: 29 Jun 2006
Posts: 8

View user's profile Send private message

16F689 dies when connected to lcd?
PostPosted: Wed Apr 18, 2007 8:11 am     Reply with quote

Hey, does anyone have any ideas of why this happens?

I'm trying to drive a parallel lcd with my 16f689 PIC. I'm using the internal 8Mhz oscillator as the clock, and I can strobe an output for debug purposes (watch the waveform on an oscilloscope).

Whenever I connect the lcd to the circuit however, the PIC stops strobing the output pin, it's as if it dies. My power supply does not indicate any serious current draw and I'm not sure why connecting the lcd is killing the pic program.

The LCD and the program work, I have used it on a 18F452 development board with no problem (I changed the fuses, clock rate, pin assignment appropriately), but would like to move to the 16F689 because it's cheaper and smaller.

I'm using MPLAB 7.5 and the ICD2

Any suggestions?

The 689's pins are all used, and from the the datasheet it looks like I *am* able to use all pins as an IO anytime -- I don't think they deactivated for any reason.

Thanks for any help,
-Andrew
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Wed Apr 18, 2007 8:28 am     Reply with quote

Pin A3 is an Input only. It is shared with the Master Reset. If you are going to use it as an input then your #FUSES need to include NOMCLR, otherwise the part will be in reset mode when it's taken low.

Ronald
sandrewww



Joined: 29 Jun 2006
Posts: 8

View user's profile Send private message

PostPosted: Wed Apr 18, 2007 1:37 pm     Reply with quote

thanks for the reply, i'm pretty sure that nothing is connected to the MCLR except for a pullup resistor and switch.

i've got the nowdt, intrc_io, and nobrownout fuses set

any other thoughts?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Apr 18, 2007 1:53 pm     Reply with quote

The LCD driver probably polls the LCD's busy flag. If that flag never
goes true, the driver likely will remain in the polling loop forever.
(Assuming it has no timeout counter in the routine).

You can use the LED for debugging. Put in a line of code to turn on
the LED at the polling loop for the busy bit. Then turn off the LED
after that line. When you run your code, if the LED turns on and
stays on, then the code is locked up in the busy bit polling loop.

For example, if you're using the CCS driver file, LCD.c, they poll
the busy bit in a couple places in that driver. Here's how to
add the LED debugging code:
Code:

output_high(LED_PIN);
while ( bit_test(lcd_read_byte(),7) );  // Poll busy bit
output_low(LED_PIN);
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