Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ICSP -- With Other Components

Status
Not open for further replies.

Omar.M

Member
Hello,
I want to be able to program the PIC on my POV toy, without having to take it off and put it into the programmer. This way, I can solder the chip and stuff to the PC board and when I want to change messages, just simple reprogram using an ICSP cable / header.

The thing is, when using the ICSP-- does one need to disconnect other components such as LEDs or resonators which are connected to the chip at the same time? Or can they be connected to the microcontroller pins while I use the ICSP?

I am thinking of using 16F628A, or 16F684-- if that makes any difference.

Thanks,
Omar
 
These pins are eventually going to be driven from an ICSP programmer, so it depends on how hard the programmer drives the lines and how much impedance the devices hooked up to the ICSP lines load the pins themselves under programming conditions. Basically, try it and see if it works. You may have to lower the ICSP clock rate if any device on a programming line is highly reactive.
 
or make sure those two pins aren't used by anything trying to sink current

for example on an lcd backpack I'm working on, I have PGC and PGD directly connected to high impedance inputs on the lcd, so the icsp programmer has no troulbe driving them

another design using an eight pin PIC, I had to use pgc as a button input. by using internal pull-ups, once the the programmer locks the chip into program mode, the pull-ups are disabled and the button is high impedance (unless i was pressing it), again, no trouble for the programmer.
 
Actually, almost all of my pins are being used up. I have about 8 LEDs, and the resonator is connected. So it isn't just two pins...
 
1. YOUR CASE:
Use a switches to toggle back and forth between the devices on the programming pins and the ICD jack. You will probably lose the ability to debug though through the ICD due to the fact that you all pins are being used during normal operation.

2. DEBUGGING:
Usually for debugging you use the debug pins which are multiplexed into the programming pins. But a lot of the time (on smaller chips for sure) the debug pins are multiplexed with serial interfaces which are used during normal operation. In that case, there are usually at least two alternative pins that can be used for debugging. These pins are left soley for that purpose and are permanently connected to the ICD jack. Then toggle switches are then used in the same way as the first paragraph (no harm is done when sending programming data to both programming/debug pins and the alternative debug pins).

Look at the schematic on the first page:
https://www.electro-tech-online.com/custompdfs/2007/01/93003A.pdf

The diagram shows case 2. Case 1 is the exact same thing except that there are no wires (permanent connections to the ICD jack) to the alternative, dedicated debug pins.

You can use two SPST switches if you want. I've found it difficult to locate DPDT DIP switches- at least from retailers. All the ones I have come as samples.
 
Last edited:
dknguyen said:
You can use two SPST switches if you want. I've found it difficult to locate DPDT DIP switches- at least from retailers. All the ones I have come as samples.

or use plain 'ol 3 pin headers and a shunt block - PIC pin to the center terminal, icsp line on one outer terminal, load on the other

@omar
if all that's connected to your pins are LEDS and resistors, then you shouldn't have a problem. a good programmer should be able to pull up an LED no problem. another thing to consider, are your pic pins sinking or sourcing the leds? if they're sinking, then a minor design change in your board layout should let you power just the PIC, without powering the rest of the board. this usually entails placing a diode between the pic's Vdd pin and the Vdd rail on the board. Your icsp connection of course would be on the pic side of the diode, where as the rest of the loads would be on the supply side. now your programmer only supplys power to the PIC, and the rest of the board is left dead.
 
If you are only building one or a few, use a chip with enough pins so you can dedicate the 3 needed by the ICSP to it. The time and effort you will save by not attempting to share the pins will more then offset the few dollars you would save by using a chip with fewer pins. Mouser has the PIC16F737-I/SP a 28 pin chip with 25 I/O lines for $4. The PIC16F628A-I/P is $2. How much work do you want to do to save 2 bucks?

This also results in a fully functional ICSP that you can use for debugging.

On the other hand if you already have the processors in front of you and getting ones with more pins would take too long..... never mind.

3v0
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top