0
\$\begingroup\$

I have jerry rigged a PIC programmer but I need to use the PGC/PGD pins as part of the actual circuit. I'd like to be able to flash the PIC without physically swapping it between the circuit and the programmer. Will this do the job?

CTL_ON,CTL_OFF (from the programmer) will be either 0,1 or 1,0 (never 1,1). CTRL_ON,CTRL_OFF will only change when the PIC is powered down. CTL_ON will only be 1 when RB4/PGM is high (i.e. PIC is being flashed). These rules will be handled in the programmer firmware.

Do I need resistors on the lines going into the T3 and T1 collectors? If so, can anyone explain why? I've spent a lot of time looking at web pages about this stuff, but can't quite seem to grasp the fundamentals. Pointers to any tutorials for beginners would be welcomed.

Note that this is not about isolating the power supply, that's already taken care of.

In this partial schematic, the RB7/PGD pin is just powering an LED for example, and can only be used as an output (when CTL_ON,CTL_OFF = 0,1), which is fine.

--update--

OK, so I guess I need a kind of switch which can be controlled by a separate signal from the programming device, like in the drawing below. Can anyone tell me how to implement such a thing? It needs to allow flow in both directions... Kind of like a relay, but for logic signals.

I think a bilateral switch is what I need, like this one:

http://www.ti.com/lit/ds/symlink/cd4066b.pdf

Right? Or is there a simpler way just using resistors, diodes and transistors?

\$\endgroup\$
  • \$\begingroup\$ Have you looked at tri-state buffers like 74126? \$\endgroup\$ – Icy Feb 4 '16 at 9:54
  • \$\begingroup\$ tri-state buffer looks like exactly what I want, but I only have transistors. Also, the PGD line is bi-directional when the PIC is being read/written, so I guess I'd need two, right? One for each direction? \$\endgroup\$ – Charlie Skilbeck Feb 4 '16 at 10:09
  • \$\begingroup\$ The fact that your programmer happens to be a arduino appears to be irrelevant. If so, you should edit out mention of arduino and replace with PIC programmer. That would make your question clearer, not distract from the real issue by bringing up arduino, and of course make it look like less of a adruino question. This is apparently not a adrweenie question after all, despite the initial impression from the first sentence. I have designed several PIC programmers and have things to say here, but not when that gets drowned out by the ardweenieness. \$\endgroup\$ – Olin Lathrop Feb 4 '16 at 12:21
  • \$\begingroup\$ Ah, good point, I'll edit, hang on \$\endgroup\$ – Charlie Skilbeck Feb 4 '16 at 12:26
  • 1
    \$\begingroup\$ Also is it really LEDs you're controlling from PGC / PGD or is that just an example? If it's just LEDs you could switch them with a FET so the lines don't get loaded and you don't care if they flicker during programming. \$\endgroup\$ – PeterJ Feb 4 '16 at 12:30
1
\$\begingroup\$

Short answer: your transistors are not right, and you don't really need the Arduino.

Option #1: The PGD pin will be tri-stated (made input) during programming. So the programmer will end up driving PGD as well as whatever is connected to it. Your programmer just might have enough current capacity to drive the load (LED) at low speeds, so you can go with just direct connection.

opt. 1

Option #2: Buffer the output from the PIC using a transistor so that the programmer sees a very light load. This has the side effect that the LED will flicker during programming, but I'd do it in the interest of simplicity.

enter image description here

P.S: In circuit editor was just way too slow so used pen and paper.

\$\endgroup\$
  • \$\begingroup\$ Thanks for this, I'm not sure I understand some of the things you're saying. - "You don't need the Arduino" - eh? I need it to program the PIC. I need the PGD pin to be an input or an output during programming - I can see now that my scheme completely fails in this respect. What is the capacitor connected via a dotted line (internally?) to PGD for? \$\endgroup\$ – Charlie Skilbeck Feb 4 '16 at 9:36
  • \$\begingroup\$ PGD has data coming from the programmer when PGM is asserted. The total load seen by the programmer on the PGD line is the internal capacitance of the PGD pin, and whatever external circuit you connect to it. \$\endgroup\$ – kabZX Feb 4 '16 at 9:42
  • \$\begingroup\$ But PGD might also have data coming from the PIC to the Arduino (when reading/verifying the PIC contents) \$\endgroup\$ – Charlie Skilbeck Feb 4 '16 at 9:44
  • \$\begingroup\$ I added some questions to the question - thanks for your time! \$\endgroup\$ – Charlie Skilbeck Feb 4 '16 at 9:44
  • \$\begingroup\$ Just to be clear, the Arduino is directly connected to the PIC, there is no other programmer involved... \$\endgroup\$ – Charlie Skilbeck Feb 4 '16 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.