Connect with us

Pic programmer

Discussion in 'Electronic Basics' started by Abstract Dissonance, Feb 27, 2006.

Scroll to continue with content
  1. I'm trying to make a pic programmer. Something like

    (which is also the software I'm using to program the pic)

    I understand the VPP part that supplies a regulated 12.7V to the VPP pin
    that is controlled through by a transistor from a parallel port pin(TxD) and
    how the 5V for the VDD is derived from it(through D2). I don't understand
    what the diodes D3-D6 are doing and what the resistors R1 and R2 are doing.
    Any ideas?

    After reading the programming specs for the 16F688 and 18F4X it seems pretty
    easy to program but I'm getting confused on the details. Do I have to limit
    the current going into the pins or can, say, I just hook up the pins
    directly? (there is something about latching though that has to do with
    those diodes D3-D6 but I don't know what this really is)

    I already built my regulated PS that gives me +12V(11.8V for some reason),
    5.2V, and +- Variable from 24V down to 1.25V. I was going to use that to
    power the MCU and use the parallel port to send the data but I'm not sure if
    I can hook it up "directly" or not. One problem I think I will have is that
    the voltage on my parallel port pints is only about 3.25V instead of 5V, not
    sure if this is enough for the clock and data.

    Could I just use 4 transistors, one on each pin I need and the Base being a
    pin from the parallel port?

    something like

    PP pin X
    \ R1
    / \
    V ---/ \---+-- MCU Pin Y
    \ R2

    Where V is 12 volts if MCU Pin Y is MCLR and 5V else.

    Would something like this work?

    Main thing I'm woried about is screwing up my pics(I only have 4) so I don't
    mind experimenting but I'm not exactly what I need to be careful about. I
    know that the pins are Low Z on output and Hi Z on input but is that enough
    to get by?

  2. Byron A Jeff

    Byron A Jeff Guest

    Which PIC?

    Note this programmer is specifically for EPROM based PICs. So
    "which PIC?" is a really important question.
    TxD is a serial port pin. This is a serial port programmer.
    You've probably picked a poor programmer for the job.

    The diodes are used
    to clamp voltages between 0 and 5 volts. The serial port can theoretically
    output upwards of 25V for outputs. In reality for a PC serial port
    you'll probably get somewhere between -5V and 5V or maybe even 0V and 5V.

    That's one reason that serial port programmers are a dicey proposition.
    There are simply no guarantees as to the specifications of the port

    OK. Now you've answered my question. Ditch this programmer and work on
    something a lot simpler. Since you thought this was a parallel port
    programmer, let me suggest one of my Trivial Programmers:

    The High Voltage Programmer will service all of your needs. And by design
    it's a lot simpler than the serial port programmer your are proposing to
    Clamping diodes. The PIC has internal ones but it's a bad idea to use
    them. If you plan on building that programmer, then keep those diodes
    in place.
    Not good. Technically the PIC Vpp voltage is supposed to be 13V. A lot
    of PIC chips will accept a Vpp as low as Vdd+3.5V. However, to be on
    the safe side, you should build a 13V supply.

    If you are using a LM7812 regulator you can get closer to the target by
    connecting the GND pin of the regulator to GND via a 1A diode. The
    diode will drop an addition 0.6V and raise the Vpp voltage to about 12.5V
    which is better.
    Oh. You have a variable. Set it to 13V and use it for Vpp.
    Yes you can. Be sure to connect the PC, PIC, and Power supply grounds together.
    Is your power supply fused? You should have an inline fuse just in case.
    Nope. This is the specific reason for the Trivial Programmers design. The
    74HCT573 octal latch serves as a 3.3V-5V level translator. The PIC needs
    a minimum of 4.0V (with a Vdd of 5V) in order to register a high signal.
    Yes. But a single HCT chip can accomplish the task much more easily.
    Yes. In fact the high voltage Trivial programmer has just about that
    same circuit for MCLR. But ICs have a much more compact package than
    individual transistors.
    Take a read of my page, then come back and talk about it. It'll get you going
    faster than you've been going so far.

    One addendum to the Trivial Programmer design. I've had troubles with long
    cables in the past. The currently posted design attempts an AC termination
    scheme using a cap and resistor to ground.

    One of my users figured out that all that's necessary to use a long cable is
    to ground the cable shield to ground using a small value capacitor. Take
    this into account if you plan to build a trivial programmer.

  3. yeah, I was just using it as an example. Basicaly with WinPic you can easily
    use the serial or parallel, the main difference being that the parallel port
    has more pins and and serial port has different(higher I guess) voltages.
    heh, well, I wasn't plan on making it but just trying to figure out what its
    trying to do.
    yeah. I think I was getting 14V from mine or something.... another thing is
    that, atleast I think, they can only provide about 25mA.
    ok. I happen to have some type of buffers like the

    SN74S241J---Octal Buffers and Line Drivers with TRI-STATE Outputs.pdf

    I hooked it up to my breadboard and ran some parallel port pins to it and
    tried it.

    On inputing of 3.2V I get out 3.8V's ;/

    I'm not sure how these work ;/ I thought buffers/drivers where suppose to
    "fix" the voltage so it would be the rail of the chip? (which is about 5V)

    I looked at the chip that you use and I don't see much of a difference(I
    tried the SN74ALS240AN too, same thing.).

    I mean, it seems to work but doesn't "fix" the voltage like I thought it
    would... like a schmitt trigger would?

    So is my chip any different? I can't seem to make to much sense of the data
    sheets as they don't really explain what it does... although I think I do
    understand it, its just not doing exactly what I expect(it does act like a
    "short" when I have the "latch" open(or maybe it was off) and High Z when it
    is "open".... but hte voltages are not fixed like a schmitt trigger).

    Sure, but I don't happen to have that chip availiable ;/ (I do happen to
    have a bunch of logic stuff that I got in a grab bag... might be able to
    find something that will work... lots of multiplexers, flip flops, and
    yeah, but I'm merely trying to get a pic programmed at the moment... just
    need to get something to work so I can get over the anxiety of screwing up
    the chip ;/ (cause unfortunately I don't have any way to "visualize" whats
    going on and it makes me worry alot that I might be screwing something up).
    well, if I have that problem I might just cut the cable in 2 and splice them
    back together to make it a little shorter.
    Is there any type of schmitt trigger like 3-State buffer that can be used
    for this? Or are these buffers schmitt triggered but I just happen to have
    one that is "fixing" it(whatever you call it) at 3.8V?


  4. What I mean by Schmitt Triggers is that ones that "rail" the voltage at 5V
    or so. I'm not sure if all digital logic IC's have schmitt triggers on
    there inputs to drive them better or not though. I tried some hex inverters
    and they upped the voltage from 3.2V to 4.2V so I was thinking I could use
    one of them to increase the voltage a little but seems like a waste to do it
    unless I have to(I tried to chain two and see if it would up the voltage
    past 5V but still gave me 4.2V.
  5. hmm, I have a CD74HCT14 which seems to give me about 5.06V(which is what my
    VCC is for the thing... not sure if this is coincidence or what) that I
    should be able to use in front of the 3-State to give more drive? What I'm
    confused on is that I've tried several logic devices and they all seem to
    give me varying voltage outputs which could be several volts below VCC... is
    this normal?
  6. I found a 74HCT125 which gives me about 4mV on low and 5.06V on high... much
    better than the other ones I have... maybe it is comparable to your
    74HCT573? I will try to use it and see what happens.


  7. It seems to work, I wrote some small code and programmed a pic and then read
    it back and it was the same code.... the circuit I used was basicaly exactly
    what you had except I didn't use the 1k resistor on the data line. Now I
    just have to write some code to do something so I can really test it. Much
    easier than I thought. Supprised it works ;)

  8. Byron A Jeff

    Byron A Jeff Guest

    [Summary on serial port: OP just wanted to know how it worked... BAJ]
    Nope. It's not HCT. And in this instance the family of the part is important.
    As you can see it's close but no cigar.
    Nope. Buffer/drivers are often about adding sufficient current to drive a line.
    The family is the import issue here. the HCT family is specified with TTL
    inputs (high is at 2.4V) and CMOS outputs, which are nearly rail to rail.
    Schmitt doesn't fix voltage. It has hysterisis so that you get clean edges
    out of junky input signals.

    [Clamping diodes snipped. Also supply info snipped too.]
    Yes it's different. See above explanation.
    You can use the 240 or 241 you have. You'll just have to put pullup resistors
    on the outputs so that the output is pulled to the rail. Since it's what you
    have in your grab bag, I'd suggest taking a stab at it.

    [transistor solution snipped]
    As long as you don't exceed the absolute ratings you'll be OK. That means
    nothing other outside of 0-5V to regular pins and 0-13V to MCLR. Also be
    sure to limit your current to any single pin to about 20mA.
    Grounding the shield with a cap is easier. I've spent a lot of time splicing
    to get smaller cables.
    Use pullup resistors on the output of your drivers. That will get the job done
    so you can program the parts.

  9. Byron A Jeff

    Byron A Jeff Guest

    That a family issue, not a Schmitt Trigger one. The HCT family is specifically
    designed to facilitate that type of level translation.

    As I posted in my other post, you can get away with adding pullup resistors
    on other families such as LS and ALS.

    What family was the inverters? 4.2V is sufficient. You can simply use the
    inverters to do the job. You just have to make sure that you invert all of
    the pins in your configuration of your programming software.

    One last thing. Make sure that you use the programming software debugging
    mode to test your pin configuration. An inverted pin description, a broken
    or missing wire, or a wiring misconfiguration will mess up your whole day.
    This is an instance that taking 10 minutes to ensure that you can wiggle
    all the programming pins with the correct voltage and polarity is well worth
    the effort.

  10. Byron A Jeff

    Byron A Jeff Guest

    BINGO! That's the winner. There's your level converter.
    What three state? You don't need a 3 state buffer to build a PIC programmer.
    Note on my page that while the HCT573 is a 3 state octal driver that the
    OE pin is wired so that the part is always driving. The 3 state portion of
    the part isn't used.

    You don't need to preface the hex inverters with anything. Wire the parallel
    port to the inputs of the HCT14, and wire the outputs of the HCT14 to the PIC
    pins. Of course there is the caveat of the resistor between the output of
    parallel port pin 2 and the PIC's RB7. This allows the PIC to drive the line
    going back to parallel port pin 10.

    Yes. TTL only specifies an output voltage of 2.4V to get a high signal. Only
    the HCT and HC parts, which have CMOS outputs, will guarantee output voltages
    of above 4V. The HCT part accepts TTL inputs. So it properly translates TTL
    inputs (which the parallel port is) into CMOS outputs (which the PIC needs).

    Go forth and wire your programmer.

    Good Luck.

  11. Byron A Jeff

    Byron A Jeff Guest

    Any HCT family part that's a simple buffer or inverter will do the job.
    So both the HCT14 (inverter) and the HCT125 (buffer) that you found will work.

    I'd suggest using the HCT14 because it's simpler to wire and it has enough
    gates (5) to completely wire. With the HCT125 you only get 4 gates and you have
    to wire each of the individual tristate controls.

  12. Byron A Jeff

    Byron A Jeff Guest

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day