View previous topic :: View next topic |
Author |
Message |
sandrewww
Joined: 29 Jun 2006 Posts: 8
|
16F689 dies when connected to lcd? |
Posted: Wed Apr 18, 2007 8:11 am |
|
|
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
|
|
Posted: Wed Apr 18, 2007 8:28 am |
|
|
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
|
|
Posted: Wed Apr 18, 2007 1:37 pm |
|
|
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
|
|
Posted: Wed Apr 18, 2007 1:53 pm |
|
|
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); |
|
|
|
|