Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 26th September 2007, 06:21 PM   (permalink)
Default Programming 16F628 while connected to LCD

I've build a LCD clock using the schematic attached. The first time I program it using a Inchworm everything programs fine. If I recompile (mplab) and want to reprogram the PIC I keep getting errors. (verification failures)

I've done some fiddling and its to do with the PGM pin being connected to the LCD - if I disconnect the LCD it programs fine.

While this solution is ok I would like to program without disconnecting the pin all the time. I've tried a 10k resistor between the PIC pin10 and the LCD but no luck.

Whats the trick here to get it working?
Attached Images
File Type: gif jp6285.gif (5.8 KB, 62 views)
gregmcc is offline  
Old 26th September 2007, 08:47 PM   (permalink)
Default

Is your schematic complete? Add a 0.1uf cap across pins 5 & 14.

PGM can be disabled with a __CONFIG setting. _LVP_OFF also you may need to add _MCLR_OFF since you have no pullup on the MCLR pin.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is online now  
Old 26th September 2007, 09:16 PM   (permalink)
Default

Bill,

The schematic is not 100% (I got it and the.hex file from http://www.josepino.com/pic_projects...?lcd_clock.jps) - I'm powering it from a stable 5V power supply and from the MCLR pin I have a diode and resistor to 5V (as in the inchworm hello world project)
gregmcc is offline  
Old 27th September 2007, 09:51 PM   (permalink)
Default

Anyone got any ideas on this one?
gregmcc is offline  
Old 27th September 2007, 11:19 PM   (permalink)
Default

Add the 0.1uf cap, it is important.
Also those 1 line LCDs can be tricky, here's an L/C meter with the same display and PIC16F84 (there is code for the 16F628 on the site too)
Jumper LK3 is for poorly behaved displays, the 10K pot is a much better solution than the 1K resistor.
http://ironbark.bendigo.latrobe.edu.au/~rice/lc/

__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is online now  
Old 28th September 2007, 09:47 AM   (permalink)
Default

Thanks - I'll give it a go tonight and let you know the outcome.
gregmcc is offline  
Old 29th September 2007, 12:34 PM   (permalink)
Default

I've added the cap and the 10k pot - made no difference. The problem is not with the LCD - once programmed everything works 100%. Its when I have to reprogram the PIC in circuit that I need to disconnect pin 10 on the PIC. I'm looking for a way to not have to disconnect the pin every time I want to reprogram it.
gregmcc is offline  
Old 29th September 2007, 12:50 PM   (permalink)
Default

hi Greg

>> While this solution is ok I would like to program without disconnecting the pin all the time. I've tried a 10k resistor between the PIC pin10 and the LCD but no luck.

Whats the trick here to get it working?


The simplest way would be to install a 0.1inch pitch jumper, that would save desoldering.

I am not aware of any low cost component way of doing it.
Attached Images
File Type: gif jp6285.gif (6.3 KB, 12 views)
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Gramo's: www.digital-diy.net/
Bill's: www.blueroomelectronics.com/

Last edited by ericgibbs; 7th July 2008 at 12:22 PM.
ericgibbs is online now  
Old 29th September 2007, 12:55 PM   (permalink)
Default

Thanks - I'll do that. I thought there might be some magical way to do it
gregmcc is offline  
Old 29th September 2007, 01:17 PM   (permalink)
Default

If you turn off LVP in the config then there should be no way that the level on B4 should make any difference. Can you post the source file? Or even the hex file.

Mike.
Edit, you don't explain how you have your ICD2 connected. How are B6,7 connected? Have you tried a 10K resistor from the Enable line of the LCD to gnd?

Last edited by Pommie; 29th September 2007 at 01:29 PM.
Pommie is offline  
Old 29th September 2007, 01:40 PM   (permalink)
Default

Pommie - the LVP config bit is turned off. I've uploaded the source file.

The original .hex file can be found at http://www.josepino.com/pic_projects...ock/jp6285.hex

Edit: I've just tried a 10k resistor on the enable pin - doesnt make any difference.

Here's a pic on my ICD2 wiring (its from Bill's hello world project)
Attached Images
File Type: jpg icd2.JPG (16.0 KB, 18 views)
Attached Files
File Type: asm jp6285.asm (25.7 KB, 15 views)

Last edited by gregmcc; 29th September 2007 at 01:50 PM.
gregmcc is offline  
Old 29th September 2007, 01:56 PM   (permalink)
Default

When I am using B6,7 in the main circuit I have 1K resistors in the lines from ICD2 to pic. In this circuit I would also put a 10K resistor from the enable pin (RA1) on the LCD to Gnd, this ensures that the LCD cannot become active and interfere with B6,7.

Mike.
Pommie is offline  
Old 29th September 2007, 02:27 PM   (permalink)
Default

No such luck - I put the 10k to ground and the 1k resistors between the pic and icd2. I've even tried to short lcd enable to ground - it still refuses to be programmed while PGM is connected to the LCD.
gregmcc is offline  
Old 29th September 2007, 02:55 PM   (permalink)
Default

The ICD2 (and Inchworm) both have 4.7K resistors to GND on the PGC & PGD pins. As long as the __CONFIG _LVP_OFF is there PGM should make zero difference.
A HVP programmer will ignore the LVP setting and pin and read/write in HVP mode.

PS how did you get MPLAB to assemble it? There are three very old commands that require modification before it will assemble. The assembler you're using might not set the fuses correctly in the hex file.

Did the "hello world" program work for you?

edit: ahh it's a disassembly of the hex file. Are you using a 16F628 or 16F628A?
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com

Last edited by blueroomelectronics; 29th September 2007 at 03:23 PM.
blueroomelectronics is online now  
Old 29th September 2007, 03:26 PM   (permalink)
Default

I used mplab (latest version) and it assembled here fine.
The hello world project works 100% as well - I can reprogram it till I'm blue in the face and it works everytime.

What are the 3 old commands your mplab is complaining about?

Edit: Yip - its a dissasembly of the hex file. I'm going through the source to try and understand (and teach myself) exactly what is going on.

I'm using the 16F628
gregmcc is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
LCD Troubles Kyle-s4h Micro Controllers 13 11th September 2007 01:30 PM
Error programming 16F628 gregmcc Micro Controllers 67 28th August 2005 09:17 AM
16f628a programming only got 16f628 support will it work? lompa Micro Controllers 6 18th December 2004 06:51 PM
16f628 programming develop Micro Controllers 0 1st January 2004 01:52 PM
Programming the 16F628 rewguy Micro Controllers 4 30th October 2003 09:17 AM



All times are GMT. The time now is 08:35 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker