pic programmer

Upload: sureshjayaraj

Post on 14-Apr-2018

318 views

Category:

Documents


2 download

TRANSCRIPT

  • 8/2/2019 PIC Programmer

    1/40

    PIC programmer - Help Index

    Short Description Features and supported devices

    System Requirements and Installation

    Main Window, Tool window,Interface settings, Device selection

    Configuration bits, Config Memory locations, ID locations

    The Options tab

    Normal Operation

    Batch Programming ("loop")

    Command Line Arguments

    Schematics for simple PIC programmers (COM84)

    Schematics for FLASH- and EPROM-based PIC programmer (COM84) PIC programmers for the parallel port

    Customizing WinPic to support other interfaces

    Production grade programmer

    Adapter for PIC10F20X

    Adapter for PIC12F629/675

    Adapter for PIC16F684

    Adapter for PIC16F87X

    Adapter for PIC18F2550/2455

    Adapter for dsPIC30F2010, PGD & PGC filtering

    Help - my PIC is not supported ! FAQ's (separate document - please read before sending email)

    Literature, PIC links

    Disclaimer

    THIS SOFTWARE IS CONSIDERED 'FREEWARE'. THIS

    SOFTWARE IS PROVIDED AS IS AND WITHOUT WARRANTY

    OF ANY KIND, EITHER EXPRESSED OR IMPLIED.

    In other words, THE ENTIRE RISK FOR THE USE OF THIS

    SOFTWARE IS WITH YOU.Permission is granted to use, modify, or redistribute this software so long

    as it is not sold or exploited for profit.

    Use this program as long as you keep in mind that this program is no

    professional software !

    Because this program is freeware, the entire risk of its use is with you.

    As usual, neither the author nor contributors will be liable for anything.

    http://www.qsl.net/dl4yhf/winpic/index.htm#shortdescrhttp://www.qsl.net/dl4yhf/winpic/index.htm#Featureshttp://www.qsl.net/dl4yhf/winpic/index.htm#Installationhttp://www.qsl.net/dl4yhf/winpic/index.htm#main_windowhttp://www.qsl.net/dl4yhf/winpic/index.htm#tool_windowhttp://www.qsl.net/dl4yhf/winpic/index.htm#Interface_settingshttp://www.qsl.net/dl4yhf/winpic/index.htm#device_confighttp://www.qsl.net/dl4yhf/winpic/index.htm#config_bitshttp://www.qsl.net/dl4yhf/winpic/index.htm#id_locationshttp://www.qsl.net/dl4yhf/winpic/index.htm#optionshttp://www.qsl.net/dl4yhf/winpic/index.htm#operationhttp://www.qsl.net/dl4yhf/winpic/index.htm#batch_programminghttp://www.qsl.net/dl4yhf/winpic/index.htm#cmd_line_argumentshttp://www.qsl.net/dl4yhf/winpic/index.htm#simple_proghttp://www.qsl.net/dl4yhf/winpic/index.htm#eprom_proghttp://www.qsl.net/dl4yhf/winpic/index.htm#lpt_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#custom_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#production_grade_programmerhttp://www.qsl.net/dl4yhf/winpic/index.htm#PIC10F20xhttp://www.qsl.net/dl4yhf/winpic/index.htm#adapt12f675http://www.qsl.net/dl4yhf/winpic/index.htm#adapt16f684http://www.qsl.net/dl4yhf/winpic/index.htm#adapt16F87xhttp://www.qsl.net/dl4yhf/winpic/index.htm#adapt_18F2x5xhttp://www.qsl.net/dl4yhf/winpic/index.htm#adapt_dsPIC30F201xhttp://www.qsl.net/dl4yhf/winpic/index.htm#pgd_pgc_filteringhttp://www.qsl.net/dl4yhf/winpic/index.htm#unsupported_picshttp://www.qsl.net/dl4yhf/winpic/winpic_faq.htmhttp://www.qsl.net/dl4yhf/winpic/index.htm#pic_linkshttp://www.qsl.net/dl4yhf/winpic/index.htm#shortdescrhttp://www.qsl.net/dl4yhf/winpic/index.htm#Featureshttp://www.qsl.net/dl4yhf/winpic/index.htm#Installationhttp://www.qsl.net/dl4yhf/winpic/index.htm#main_windowhttp://www.qsl.net/dl4yhf/winpic/index.htm#tool_windowhttp://www.qsl.net/dl4yhf/winpic/index.htm#Interface_settingshttp://www.qsl.net/dl4yhf/winpic/index.htm#device_confighttp://www.qsl.net/dl4yhf/winpic/index.htm#config_bitshttp://www.qsl.net/dl4yhf/winpic/index.htm#id_locationshttp://www.qsl.net/dl4yhf/winpic/index.htm#optionshttp://www.qsl.net/dl4yhf/winpic/index.htm#operationhttp://www.qsl.net/dl4yhf/winpic/index.htm#batch_programminghttp://www.qsl.net/dl4yhf/winpic/index.htm#cmd_line_argumentshttp://www.qsl.net/dl4yhf/winpic/index.htm#simple_proghttp://www.qsl.net/dl4yhf/winpic/index.htm#eprom_proghttp://www.qsl.net/dl4yhf/winpic/index.htm#lpt_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#custom_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#production_grade_programmerhttp://www.qsl.net/dl4yhf/winpic/index.htm#PIC10F20xhttp://www.qsl.net/dl4yhf/winpic/index.htm#adapt12f675http://www.qsl.net/dl4yhf/winpic/index.htm#adapt16f684http://www.qsl.net/dl4yhf/winpic/index.htm#adapt16F87xhttp://www.qsl.net/dl4yhf/winpic/index.htm#adapt_18F2x5xhttp://www.qsl.net/dl4yhf/winpic/index.htm#adapt_dsPIC30F201xhttp://www.qsl.net/dl4yhf/winpic/index.htm#pgd_pgc_filteringhttp://www.qsl.net/dl4yhf/winpic/index.htm#unsupported_picshttp://www.qsl.net/dl4yhf/winpic/winpic_faq.htmhttp://www.qsl.net/dl4yhf/winpic/index.htm#pic_links
  • 8/2/2019 PIC Programmer

    2/40

    This also applies to the schematic diagrams presented in this document,

    and in "the software" itself.

    A missing copyright note in these documents does not indicate "no

    copyright" for names of products or companies mentioned here.

    If you like to read more of this legal stuff, look into the README file in

    WinPic's main directory.

    contents

    Short Description

    PICs are single-chip microcontrollers which can be used for many purposes.

    WinPic can program some of these devices, using a simple piece of hardware

    connected to the serial port (COM1..COM4) or the parallel port (LPT1 or

    LPT2) of a PC. There once was a simple DOS-program called "PIP-02" to dothis, but that program did not work properly on my PC under windows so I

    wrote my own. Thanks to my contributors, WinPic now supports a large variety

    of PICs with different programming algorithms. Programmable devices are

    listed on the Features page.

    Note that most programming adapters supported by WinPic do not meet

    Microchip's requirements for a "production grade" programmer. If you think

    you need a production grade programmer (which can verify the PIC at different

    voltages), lookhere.

    WinPic lets you ...

    program a HEX-file into a PIC microcontroller

    read the contents of a PIC and save it as a HEX file

    read and modify the configuration word(s) of the PIC

    Keep in mind that this program is still far from being "professional" software !

    Last not least because this program is freeware, the entire risk of its use is with

    you - read the disclaimerif you haven't yet.

    Check for an update on the author's homepage.Note: Meanwhile there are other programs called "WinPic" on the web. If you look for an

    update, search the net for "WinPic" AND "DL4YHF" to find this one !

    Program : WinPic - a PIC programmer for Windows

    Revision Date: 2006-11-02 (YYYY-MM-DD)

    Author: Wolfgang Buescher (DL4YHF) and contributors, see "About"-box

    http://www.qsl.net/dl4yhf/readme.txthttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#Featureshttp://www.qsl.net/dl4yhf/winpic/index.htm#production_grade_programmerhttp://www.qsl.net/dl4yhf/winpic/index.htm#disclaimerhttp://www.qsl.net/dl4yhf/readme.txthttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#Featureshttp://www.qsl.net/dl4yhf/winpic/index.htm#production_grade_programmerhttp://www.qsl.net/dl4yhf/winpic/index.htm#disclaimer
  • 8/2/2019 PIC Programmer

    3/40

    Sourcecode: available on the author's homepage

    Homepage: see links at the end of this document

    Email: can be found on the homepage (subject to change / spambots keep off !)

    Contents

    Features and supported devices

    The program requires a simple programming interface for the serial port. For

    FLASH-based PICs like the 16F84, the hardware is very simple, for EPROM-

    based devices like the 16C61 two additional transistors are required.

    Supported devices are (AT LEAST...) :

    PIC16C84, PIC16F84 PIC16C61, PIC16C71

    PIC16C710, PIC16C711

    PIC10F200/202/204/206 (PIC10F206 tested)

    PIC12F629, PIC12F635, PIC12F675, PIC12F683

    PIC12F609, PIC12F615, PIC16F610, PIC16F616 (thanks Andrew !)

    PIC16F627, PIC16F627A, PIC16F628, PIC16F628A (tested)

    PIC16F630, PIC16F636, PIC16F648A

    PIC16F676, PIC16F684, PIC16F688

    PIC16F73, PIC16F737, PIC16F74, PIC16F76, PIC16F77

    PIC16F818, PIC16F819 PIC16F87, PIC16F88 (87 not tested)

    PIC16F873A...PIC16F877A (873A tested)

    PIC16F88

    PIC18Fxxxx (many devices tested - see FAQ list - please read the note

    on PGC & PGD filtering if your interface doesn't seem to work with

    PIC18F's).

    dsPIC30F2010 -- dsPIC30F6010 (tested) and other dsPIC30F's (not

    tested due to lack of samples)

    And: there is a trick to program other PICs too..

    and other devices can be added by modifying the file DEVICES.INI .

    WARNING ! The specification for EPROM-based PICs requires a precise

    timing which is hard to realize under Windows. Don't let other programs

    run in the background when programming EPROM-based PICs (16C7xx),

    and use the fastest PC available. This reduces the risk that windows takes

    the CPU away for other tasks too long, but is no real cure.

    http://www.qsl.net/dl4yhf/winpic/index.htm#my_homepagehttp://www.qsl.net/dl4yhf/winpic/index.htm#my_homepagehttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/winpic_faq.htm#PIC18Fhttp://www.qsl.net/dl4yhf/winpic/index.htm#pgd_pgc_filteringhttp://www.qsl.net/dl4yhf/winpic/index.htm#unsupported_picshttp://www.qsl.net/dl4yhf/winpic/index.htm#devices_inihttp://www.qsl.net/dl4yhf/winpic/index.htm#my_homepagehttp://www.qsl.net/dl4yhf/winpic/index.htm#my_homepagehttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/winpic_faq.htm#PIC18Fhttp://www.qsl.net/dl4yhf/winpic/index.htm#pgd_pgc_filteringhttp://www.qsl.net/dl4yhf/winpic/index.htm#unsupported_picshttp://www.qsl.net/dl4yhf/winpic/index.htm#devices_ini
  • 8/2/2019 PIC Programmer

    4/40

    If you don't find "your" PIC in the list of supported devices, you may add

    support for it as described here .

    Contents

    System Requirements and Installation

    You will need the following to use "WinPic":

    a PC with Win95, Win98, NT 4.0 or Win XP (not sure about ME and

    Win2000)

    a very simple piece of hardware

    a serial interface likes COM1 or COM2 (etc) if you use a COM84-

    compatible, or "JDM"-programmer

    or a parallel interface like LPT1 or LPT2 if your programmer is

    connected to theparallel port

    For interfaces on the LPT port, you need the files PORTTALK.SYS or

    SMPORT.SYS and SMPORT.VXD (depending on the OS used) in the

    system directory or the current directory. Under Win95 or Win98,

    WinPic will work with no port access driver at all (see Options).

    To run WinPic under Win XP with user privileges (not admin), use an

    interface for the serial port, or (if you do need an interface on the LPT

    port), read this document about how to install the PortTalk driver

    permanently.

    If you have an interface which is not directly supported : the programmer can

    be customized for other programming adapters via INI-file.

    Since WinPic is now distributed with an automatic installer, you simply select

    where it shall be installed (after reading and agreeing to the disclaimer). After

    installation, you should see the following files :

    ?\WinPic\devices\*.dev ....... subdirectory with device definitions

    borrowed from MPLAB

    ?\WinPic\html\*.* ............ WinPic's online manual in HTML format

    ?\WinPic\interfaces\*.ini .... custom interface definitions

    ("programmers")

    ?\WinPic\translations\*.txt... translations of the WinPic GUI into

    other languages

    ?\WinPic\WinPic.exe .......... the executable

    ?\WinPic\smport.sys,smport.vxd, porttalk.sys ..... the optional port

    access drivers(*)

    ?\WinPic\devices.ini ........ file telling WinPic how to program some

    new PIC devices

    http://www.qsl.net/dl4yhf/winpic/index.htm#unsupported_picshttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#simple_proghttp://www.qsl.net/dl4yhf/winpic/index.htm#simple_proghttp://www.qsl.net/dl4yhf/winpic/index.htm#lpt_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#port_accesshttp://www.qsl.net/dl4yhf/winpic/install_porttalk.htmhttp://www.qsl.net/dl4yhf/winpic/index.htm#custom_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#custom_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#note_on_port_drivershttp://www.qsl.net/dl4yhf/winpic/index.htm#unsupported_picshttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#simple_proghttp://www.qsl.net/dl4yhf/winpic/index.htm#simple_proghttp://www.qsl.net/dl4yhf/winpic/index.htm#lpt_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#port_accesshttp://www.qsl.net/dl4yhf/winpic/install_porttalk.htmhttp://www.qsl.net/dl4yhf/winpic/index.htm#custom_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#custom_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#note_on_port_drivers
  • 8/2/2019 PIC Programmer

    5/40

    ?\WinPic\readme.txt ......... disclaimer, short info, revision history

    (*) earlier versions of WinPic did not work with the port drivers.

    Click here for details.

    A few other notes about the installation and translations can be found in thefile README.TXT. In case of trouble, please read the FAQ list.

    If you get some strange error messages when trying to start the program for the

    first time (perhaps missing DLLs), check the author's homepagefor more

    information.

    If you use WinPic to program PIC18F or dsPICs, read this chapter in the

    FAQ's - it shows you how to tweak WinPic for maximum speed for "simple"

    PIC programmers (works best with the PortTalk driver). To use PortTalk

    without an administrator account under Windows XP, you can install PortTalkpermanently on your system as explained here.

    Contents

    Main Window

    The main window of the Pic Programmer consists of several tabsheets:

    http://www.qsl.net/dl4yhf/winpic/index.htm#port_accesshttp://www.qsl.net/dl4yhf/readme.txthttp://www.qsl.net/dl4yhf/winpic/winpic_faq.htmhttp://www.qsl.net/dl4yhf/winpic/index.htm#my_homepagehttp://www.qsl.net/dl4yhf/winpic/index.htm#my_homepagehttp://www.qsl.net/dl4yhf/winpic/winpic_faq.htm#make_winpic_fasterhttp://www.qsl.net/dl4yhf/winpic/winpic_faq.htm#make_winpic_fasterhttp://www.qsl.net/dl4yhf/winpic/install_porttalk.htmhttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#port_accesshttp://www.qsl.net/dl4yhf/readme.txthttp://www.qsl.net/dl4yhf/winpic/winpic_faq.htmhttp://www.qsl.net/dl4yhf/winpic/index.htm#my_homepagehttp://www.qsl.net/dl4yhf/winpic/winpic_faq.htm#make_winpic_fasterhttp://www.qsl.net/dl4yhf/winpic/winpic_faq.htm#make_winpic_fasterhttp://www.qsl.net/dl4yhf/winpic/install_porttalk.htmhttp://www.qsl.net/dl4yhf/winpic/index.htm#top
  • 8/2/2019 PIC Programmer

    6/40

    Code:

    Shows the program memory of the PIC's "program code" as hex dump.

    All used words are marked green, locations where verify or

    programming errors occurred are marked red. Unused locations (in the

    hex file) are marked gray.

    For special applications, you can edit the hex data after selecting

    "Edit...Enable Hex Editor" from the main menu. To transfer the edited

    hex values back into the code buffer, select "Apply edits" in the menu.

    This is only intended for small code patches, if you are sure what you are

    doing !

    Data:

    Hex dump of the PIC's internal data EEPROM (if present). The initial

    data for the data EEPROM can also be contained in a HEX file.

    The hexadecimal dump can also be edited (for special purposes) as

    described for the code memory.

    Device,Config:

    Lets you select the PIC type and change the configuration word.

    ID locations (now called "Configuration Memory"):

    Shows the contents of the user ID locations and the PIC Device ID word,

    and -optionally- the contents of some other cells in the configuration

    memory area. You can edit these locations manually, but it's better to

    embed ID information in a hex file. Unlike the code memory, the ID

    locations can always be read out even if the PIC is code protected.

    Options:

    On this tab sheet, you can modify the behaviour of the programmer (butnot the PIC itself).

    Interface:

    Define here what kind of interface you are using and how it is connected.

    Also has some features to test the programmer interface.

    Messages:

    All error messages from the programmer are listed in this window in

    order of their appearence. The last important message will be displayed

    in the status line on the bottom of the main window.

    Contents

    The "Tool" Window

    If you use WinPic for programming with an integrated development system

    (like MPLAB), and frequently program your PIC for testing purposes, use the

    small tool window. It remains open on top of any window, even if it doesn't

    http://www.qsl.net/dl4yhf/winpic/index.htm#device_confighttp://www.qsl.net/dl4yhf/winpic/index.htm#id_locationshttp://www.qsl.net/dl4yhf/winpic/index.htm#optionshttp://www.qsl.net/dl4yhf/winpic/index.htm#Interface_settingshttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#device_confighttp://www.qsl.net/dl4yhf/winpic/index.htm#id_locationshttp://www.qsl.net/dl4yhf/winpic/index.htm#optionshttp://www.qsl.net/dl4yhf/winpic/index.htm#Interface_settingshttp://www.qsl.net/dl4yhf/winpic/index.htm#top
  • 8/2/2019 PIC Programmer

    7/40

    have the focus, and even if WinPic's main window is minimized. You can

    reload the new file and program it with a single mouseclick on the "Reload &

    Program"-button. The name is the last file you selected for loading from

    WinPic's file menu. The filename is shown below the button.

    To open the Tool window, select "Tools"..."Show Tool Window" fromthe main window. To switch back to the main window, use the ">>" button in

    the lower right corner.

    During programming, a progress indicator and the current status is also

    displayed in the tool window. If programming is finished successfully, the tool

    window turns green, in case of errors it turns red.

    Contents

    Operation

    This is the usual operation sequence in interactive mode (for command-line

    mode, see anotherchapter):

    1. Start the programmer (and, if required, connect a 13V-power supply)

    2. Select the device type if necessary (because different PICs require

    different programming algorithms)

    3. Load a HEX-file with "File..Load"

    4. Insert a PIC in your programmer

    5. Program the PIC with "Device..Program"

    You don't have to erase the PIC before programming, the software will do that

    automatically.

    The software will always show the success or errors of all actions. If there is an

    error message in the status line at the bottom of the programmer's window,

    change to the "message"-tab where you see a complete list of all errors (with

    more infos about the cause of the error, etc).

    Also the configuration word and the initial DATA EEPROM will be

    programmed, if the HEX-file you loaded contains data in the equivalent

    memory ranges. For more information look into Microchip's data sheets.

    http://www.qsl.net/dl4yhf/winpic/index.htm#main_windowhttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#cmd_line_argumentshttp://www.qsl.net/dl4yhf/winpic/index.htm#device_confighttp://www.qsl.net/dl4yhf/winpic/index.htm#main_windowhttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#cmd_line_argumentshttp://www.qsl.net/dl4yhf/winpic/index.htm#device_config
  • 8/2/2019 PIC Programmer

    8/40

    You can terminate the programming loop anytime by pressing the ESCAPE

    key - this may save a few seconds if you discover you have not inserted a PIC

    in the socket.

    After programming, reading, or successfully verifying the PIC device, the

    programmer (or ICSP-adapter) can be completely disconnected from the targetfor test code runs. You need an interface like Johan Bodin's "PIP-84 V2" which

    has additional hardware to disconnect all lines between the PC (parallel port)

    and the target device. The "disconnect control signal" is D7 on the LPT port,

    explained in the appendix.

    Contents

    Batch Programming ("loop")

    To program a whole bunch of devices with the same data, load a hex file once,

    then select "Tools" ... "Start Batch Programming" from WinPic's main menu.

    Once in this mode, the following steps are repeated over and over until you

    stop the batch mode (by pressing ESCAPE or via menu).

    1. The program will ask you to insert the next device to be programmed, or

    connect the ICSP (in-circuit serial programming) adapter to the target.

    2. When ready, press the "Enter" key on the PC keyboard or (if exists) a

    pushbutton on your programming adapter. Programming will start then,

    taking a few seconds.

    3. After programming, a green LED on the interface means "success", red

    LED means "error". WinPic will go back to step one.

    If LEDs show "error", it's your decision to try again or do something else

    (try bulk erase, etc).

    Note:

    A pushbutton on the programmer and the two LEDs are only available

    on certain programming interfaces for the parallel port.

    Contents

    Command Line Arguments

    You may call WinPic from a batch file, or an integrated development

    environment to do an automated job without any user intervention. For

    http://www.qsl.net/dl4yhf/winpic/index.htm#johan_bodinhttp://www.qsl.net/dl4yhf/winpic/index.htm#icsp_disconnect_controlhttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#johan_bodinhttp://www.qsl.net/dl4yhf/winpic/index.htm#icsp_disconnect_controlhttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#top
  • 8/2/2019 PIC Programmer

    9/40

    example, you can tell WinPic to load a program from a hexfile, write it into the

    target device, and terminate itself afterwards.

    The following list shows all command line parameters which are accepted:

    considered a file name.

    If the command line contains a /p command ("program)", this file will be

    loaded into a buffer. If the file cannot be loaded, the evaluation of the

    command line is cancelled immediately; you can try to load the file

    "manually" then.

    If the command line contains a /r command ("read"), this is the name of

    the produced hex file.

    If there is only a filename specified in the command line, but none of the

    following "switches", the specified file will be loaded into WinPic's

    buffer automatically but not programmed into the device./p

    program the buffer contents into the connected device

    /e

    erase chip. Not necessary to use this command together with the

    'program' option because 'p' will automatically erase if necessary.

    /r

    read the contents of the device and dump them into the specified HEX

    file

    /v

    Verify. Compares the contents of the device with the specified HEX file.

    Can be used as an "extra" verification together with the /p command, but

    this is usually not required because the programming algorithms for most

    PICs include verifying.

    /q

    terminates WinPic. Should be the last argument, if you want to terminate

    WinPic after the job is done automatically. Without this command, you

    must close WinPic manually, even when running in command-linemode.

    /q=5

    also terminates WinPic, but waits for 5 seconds before quitting so you

    will have the chance to look at any output in the message window.

    /nodelay

  • 8/2/2019 PIC Programmer

    10/40

    Usually, when command-line driven operation is active, the program

    waits for a few seconds until "the action starts". This can rescue a chip,

    because it allows you to terminate the erase-programming operation if

    you have started the wrong batchfile by mistake, etc.

    With the /nodelay option, there will be no pause before the execution of

    the command line starts.

    /overwrite

    With this option, WinPic won't ask before overwriting an already

    existing disk file. Use it together with the /r command if necessary.

    /device=XXXX

    Selects a new device type (to override the device used in the last WinPic

    session). Example: /device=PIC16F628 . No space characters are

    allowed in here !

    /config_word=XXXX

    Overrides the configuration word from any loaded hex file. The

    parameter XXXX is as a four-digit hexadecimal value.

    Note: The sequence is no longer important(this was different in older releases

    of WinPic, where the file name had to be specified before the "/p"-command

    etc).

    The command-line driven operation can be cancelled by pressing ESCAPE.

    The main menu will be enabled anyway. Selecting certain menu items also

    cancels evaluating the command line.

    Some commandline examples:

    winpic keyer1.hex /p /q

    Loads the file KEYER1.HEX, programs it into the connected device,

    and terminates WinPic ("quit").winpic /nodelay c:\pic\my_src\keyer1.hex /p /q

    Almost the same, with full path to the hexfile, and a bit faster without the

    3-second-pause during which the ESCAPE key is polled.winpic /overwrite /r "readout.hex" /q

    Reads the contents, dumps the program to the file "readout.hex" (andoverwrites the old file without asking). Terminates automatically.

    Contents

    Interface settings

    http://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#top
  • 8/2/2019 PIC Programmer

    11/40

    The interface type must be set once after program installation, then forget about

    it - because WinPicPr saves the interface type (along with other settings) in an

    INI file. You can select the interface type from a list on the "Interface" sheet.

    Depending on the interface type, you may also select COM1..COM4 or

    LPT1..LPT2 (see notes on the LPT port in the appendix). The default interfacetype is the "COM84" interface which is connected to the serial port. If you have

    a (simple) programmer for the parallel port which is not listed, you can add

    support for your own interface by adding a few lines to the SETTINGS.INI

    files as described in the appendix.

    Note: For interface on the LPT port, WinPic must use one of theport access

    drivers (SMPORT or PortTalk). Since November 2006, it does not need such a

    port driver for the serial port. In fact, WinPic may work with USBRS-232

    converters, too.

    The programmer does a crude "interface test" at program start to check if the

    interface is installed. This is done simply by setting the 'data output'

    and reading back the signal from the 'data input' (while the Vdd

    voltage turned on for a short while). If an error is reported, either the

    interface is not connected properly, or power turned off, or wrong

    port selected.

    To solve interface problems, there is a simple 'Interface Test' option

    available where you can control all signals yourself by setting or

    clearing the checkmarks "Vpp", "Vdd", "Clock", "Data" (etc) andcheck the voltages. The actual state of the "Data In" line (from PIC to

    PC) is displayed as "Data In = X", where X resembles the logical state of the

    PIC's RB7 pin (it may be inverted by the programmer hardware).

    Signals not supported by the selected programmer appear disabled in the

    checkmarks (for example, "Clock Enable" and "Data Enable" which are only

    used in Microchip's "AN589" programmer).

    A crude interface test can be performed by clicking the "Initialize !" button on

    the Interface sheet. The result of the interface test can be viewed on the

    Messages sheet (the last message is displayed in the status line, clicking it will

    switch to the Message sheet with an error history).

    A note on serial interfaces:

    USB->RS-232 adapters only work when the option "no direct port

    access, only use Windows API" is set (on WinPic's "Options" tab, on the

    "I/O Port Access Driver" tab). Some cheap USBRS232 adapters

    http://www.qsl.net/dl4yhf/winpic/index.htm#lpt_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#custom_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#custom_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#port_accesshttp://www.qsl.net/dl4yhf/winpic/index.htm#port_accesshttp://www.qsl.net/dl4yhf/winpic/index.htm#lpt_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#custom_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#custom_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#port_accesshttp://www.qsl.net/dl4yhf/winpic/index.htm#port_access
  • 8/2/2019 PIC Programmer

    12/40

    didn't seem to work with WinPic because they don't handle some

    handshake signals correctly :-(

    Furthermore, if the PC has a "real" serial port but the I/O-address is not the

    standard value, you can double-click into the edit field "Addr", and enter the

    I/O address in hexadecimal form. Caution: Entering the wrong value here can

    seriously damage your PC, so make sure you enter the right address for the

    right COM port number (you can find out your COM-port's I/O-address in the

    system control panel).

    Some of the interfaces which are supported by WinPic are:

    COM84 - a simple programmer for the serial port, originally designed to

    program PIC16C84 and 16F84. Usually requires an extra power supply

    because the voltages from the serial port are often not sufficient to

    switch the PIC into programming mode. Two examples for COM84-

    compatible PIC programmers follow in the next chapters.

    "JDM PIC-programmer 2" - uses the same control lines as "COM84",

    but has a tricky way to eliminate the external supply. Instead, the PIC's

    ground pin is held on a negative level (-5V) against the PC's ground,

    while the PIC Vdd pin (usually +5V) is connected to the PC's ground. I

    wouldn't use it as an "in-circuit programmer" because of the different

    ground levels.

    Note: Do not connect RB4 to the PIC's Vdd pin if you want to program a

    PIC16F628 (and others) with the JDM programmer !

    "Tait style" - several possibilities for programmers connected to the LPT

    port. Caution: recent reports (2005) seem to indicate a problem with the

    Tait interfaces, so beware .. there may be something wrong with the

    support for some of these interfaces.

    Microchip "AN 589" - the grandfather of the simple PIC programmers

    (which don't need a programmed PIC to program PIC's ;-)

    SM6LKM's PIP-84 programmers : See appendix, "PIC programmers for

    the LPT port" .

    Velleman K8048 (select "Custom interface on COM port", then select

    definition file "velleman_k8048.ini")

    Martin Clausen's PICProg (use "Custom interface on LPT port", thenselect definition file "Clausen_PICProgOnLpt.ini")

    M.Covington's NOPPP programmer (use "Custom interface on LPT

    port", then load "NOPPP_Interface.ini")

    http://www.qsl.net/dl4yhf/winpic/index.htm#lpt_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#lpt_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#lpt_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#lpt_interfaces
  • 8/2/2019 PIC Programmer

    13/40

    To tweak WinPic for maximum speed, you may try to optimize the following

    parameters on the Interface tab (the default settings are reasonably slow and

    reliable):

    extra delay before reading data line

    Time in microseconds before WinPic samples the data-in line. extra lengthening for clock pulses

    Time in microseconds inserted after every falling or rising edge of the

    serial clock signal.

    These additional delays can be used for "slow" interfaces, especially when the

    PortTalk driver is used instead of SMPORT. More details on that here.

    Contents

    A simple 'serial' programmer for FLASH-based PICs

    This is a schematic diagram for a simple "COM84-compatible" PIC

    programmer on the serial port (COM1 or COM2). Check the voltage at the

    serial interface before deciding to build this extremely simple programmer. The

    'voltage boost' via R5 may be required if the 'high-'voltage at the TXD pin is

    too low. If you need a circuit which also programs EPROM-based PICs,

    lookhere. If you need a circuit which works without extra supply (under all

    conditions), try the JDM programmer type 2 (TWO! ... search the net for "JDM

    PIC-programmer 2" to find the schematics; it is supported by WinPic too, and-unlike other "simple's"- the JDM 2 works for PIC18Fxxx and even dsPICs.)

    This 'very simple' programmer is only for certain FLASH-based PICs. I

    strongly recommend notto use it, however ... :

    http://www.qsl.net/dl4yhf/winpic/index.htm#port_accesshttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#eprom_proghttp://www.qsl.net/dl4yhf/winpic/index.htm#port_accesshttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#eprom_prog
  • 8/2/2019 PIC Programmer

    14/40

    The disadvantage of this programmer is the programming voltage (whichshould be about 12.7V on pin 4 of a PIC16F84) taken directly from the serial

    interface. Some interfaces only put out about +8V maximum, and that is

    definitely too low for programming. You may try to connect R5 and an

    "auxiliary" 12V source to boost the programming voltage a litte. The "next

    better programmer" uses two switching transistors for the programming

    voltage. To program 8-pin-PICs like the 12F675 you need an adapteror an

    extra socket on the board.

    The clamping diodes D3, D4, D5, D6 limit the voltage from the RS-232

    interface to avoid latch-up of the PIC. There are some other "extra simple"circuits out there which do not use any protection for the PIC, but you should

    invest a few pennies/cents for these diodes. The BAT42 can be replaced by a

    lot of similar schottky diodes. A schottky diode is better here than the usual

    "1N4148" because its forward voltage is less than 500mV so we know the

    'limiting' current flows through the diodes, not through the precious PIC !

    When tested with a 16F877 (and an adapter socket), this interface failed, while

    programming an old-fashioned 16F84 worked. This is whyI strongly

    recommend to use the programmer described in the next chapter, or an even

    better one...

    Some notes on "AllPic2"

    Some years ago, a programmer called "AllPic2" (or "AllPic02") appeared in

    several magazines. It is compatible to "COM84", and to the two interfaces

    shown in this document, but very often you will find it has :

    http://www.qsl.net/dl4yhf/winpic/index.htm#eprom_proghttp://www.qsl.net/dl4yhf/winpic/index.htm#eprom_proghttp://www.qsl.net/dl4yhf/winpic/index.htm#adapt12f675http://www.qsl.net/dl4yhf/winpic/index.htm#eprom_proghttp://www.qsl.net/dl4yhf/winpic/index.htm#eprom_proghttp://www.qsl.net/dl4yhf/winpic/index.htm#adapt12f675
  • 8/2/2019 PIC Programmer

    15/40

    bad clamping diodes

    clamping diodes connected to +Vpp (12V) instead of +Vdd (5V)

    Too large capacitor C1 (22uF), reduce this to 2.2 or 4.7uF, and connect a

    series resistor of 220 Ohm to collector of "Q4" (transistor to stabilize

    Vdd). Whithout this modifcation, the voltage at Vpp(!) rises too slowly

    which causes problems because the PIC executes code before switching

    into programming mode ! The same problem exists in other "ultra

    simple" programmers where Vpp just cannot rise fast enough. See also:

    Notes on "AllPic" in readme.txt (in WinPic's main directory).

    Contents

    A programmer for FLASH- and EPROM-based PICs

    To program EPROM-based PICs (like the 16C61/16C71), use this interfacewhich delivers more current into 'Vpp' (programming voltage, applied to

    'MCLR' = PIN 4 of most 18-pin PICs):

    If a precise (regulated) 12.7 V DC power supply is available, the voltage

    regulator (78L12, with D7, C2..C3) is not needed.

    The function of the clamping diodes (D3..D6) is explained somewhere else.

    http://www.qsl.net/dl4yhf/readme.txthttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#clamping_diodeshttp://www.qsl.net/dl4yhf/readme.txthttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#clamping_diodes
  • 8/2/2019 PIC Programmer

    16/40

    To program 8-pin-PICs like the 12F675 you need an adapteror an extra socket

    on the board.

    To program some 28-pin PICs like the 16F876 you need another adapter,

    and yet another adapterfor the 28-pin dsPIC family.

    If you experience problems with dsPIC30Fxxxx, PIC18Fxxxx, or otherunexplainable problems which seem to be related to the length of the interface

    cable, read this important note on PGD & PGC filtering (avoid coupling

    between clock- and data line).

    See also: PIC programmers for the parallel port

    Contents

    Selecting the Device and setting the configuration bits

    The tab sheet "Device, Config" is used to select a PIC device and modify the

    configuration word. It is highly recommended to embed the configuration word

    in the HEX file (so you don't have to set the proper config word yourself), but

    you may want to check or modify the configuration word yourself after loading

    the HEX file.

    In the combo box labelled "Part:", you select the PIC device which shall be

    programmed.

    Note:

    The upper part of this list contains devices which are build-in

    ("hardcoded") into WinPic, the second part after the "unknown" PIC

    dummy are user-defined devices which are loaded from the file

    DEVICES.INI. Some devices may appear twice: The first from the

    "built-in" definition, the second uses the programming parameters

    loaded from DEVICES.INI which you can modify yourself to add

    support for "new" devices. Device definitions in DEVICES.INI always

    override the definitions in the internal (built-in) list.

    The contents of the table of configuration bits depend on the selected device

    type, and on the device definition file. Only for "old" devices (PIC16F family),

    WinPic contains built-in configuration bit definitions. For newer chips,

    especially the PIC18F and dsPIC30F family, the configuration bit info should

    be read from one of Microchip's device definition files (*.dev). WinPic expects

    the DEV-files in a certain directory - see this textfile for more information. The

    http://www.qsl.net/dl4yhf/winpic/index.htm#adapt12f675http://www.qsl.net/dl4yhf/winpic/index.htm#adapt16F87xhttp://www.qsl.net/dl4yhf/winpic/index.htm#adapt_dsPIC30F201xhttp://www.qsl.net/dl4yhf/winpic/index.htm#pgd_pgc_filteringhttp://www.qsl.net/dl4yhf/winpic/index.htm#lpt_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#devices_inihttp://www.qsl.net/dl4yhf/devices/readme_dev.txthttp://www.qsl.net/dl4yhf/winpic/index.htm#adapt12f675http://www.qsl.net/dl4yhf/winpic/index.htm#adapt16F87xhttp://www.qsl.net/dl4yhf/winpic/index.htm#adapt_dsPIC30F201xhttp://www.qsl.net/dl4yhf/winpic/index.htm#pgd_pgc_filteringhttp://www.qsl.net/dl4yhf/winpic/index.htm#lpt_interfaceshttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#devices_inihttp://www.qsl.net/dl4yhf/devices/readme_dev.txt
  • 8/2/2019 PIC Programmer

    17/40

    DEV-files are Microchip's own property, and due to the MPLAB terms of use I

    cannot distribute them with WinPic. But you will have them on your harddisk

    after installing MPLAB !

    Below are some bits (and bit groups) in the configuration memory which

    WinPic can handle even if there is no dev-file for the currently selected device:

    Oscillator

    Most PICs have the option "LP" (low-power), "XT" (crystal or ceramic

    resonator), "HS" (high-speed crystal), or "RC" (resistor+capacitor, with

    the capacitor sometimes integrated in the PIC).

    Code Protection

    Protects the program to be read out. If code-protected, the program

    cannot be verified. Leave this bit off, for heaven's sake ! Some PICs

    support code-protection for different code memory areas. This PIC

    programmer does not (if code protection is enabled, ALL CP bits aretreated the same way).

    Power-Up timer

    Consult Microchips datasheet. They call it "PWRTEN". If the

    checkmark is set, the power-up timer is enabled (no matter if the bit is

    inverted in the config word or not.

    Watchdog Enable.

    If the checkmark is set, the watchdog is enabled and you must feed it in

    your program periodically.

    Data Protection

    Rarely used. Allows read-out protection for the (EEPROM-) data

    memory.

    Low Voltage Programming

    A feature supported by some newer PICs, but not by this programmer.

    Would allow in-circuit programming without a 13-volt programming

    pulse, for the expense of a port bit.

    Brown-out Reset

    If this checkmark is set, the PIC will go into the RESET state if the

    supply voltage drops below a certain voltage. See datasheet.

    MCLR EnableSome PICs like the 16F628 allow using the MCLR pin as a normal I/O

    port. If this checkmark is SET, the MCLR pin is used as a "Master

    CLeaR" input like in older PICs.

    In-Circuit Debug

    Rarely used, look into the PIC16F87x datasheet if you need this.

    Code Write Enable

  • 8/2/2019 PIC Programmer

    18/40

    An interesting feature of the PIC16F87x family. Allows the CODE

    MEMORY(!) to be reprogrammed by the PIC application itself, so you

    can write a custom 'bootloader' or use the program memory for data

    storage etc.

    Config Word #2

    Only used for a few new devices like the PIC16F88. There is no

    'decoder' for the bits in the second config word. Please refer to the PIC's

    data sheet. There is an extra bitmask for the 2nd config word in the

    DEVICES.INI file ("Cfgmask2_used_bits") which is essential for

    verification, because only a few bits are really implemented and may be

    checked when verifying the 2nd config word.

    If a PIC is not directly supported by the programmer, set the PIC type ("Part")

    to "unknown". Then all checkmarks for the options in the configuration word

    are disabled, but the Config Word can still be edited as a hexadecimal value.

    See 'unsupported PICs' for more information. Note: Other areas in the chip's

    configuration memory may be shown on the Configuration Memorytab (for

    example the chip's ID locations, backup oscillator calibration value, etc)

    Device properties:

    Shows the size of the program memory and the data EEPROM memory. If the

    PIC type is set to "unknown", some device properties like code- and data

    memory size can be edited. Instead of using the "unknown PIC" option, it's

    better to add support for your new PIC device as explained in the appendix.

    Contents

    Configuration memory and ID Locations

    A user may store identification information (ID) in a number of programmable

    cells, often four or seven bits per location. These locations are mapped to

    addresses 0x2000 to 0x2003 (that's where you may find them in a HEX file;

    applies to "14-bit core"; for other cores the addresses are totally different). In

    contrast to the code memory, the ID locations can be read unscrambled even ifthe PIC is protected.

    In MPASM (the assembler from microchip), there is the __idlocs command

    (with two underscores) to set these bits, but only the lower 4 bits in every

    location. The __idlocs command bundles 4 * 4 bits in a single 32-bit value,

    http://www.qsl.net/dl4yhf/winpic/index.htm#unsupported_picshttp://www.qsl.net/dl4yhf/winpic/index.htm#id_locationshttp://www.qsl.net/dl4yhf/winpic/index.htm#id_locationshttp://www.qsl.net/dl4yhf/winpic/index.htm#devices_inihttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#unsupported_picshttp://www.qsl.net/dl4yhf/winpic/index.htm#id_locationshttp://www.qsl.net/dl4yhf/winpic/index.htm#devices_inihttp://www.qsl.net/dl4yhf/winpic/index.htm#top
  • 8/2/2019 PIC Programmer

    19/40

    presumably because older PICs only had 4 usable bits per ID location. But the

    12F675 for example has seven bits per location !

    With WinPic, you can read / modify / write the ID locations (all bits). If ID

    location data are contained in a HEX file, they will be loaded and displayed

    also. WinPic does not display the data in MPASM's 4*4-bit-format, it uses atable where all bits are displayed in binary form. You can edit the contents of

    the grid table. After doing so, click the "Apply edits" button under the table.

    Clicking this button copies the table contents into an internal buffer, but does

    not program them into the PIC immediately - the ID locations will be

    programmed together with the other programmable parts in a PIC.

    The "Device ID word" can be used to identify a chip after reading the PIC. This

    14-bit word is mapped to address 0x2006, but not all PICs seem to have it (a

    test with an old 16F84 always returned 0x3FFF as device ID). The lower 4 or 5

    bits may contain the PIC's revision number in some devices. WinPic tries todecode the device ID word and shows the result on the "ID locations" tab. If

    there is a conflict between the selected PIC device and the readout ID word, the

    Device ID display turns red. If WinPic cannot find a match for the device ID of

    the new chip, you may add a new entry to the device database as

    explained here (don't forget to set the parameter"DeviceIdValue" to the new

    chip's device ID).

    Configuration Memory (display table)

    When new PIC devices with new cells in the configuration memoryarea (0x2000..0x203F) turned up, the appearance of the Configuration

    Memory tab was modified. Now, after setting the checkmark "show ALL

    locations", the entire memory area may be displayed, whether it's implemented

    in the PIC or not.

    The "Config Memory" tab may also show the contents of some other special

    function registers which did not fit on the "Configuration Bits" tab. For

    example, you will find the PIC10F20x's Backup OSCCAL Value in this table.

    Because it is entirely unknown how many (and which) cells will be used in theconfiguration memory in future devices, WinPic's device table now contains

    information of all really "implemented" cells. More about this in the chapter

    about the file DEVICES.INI, which describes how to add support for future

    devices.

    Contents

    http://www.qsl.net/dl4yhf/winpic/devlist_format.htmhttp://www.qsl.net/dl4yhf/winpic/devlist_format.htm#device_id_valuehttp://www.qsl.net/dl4yhf/winpic/index.htm#PIC10F_backup_osccalhttp://www.qsl.net/dl4yhf/winpic/index.htm#devices_inihttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/devlist_format.htmhttp://www.qsl.net/dl4yhf/winpic/devlist_format.htm#device_id_valuehttp://www.qsl.net/dl4yhf/winpic/index.htm#PIC10F_backup_osccalhttp://www.qsl.net/dl4yhf/winpic/index.htm#devices_inihttp://www.qsl.net/dl4yhf/winpic/index.htm#top
  • 8/2/2019 PIC Programmer

    20/40

    Options

    On the "Options" tab you can modify the behaviour of the PIC programmer

    (software), how WinPic accesses the parallel or serial port, and modify some

    other parameters which may need 'tweaking' for various reasons. Here are justsome of them:

    Use BULK erase (to unprotect)

    Check this options if there may be code-protected PIC devices in your

    junkbox. What Microchip once called 'bulk erase' is now called 'chip

    erase' for some newer devices. In fact, it 'erases everything' including

    protected code memory, and the protection bits itself. Without this flag,

    WinPic may use a byte-by-byte erase function for all memory cells (this

    method was once used to reduce FLASH memory wear, but it is

    incompatible with the specified programming algorithm for most newerdevices). For this reason, leave this option CHECKED as it was by

    default.

    Verify at different supply voltages

    Only possible with special programming interfaces as described in the

    appendix unter'production grade programmers'. If this option is

    disabled, your interface is not a production grade programmer - don't

    worry about this as a hobbyist !

    Raise Vdd 50 microseconds before raising MCLR to Vpp level

    Certain devices like the PIC16F818 are not happy with the way older

    PICs were treated, where we raised the MCLR signal from 0 Volts to the

    'programming' voltage (typically 13 Volts). If this option is checked, the

    supply voltage (Vdd) is turned on roughly 50 microseconds before the

    MCLR signal is raised from 0 to 13 Volts. Because this is impossible

    with the "COM84" interface (which has no separate Vdd and Vpp

    control lines), a bloody trick is used to achieve a similar effect: Turn

    Vpp+Vdd on, wait a few hundred milliseconds, turn it off again, wait 50

    microseconds, and turn Vpp+Vdd on again. This will cause problems for

    certain devices where the RESET pin can be disabled via configuration

    word.A PIC16F88 could only be programmed with this option.

    A PIC12F675 (with INTRC and no /MCLR) could only be

    programmed without this option.

    A PIC16F628 could be programmed with and without this option.

    If you experience problems with re-programming an already

    http://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#port_accesshttp://www.qsl.net/dl4yhf/winpic/index.htm#production_grade_programmerhttp://www.qsl.net/dl4yhf/winpic/index.htm#port_accesshttp://www.qsl.net/dl4yhf/winpic/index.htm#production_grade_programmer
  • 8/2/2019 PIC Programmer

    21/40

    programmed PIC (with internal osc and w/o external reset), turn this

    option off (clear the checkmark) and try again - maybe it helps.

    Port Access Control

    By default, WinPic does NOT try to access the registers of the serial port

    directly, because all of the port drivers mentioned below caused problems with

    other programs (noteably Microsoft's "Windows Defender" didn't like the

    SMPORT driver). So try to use WinPic without these drivers, if possible. Only

    if your PIC-programmer is connected to the parallel port (LPT), you must use

    one of the drivers below, because the Windows API doesn't have the necessary

    functions for that port. This worked ok under most Windows versions so far,

    but it may be painfully slow when programming larger PICs because every

    single port access required a driver call (from ring 3 to ring 0, if that meansanything to you..). Now there is the option to select how WinPic accesses the

    I/O-ports. This is on the 'Options' tab:

    No direct access at all, only use Windows API functions

    Since November 2006, this is the recommended setting for all interfaces

    on the serial port ("COM"). It may even work with USBRS-232

    interfaces. Unlike the port-access-drivers below, this method does not

    alarm "Windows Defender" for unknown reasons. But this method can

    be incredibly slow(taking many minutes to program a PIC, rather than a

    few seconds), especially when used with certain USB/RS-232 adapters.

    However, if you have a "true" serial port (COM1 and COM2, no USB

    adapter), and don't use Windows Defender, one of the following access

    methods should work too :

    Use SMPORT driver

    This is the default setting for interfaces on the LPT port, which is ok for

    most applications. It requires the SMPORT driver in the Windows

    system folder, or in the folder where WinPic is installed. As mentioned

    above, it is not very fast, but ok for most PICs with only a few kByte

    code memory. If you are using PIC18F or dsPICs with large codememory, you should try the the PortTalk driver which may save a couple

    of seconds programming time :

    Use PortTalk driver / direct access

    This is a different approach, which may be faster on some machines.

    Why ? Using PortTalk, the I/O permission bitmap is modified *once*

    (when initialising WinPic). After that (in the programming loops) no

  • 8/2/2019 PIC Programmer

    22/40

    more driver calls (from ring 3 to ring 0) are required. Since this may be

    impossible in future windows versions, there is a third option (see below,

    "port access already granted"). Actually PortTalk may be too fast for the

    interface, for that reason some additional adjustable delays were added

    on the Interface tab (extra delay before reading the data line", and "extra

    delay for serial clock pulses"). More about "how to make WinPic

    faster" is in the FAQ list. To run WinPic with PortTalk under Win XP

    with a user account (no admin privileges), read this document.

    Port access already granted before start (only for special cases, 99% of

    all users please skip this paragraph ;-)

    With this option, WinPic assumes it can access the I/O ports directly

    without having to open a special port access driver. One such tool is the

    "AllowIO" tool which is provided with the PortTalk driver. A typical

    command line to let allowio grant port access for WinPic is this:

    C:\PicTools>allowio Test.exe /a. However if PortTalk can successfully

    be launched by WinPic itself, forget about AllowIO - it won't be faster

    this way. But under Win95 and Win98, this option may work even if you

    don't have a port access driver. Under Win 2k / ME / XP, it will

    definitely fail if you haven't called something like "AllowIO" before.

    Contents

    Appendix

    PIC programmers for the parallel port

    Using a simple PIC programmer at the parallel port can cause headaches under

    certain Windows versions. First of all, you must select one of theport access

    driversmentioned above, because the Windows API (application interface)

    doesn't have suitable functions for the parallel port. Even worse: Sometimes the

    printer driver (or whatever?) accesses the port though WinPic tries to occupy

    the port itself. This somehow depends on the signal used to read back the data

    from the PIC. Especially the PAPER OUT signal seems to attact Window's

    attention .. and should be avoided for this reason. I did not check if removingall printer drivers can help, if you know more please let me know.

    WARNING ! Because Windows sometimes fools around with the parallel

    port, and we don't know the state of the parallel port before starting the

    programmer, first connect the programmer with the PC, then turn the PC

    on, start the programmer, and insert the PIC into the socket (or connect

    http://www.qsl.net/dl4yhf/winpic/index.htm#Interface_settingshttp://www.qsl.net/dl4yhf/winpic/index.htm#extra_delay_for_datahttp://www.qsl.net/dl4yhf/winpic/index.htm#extra_delay_for_clockhttp://www.qsl.net/dl4yhf/winpic/winpic_faq.htm#make_winpic_fasterhttp://www.qsl.net/dl4yhf/winpic/winpic_faq.htm#make_winpic_fasterhttp://www.qsl.net/dl4yhf/winpic/install_porttalk.htmhttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#port_accesshttp://www.qsl.net/dl4yhf/winpic/index.htm#port_accesshttp://www.qsl.net/dl4yhf/winpic/index.htm#Interface_settingshttp://www.qsl.net/dl4yhf/winpic/index.htm#extra_delay_for_datahttp://www.qsl.net/dl4yhf/winpic/index.htm#extra_delay_for_clockhttp://www.qsl.net/dl4yhf/winpic/winpic_faq.htm#make_winpic_fasterhttp://www.qsl.net/dl4yhf/winpic/winpic_faq.htm#make_winpic_fasterhttp://www.qsl.net/dl4yhf/winpic/install_porttalk.htmhttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#port_accesshttp://www.qsl.net/dl4yhf/winpic/index.htm#port_access
  • 8/2/2019 PIC Programmer

    23/40

    the ICSP cable) shortly before programming ! If you get an error message

    from WinPic saying "Windows fooled around with the parallel port bits",

    read this.

    However, it may be possible to use a few -in the days of DOS widely used-

    interfaces. Supported (but not all tested) are the following interfaces, alongwith their major differences.

    If your programmer shall support dsPIC and PIC18F too, read this note

    on PGC- and PGD filtering.

    (2004-01-26: Modified the TAIT-programmer settings after I found some more

    schematics on the web)

    PIC programmers for the parallel port

    Interface type

    Data

    PC-

    >PIC

    Clock

    PC-

    >PIC

    Data PIC->PCVpp

    Control

    Vdd

    ControlRemarks

    PIC FLASH

    programmerV1

    (SM6LKM,

    2002-10-01)

    D2,not

    inverted

    D3,not

    inverted

    ACK,

    inverted

    D4,inverted

    (L=Vpp on)

    D0, not inv.(H= Vdd

    on)

    ICSP adapterwith

    D7 = ICSP

    disconn(*)

    PIP84

    (bySM6LKM)

    D2,

    not

    inverted

    D3,

    not

    inverted

    PAPER,inverted

    D4,

    inverted

    (L=Vpp on)

    D0,inverted

    (L= Vdd

    on)

    D1=green LED

    D7=ICSP

    disconnect

    PIP84

    (alternative)

    D2,not

    inverted

    D3,not

    inverted

    ACK,inverted D4,inverted D0,invertedD1=green LEDD7=ICSP

    disconnect

    Tait,

    7406, 4066

    D0,

    inverted

    D1,

    inverted

    ACK,

    inverted

    D3,

    inverted

    D2,

    inverted

    7406=inverter

    4066=switches

    Tait,

    7407, 4066

    D0,not

    inverted

    D1,not

    inverted

    ACK,

    not inverted

    D3,

    not inverted

    D2,

    not inverted

    7407=non-

    inverting driver

    Tait,

    7406, PNP

    D0,

    inverted

    D1,

    inverted

    ACK,

    inverted

    D3,

    not inverted

    D2,

    not inverted

    7406=inverter,

    + PNP-transistor

    Tait,

    7407, PNP

    D0,

    not

    inverted

    D1,

    not

    inverted

    ACK,

    not inverted

    D3,

    inverted

    D2,

    inverted

    David Tait's

    "classic" design

    Microchip"AN 589"

    D0 D1 ACK D3 none(always on)

    D2=datatristate,

    http://www.qsl.net/dl4yhf/winpic/index.htm#lpt_port_troublehttp://www.qsl.net/dl4yhf/winpic/index.htm#lpt_port_troublehttp://www.qsl.net/dl4yhf/winpic/index.htm#pgd_pgc_filteringhttp://www.qsl.net/dl4yhf/winpic/index.htm#johan_bodinhttp://www.qsl.net/dl4yhf/winpic/index.htm#icsp_disconnect_controlhttp://www.qsl.net/dl4yhf/winpic/index.htm#johan_bodinhttp://www.qsl.net/dl4yhf/winpic/index.htm#johan_bodinhttp://www.qsl.net/dl4yhf/winpic/index.htm#david_taithttp://www.qsl.net/dl4yhf/winpic/index.htm#microchiphttp://www.qsl.net/dl4yhf/winpic/index.htm#lpt_port_troublehttp://www.qsl.net/dl4yhf/winpic/index.htm#pgd_pgc_filteringhttp://www.qsl.net/dl4yhf/winpic/index.htm#johan_bodinhttp://www.qsl.net/dl4yhf/winpic/index.htm#icsp_disconnect_controlhttp://www.qsl.net/dl4yhf/winpic/index.htm#johan_bodinhttp://www.qsl.net/dl4yhf/winpic/index.htm#david_taithttp://www.qsl.net/dl4yhf/winpic/index.htm#microchip
  • 8/2/2019 PIC Programmer

    24/40

    D5=clock

    tristate,

    D4=PullMCLR down

    Signals on the PC's 25-pin "LPT" connector (SUB-D)

    Pin Nr Signal

    token name

    in interface

    definition file

    DirectionDescription

    (usual function)

    1 /STROBE str PC->printer 'Byte clock'

    2 D0 D0 PC->printer Centronics Data

    3 D1 D1 PC->printer Centronics Data

    4...8 ... ... PC->printer Centronics Data

    9 D7 D7 PC->printer Centronics Data

    10 /ACK ack printer->PC Acknowledge

    11 BUSY bsy printer->PC Busy or Error

    12 PAPER pap printer->PC high=printer ran out of paper

    13 SELECTED sld printer->PC high=printer is on-line

    14 /ALF alf PC->printer automatic line feed

    15 /ERROR err printer->PC out of paper, error, offline

    16 /INIT ini PC->printer resets the printer

    17 /PRINTER SEL psl PC->printer low = select printer

    18..25 GROUND - connect ALL LINES to ground

    Not listed in the above table: ICSP Connect/Disconnect ... based on an idea by

    Johan Bodin:

    Centronics D7 (inverted) is used as an additional control line for in-

    circuit programming. This signal is used to *totally* disconnect the

    programmer from the target system (using relay(s) and/or CMOS analog

    switches or whatever). This eliminates the need to plug/unplug the

    programming connector for code test runs. Some target systems may

    have very hi-z circuits connected to the programming pins, RB6/RB7

    (GP0/GP1).D7 = LOW means "Programmer shall be connected to target"

    D7 = HIGH means "Programmer shall be disconnected from target"

    (you'll find D7 HIGH after booting the PC in many cases, so

    HIGH=DISCONNECT is the safer state)

    After switching this signal to LOW (=connect programmer to target), the

    software waits at least 200 milliseconds until the first attempt to switch

    http://www.qsl.net/dl4yhf/winpic/index.htm#interface_definition_filehttp://www.qsl.net/dl4yhf/winpic/index.htm#interface_definition_filehttp://www.qsl.net/dl4yhf/winpic/index.htm#interface_definition_filehttp://www.qsl.net/dl4yhf/winpic/index.htm#interface_definition_file
  • 8/2/2019 PIC Programmer

    25/40

    the PIC into programming mode. This should be enough for

    electromagnetic relays.

    Parallel port trouble

    Sometimes (especially under Windows XP) you may get a sloppy errormessage from WinPic telling you that "Windows fooled around with the

    parallel port". The reason for this may be a scanner driver, printer driver, or the

    plug-and-play hardware detection which permanently polls the port for new

    devices. Of course, this will spoil the operation of a PIC programmer connected

    to the parallel port !

    The problem could sometimes be fixed by adding (or modifying) the following

    key in the windows registry :

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Parport\Parameters]

    "DisableWarmPoll"=dword:00000001

    Search the web for "Jan's Parallel Port FAQ"; the site contains details about this

    registry hack.

    Caution: Only modify the registry if you know what you're doing ;-)

    Contents

    Adapting WinPic for other (simple) programming interfaces

    If your (simple) programmer for the parallel or serial port is not listed on the

    'interface' tab, here's what to do (besides the option to write aplugin for it) :

    Copy and rename one of the SampleInterfaceXXX.INI in the 'interfaces'

    subdirectory (part of the installation package) into another file, for

    example MyInterface.INI

    With your favorite text editor, load 'your' interface definition file andmodify it for your needs. There is a section

    [ProgrammerControlLines]

    with the following entries ... some of them optional, only a few are mandatory,

    marked with "m"=mandatory:

    http://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#hardware_interface_dllhttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#hardware_interface_dll
  • 8/2/2019 PIC Programmer

    26/40

    DataIn (m)

    serial data line from PIC to PC. Example for a simple interface on the

    serial port:DataIn=cts

    OkButton

    signal from programming adapter to PC for an optional "OK"-button.VppOnOff (m)

    control line to turn the programming voltage on(H) and off(L). From PC

    to PIC. Example for a simple interface:VppOnOff=txd

    VddOnOff

    control line to turn the supply voltage on(H) and off(L). From PC to PIC.

    PullMclrDown

    control line to pull the MCLR pin down to ground. As far as I know,

    only Microchip's "AN589"-programmer uses this (with

    PullMclrDown=D4)Connect

    control line to connect(H) or disconnect(L) the target. From PC to

    programming interface. Usually "!D7".

    ClockOut (m)

    serial clock output from PC to PIC. Example for a simple interface on

    the serial port:ClockOut=rts

    DataOut (m)

    Definies the interface signalwhich is used to send serial data output

    from PC to PIC. Example for a simple interface on the serial port:DataOut=dtr

    DataOutWhileReading

    Defines the logic state (not a control signal) of the data output line while

    reading. For most interfaces, the data output must be set to a logic "1" by

    the programmer, so the PIC can pull the serial output low (because most

    interfaces use an NPN-transistor or open collector output stage, and a

    pullup resistor connected to Vdd). For interfaces with a tristate output,

    the level of the serial ouput line while reading doesn't matter (use

    "OutEnable" to define the control line for the tristate driver in that case).

    Example for a simple interface on the serial port:DataOutWhileReading=1

    ClkEnable

    Tristate buffer control for the serial clock output. As far as I know, the

    only interface which uses this is the original Microchip "AN589"

    programmer. "H" level means output enabled (from PC to PIC), "L"

    means output disabled (high impedance). Example for a simple interface:ClkEnable=nc

  • 8/2/2019 PIC Programmer

    27/40

    OutEnable

    Tristate buffer control for the data output. As far as I know, the only

    interface which uses this is the original Microchip "AN589"

    programmer. "H" level means output enabled (from PC to PIC), "L"

    means output disabled (high impedance).

    RedLed

    Optional output from the PC to a red LED on the programmer, signalling

    "error state" after programming.

    GreenLed

    Optional output from the PC to a green LED on the programmer,

    signalling "success" after programming.

    Thefunction token in the definition file is followed by a "=" character, and a

    symbolic definition for the control signalwhich is used. This can be any of the

    centronics data lines, inverted (LOW-active) or not inverted (HIGH-active).

    "Active" must be seen from the target's point of view. If -for example- there is

    an inverter between the serial data output on centronics D0 and the PIC's

    "RB7" pin, the definition line must be

    DataOut=!D0

    which means

    "The serial data output is connected to D0, inverted" (the '!' character to

    invert something is "C"-style)

    These names can be used for control lines on the centronics port ("LPT1" or"LPT2"). Non-inverted always means active-HIGH level on the PC's output, no

    matter what the centronics printer specification says (signals which are inverted

    by the PC hardware are automatically inverted by software !).

    D0, D1, ... D7

    centronics data, not inverted. Can be used as OUTPUTS from PC to

    target.

    !D0, !D1, ... !D7

    centronics data, inverted. Can be used as OUTPUTS from PC to target.

    pap, !pap

    centronics "paper out", normal (H=active) or inverted (L=active). Can be

    used as INPUT from target to PC.

    ack, !ack

    centronics "acknowledge", normal (H=active) or inverted (L=active).

    Can be used as INPUT from target to PC.

    str, alf, psl, ini

  • 8/2/2019 PIC Programmer

    28/40

    Other control signals OUTPUTS from PC to target: strobe, automatic

    line feed, select printer, initialize printer(reset).

    bsy, sld, err

    Other INPUTS from target to PC: busy, selected, error

    nc

    not connected. Use this token for all unused/unsupported functions, like

    "RedLed=nc" . All unused functions appear disabled on the "Interface

    Test" tab.

    For an interface on the serial port, these control lines are available (may be

    used if you have an interface with an inverting RS-232 level converter like the

    MAX232). If you use the original "COM84" programmer, you don't have to

    write your own interface definition !

    txd, !txd

    Transmit Data (here: abused as simple control line). For COM84, "txd"is used as programming voltage (non-inverted)

    dtr, !dtr

    Data Terminal Ready. For COM84, "dtr" is used as serial data output

    from PC to PIC (non-inverted)

    rts, !rts

    Ready To Send. For COM84, "rts" is the serial clock output from PC to

    PIC.

    cts, !cts

    Clear To Send. For COM84, "cts" is the serial data input (from PIC to

    PC).

    Other "control signal tokens" are listed in the LPT connector table, or in the

    SampleInterfaceXXX.INI files. Every macro definition can control up to 4

    output lines, like:

    SelVddHigh=D0+D1+!D2+!D3

    which will set both D0+D1 high and D2+D3 low when the supply voltage shall

    generator shall be configured for "high supply voltage (see notes on

    simpleproduction-grade programmers).

    If you have the source code of WinPic, look for

    "PicHw_TokenToInOutFunc()" to find out which tokens are implemented so

    far ;-)

    To continue the installation of a customized programming interface...

    http://www.qsl.net/dl4yhf/winpic/index.htm#lpt_connectorhttp://www.qsl.net/dl4yhf/winpic/index.htm#production_grade_programmerhttp://www.qsl.net/dl4yhf/winpic/index.htm#lpt_connectorhttp://www.qsl.net/dl4yhf/winpic/index.htm#production_grade_programmer
  • 8/2/2019 PIC Programmer

    29/40

    Save your modified interface definition file (interfaces\MyInterface.INI)

    now, and close the text editor.

    Open WinPic's "Interface" tab and select "Custom , on XXX port,

    defined by file" (XXX = COM or LPT; scroll to the end of the list !).

    Notice that the edit field under "Custom interface definition file" will be

    enabled now.

    Enter the name of your interface definition file in the edit field, or click

    "Select" to open a file selector.

    Note: THE INTERFACE DEFINITION FILE MUST BE IN THE

    'interfaces' SUBDIRECTORY !

    If an error message like "invalid signal definition" appears, check your

    interface definition file again (with a text editor) and try again.

    If everything is ok, check the proper function of the control lines with

    the interface test option. Keep your interface definition file in WinPic's

    directory, because this file will be loaded whenever you start the program again

    (the definitions are NOT copied into the SETTINGS.INI file. Only the name of

    your interface definition file is saved in the settings !)

    Driving other hardware through a Programmer-Plugin (DLL)

    Since 2008, it is possible to add support for other interfaces in the form of a

    plugin-DLL. To use such a DLL, it must be copied into the folder

    "interface_dlls" (in the WinPic installation archive). Then, set the interface type

    to "Custom, on any port, from plugin-DLL" on WinPic's INTERFACE tab.

    Next, click the "Select"-button on that page. A file selector dialog will open up,

    asking you for the name of the interface-DLL in the folder mentioned above.

    If you have developed your own PIC programming interface -possibly with a

    USB interface- and want to add support for it using WinPic, you can write your

    own interface DLL with a free C compiler like DevC++ V 4.9.9.2 . You will

    find the complete sourcecode for such a DLL on the author's website, along

    with the necessary documentation.

    The "interface_dlls" folder will be empty after installation by default (except

    for a small readme file) to avoid bloating the WinPic installation archive. But a

    list of DLL-plugins for other PIC-programmers will be available on the WinPic

    website, as soon as such DLLs exist ;-)

    Back to the table of contents

    http://www.qsl.net/dl4yhf/winpic/index.htm#Interface_settingshttp://www.qsl.net/dl4yhf/winpic/index.htm#my_homepagehttp://www.qsl.net/dl4yhf/winpic/index.htm#my_homepagehttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#Interface_settingshttp://www.qsl.net/dl4yhf/winpic/index.htm#my_homepagehttp://www.qsl.net/dl4yhf/winpic/index.htm#my_homepagehttp://www.qsl.net/dl4yhf/winpic/index.htm#top
  • 8/2/2019 PIC Programmer

    30/40

    "Production grade" programmers

    Microchip's PIC requirements for a "production grade" programmer

    specifications require to verify the PIC at different voltages. If you think you

    really need this, you can use WinPic to drive a simple programming adapter

    which does this (it's a bit crude, however, see below).

    The basic principle is this: WinPic controls the supply voltages with a few

    digital output lines of the parallel port. Your hardware can use this to switch a

    couple of trimpots which adjust the supply voltage. I have never built such a

    programmer myself (because I never missed such a thing) but if you'd like to,

    look into the file SimpleProductionGradeProgrammer.ini (it's in the zipped

    archive where you found WinPic.exe). Here is an example for the interface

    definition file of a "simple" production-grade programmer:

    [ProgrammerControlLines]DataIn=!ack

    OkButton=!sld

    VppOnOff=!D4

    VddOnOff=D0

    SelVddLow=D5+!D6+!D7

    SelVddNorm=!D5+D6+!D7

    SelVddHigh=!D5+!D6+D7

    Connect=nc

    ClockOut=D3

    DataOut=D2

    The definitions of the three "SelVdd"-macros control the supply voltage (here:

    D5 and D6 of the parallel port). WinPic executes the "SelVpp"- macrosBEFORE switching on the supply voltage, with a pause of at least 100

    milliseconds (enough to charge/discharge a capacitor with a few uF's). After

    settling of the supply voltage, it is actually turned on with the "VddOnOff"

    macro (here: D0 will be SET to turn the PIC's supply voltage on). Some PICs

    require a fast rise time of the supply voltage, so use a switching transistor

    controlled by the "VppOnOff" macro (D4 in this example), and place the

    buffering capacitor "BEFORE" the Vpp switch !

    Suggestion: Use the "Vdd selection" lines to drive two or three NPN

    transistors, with trimpots in the collectors, and emitters connected to ground.

    The trimpots can be part of a voltage divider connected to an simple regulator.

    No need for an analogue switch !

    To verify a PIC program at different voltages, you must turn on the option

    "Verify at different supply voltages" on the options tab. If the adapter does not

    support this (because the SelVdd-macro definitions are missing in the interface

    http://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#optionshttp://www.qsl.net/dl4yhf/winpic/index.htm#options
  • 8/2/2019 PIC Programmer

    31/40

    definition file, or are defined as "nc"=not connected), this option will be grayed

    and WinPic will ignore it (it will only do a single verification run then, instead

    of three runs with Vdd=Vdd_norm, Vdd=Vdd_min, Vdd=Vdd_max in this

    order). If one of the three possible voltage are not supported by the

    programmer, define the voltage control lines as "not connected" like this, which

    lets WinPic skip that verify-step:

    SelVddHigh=nc

    Note: This three-voltage-verification is not very smart. It takes about three

    times longer than verifying at a single voltage, and IMHO is not required for

    hobbyist purposes - and that's what we are talking about. It may be an issue if

    you plan to run a PIC very close (or even below) its specified operating

    voltage. In this case, it makes sense to verify it at that low voltage.

    Contents

    Adapter for PIC16F87x (28 pin SDIP)

    This adapter was used to program a PIC16F876A with 28-pin standard DIP,

    using a programmer which was originally built for the 16F84/16F628 :

    Adapter for PIC16F876 (and similar) with a 18-pin PIC programmer

    Pin FunctionPin Nr & Name

    PIC16F628 (SDIP 18)

    Pin Nr & Name

    PIC16F876 (SDIP 28)Remarks

    Power supply14

    "Vdd"

    20

    "Vdd"+ 5 V

    Ground5

    "Vss"8 and 19

    "Vss"connect all

    "ground" pins !

    Prog Voltage4

    MCLR/Vpp

    1

    MCLR/Vpp12 V pulse

    CLOCK12

    RB6

    27

    RB6 / PGC

    DATA 13RB7

    28RB7 / PGD

    Note: The 16F8xx may be affected by capacitive coupling from PGD to PCD

    (data to clock), so in case of trouble add two capacitors as described here.

    http://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#pgd_pgc_filteringhttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#pgd_pgc_filtering
  • 8/2/2019 PIC Programmer

    32/40

    Adapter for PIC12F629/675

    The PIC12F629 / PIC12F675 is a low-cost PIC with 8 pins and flash memory,

    the F675 has four 10-bit A/D converters.

    If you already made a (non-ICSP-) programmer for the once-famous 16F84 or16F628 family, you need an adapter socket from 18-pin (16F84,16F628) to 8-

    pin (12F629/675). The pinout for the 12F629/675 is:

    (pinout PIC16F675) (my ugly adapter)

    The following table helps to make an adapter from 18-pin PICs to 8-pin PICs:

    PIC pins for serial programming of 18- and 8-pin PICs (except PIC10F)

    Pin FunctionPin Nr & Name

    PIC16F628 (18 pins)

    Pin Nr & Name

    PIC12F675 (8 pins)

    Pin Nr on SM6LKM's

    PIC FLASH board

    V1

    Remarks

    Power supply

    14

    "Vdd"

    1

    "Vdd"

    2

    Vdd + 5 V

    Ground5

    "Vss" :-(

    8

    "Vss" :-(

    3

    GND :-))

    don't say

    "Vss" ;-)

    Prog Voltage4

    MCLR/Vpp

    4

    GP3/MCLR/Vpp

    1

    Vpp12 V pulse

    CLOCK12

    RB66

    GP1/CIN-/VREF5

    RB6

    DATA13

    RB7

    7

    GP0/CIN+

    4

    RB7

    Note: Though it looks ugly, this adapter may be (or may be not) used to

    program some 14- or 20-pin chips, too. For example, the ICSP pins of the

    PIC16F690 are at the same physical pins as for the PIC12F675, even though

    the pin numbers are not the same. But beware, some PICs have a "low voltage

    programming input" which needs to be tied to low level while programming.

  • 8/2/2019 PIC Programmer

    33/40

    Adapter for PIC10F20x (6-pin SOT-23 or 8-pin PDIP)

    To program a PIC10F20x with your old "simple" programmer, you needyet

    anotheradapter, because the PIC10F20x 8-pin packages are not pin-

    compatible with the PIC12F6xx shown in the previous chapter ! (remember

    this before the smoke comes out). The following table may help to build an

    adaptor for PIC10F200/202/204 /206 :

    Adapter from PIC16F628 (18-pin) to PIC10F20x (8-pin)

    Pin FunctionPin Nr & Name

    PIC16F628 (SDIP 18)

    Pin Nr & Name

    PIC10F20x (PDIP 8)

    Pin Nr & Name

    PIC10F20x (SOT-23, 6 pin)

    Power supply14

    "Vdd"2

    "Vdd"5

    "Vdd"

    Ground5

    "Vss"

    7

    "Vss"

    2

    "Vss"

    Prog Voltage4

    MCLR/Vpp

    8

    GP3/MCLR/Vpp

    6

    GP3 / MCLR / Vpp

    CLOCK12

    RB64

    GP1/ ICSPCLK3

    GP1 / ICSPCLK

    DATA13

    RB7

    5

    GP0 / ICSPDAT

    1

    GP0 / ICSPDAT

    Handling of OSCCAL and Backup OSCCAL Value (by WinPic, for

    PIC10F20x)

    The PIC10F20x only runs with an internal 4-MHz-RC-oscillator which must be

    "calibrated" by moving a certain value into the OSCCAL registers in the very

    first instruction of your application. The calibration value is the operand of a

    MOVLW instruction at code memory address 0x0FF (or 0x1FF, depending on

    the code memory size). There is a "backup" OSCCAL value (at address 0x104

    or 0x204). WinPic reads both these locations before erasing the chip, and

    restore them automatically if the read values are valid. If both calib values in

    the PIC10F20x are invalid, WinPic will use the values from its code- and

    config memory buffers. If the buffered values are also invalid (because theydon't contain a MOVLW opcode), WinPic will refuse to program the chip

    (unless the option "Don't care for OSCCAL value" is set.

    So, if you get the following error message ...

    PIC10F: Abort programming (nothing erased). No valid OSCCAL value

    found !

  • 8/2/2019 PIC Programmer

    34/40

    Enter a valid BACKUP OSCCAL VALUE (like 0x0CF4) on the Config

    Register Tab, then try again !

    ... then switch to WinPic's "Config Memory" tab, where you can enter the

    OSCCAL value of your chip. Then hit "apply changes" and try programming

    again. To avoid losing the individual OSCCAL value of your precious sample,read it out and scratch the hexadecimal number into the PIC's plastic package -

    so you can always find it when you need it ... ;-)

    Adapter for PIC16F636 / PIC16F684 / PIC16F688 (14 pin DIP) /

    PIC16F690 (20 pin DIP)

    This adapter was used to program a PIC16F684 with 14-pin SDIP case, using a

    programmer which was originally built for the 16F84/16F628. I tested it with a

    JDM-style interface and it worked ok. For details, consult Microchip's

    specification DS41204 . The same socket was used forPIC16F631/677/685/687/689/690 (20-pin DIP package), because the pins used

    for serial programming are at the same physical locations though their pin

    numbers are different.

    Adapter for PIC16F684 (14-pin) and PIC16F690 (20-pin)

    PinFunction

    Pin Nr &

    Name

    PIC16F628,etc

    (18 pins)

    Pin Nr & Name

    PIC16F684, etc(14 pins)

    Pin Nr & Name

    PIC16F690, etc(20 pins)

    Pin Nr on

    SM6LKM'sPIC FLASH

    board V1

    Remarks

    Power

    supply

    14

    Vdd

    1

    Vdd

    1

    Vdd

    2

    Vdd+ 5 V

    Ground5

    "Vss" :-(14

    "Vss" :-(20Vss

    3GND :-))

    Prog

    Voltage

    4

    MCLR/Vpp

    4

    RA3 / MCLR /

    Vpp

    4

    RA3/MCLR/Vpp

    1

    Vpp12 V pulse

    CLOCK

    12

    RB6

    12

    RA1 /ICSPCLK

    18

    RA1 / ICSPCLK

    5

    RB6

    DATA13

    RB7

    13RA0 /

    ICSPDAT

    19RA0 / ICSPDAT

    4RB7

    http://www.qsl.net/dl4yhf/winpic/index.htm#id_locationshttp://www.qsl.net/dl4yhf/winpic/index.htm#id_locations
  • 8/2/2019 PIC Programmer

    35/40

    Note: If you already built the adapter for the

    PIC12F675 (with 8 pins), you can program the

    PIC16F684 (with 14 pins) with it, too. Pin 1 of the

    PIC plugs to pin1 of the socket. Pin 14 of the

    PIC16F684 plugs into pin 8 of the PIC12F675

    adapter. Looks ugly but works .

    Contents

    Adapter for PIC18F2455 / PIC18F2550 (28 pin SDIP)

    This adapter was used to program a PIC18F2550 with 28-pin SDIP case, using

    a programmer which was originally built for the 16F84/16F628. Though thesechips have a USB interface, you cannot program them through USB (without

    extra hardware or a special bootloader).

    Beware: The pinout of these PIC18F2x5x devices looks similar to other 28-pin

    PIC16F devices and dsPIC's on first sight, but they are not pin-

    compatible ! The following table helps to build an adapter for PIC18F2455 and

    PIC18F2550 devices, to be programmed with an old 18-pin PIC programming

    interface. I tested it with a JDM-style interface and it worked ok.

    Adapter from 18-pin PIC16F programmer to 28-pin PIC18F2550 (and similar)

    Pin Function

    Pin Nr & Name

    PIC16F628 (SDIP18)

    Pin Nr & Name

    PIC18F2550 (SDIP28)

    Remarks

    Power supply14

    "Vdd"

    20

    "Vdd"

    Ground5

    "Vss"

    8, 19

    "Vss"connect all"ground" pins !

    Prog Voltage4

    MCLR/Vpp

    1

    MCLR/Vpp/RE3

    12 V pulse

    CLOCK12

    RB6

    27

    RB6/KBI2/PGC

    connect 22 .. 47 pF cap

    to ground(*)

    DATA13

    RB7

    28

    RB7/KBI3/PGD

    connect 22 .. 47 pF cap

    to ground(*)

    LowVoltageProg.mode

    - 26RB5/KBI1/PGM

    pull to GROUND to avoidentering low-voltage prog

    http://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#pgd_pgc_filteringhttp://www.qsl.net/dl4yhf/winpic/index.htm#pgd_pgc_filteringhttp://www.qsl.net/dl4yhf/winpic/index.htm#pgd_pgc_filteringhttp://www.qsl.net/dl4yhf/winpic/index.htm#pgd_pgc_filteringhttp://www.qsl.net/dl4yhf/winpic/index.htm#tophttp://www.qsl.net/dl4yhf/winpic/index.htm#pgd_pgc_filteringhttp://www.qsl.net/dl4yhf/winpic/index.htm#pgd_pgc_filtering
  • 8/2/2019 PIC Programmer

    36/40

    mode

    Note: You don't necessarily have to connect RB5/KBI1/PGM to ground. But

    doing so makes sure the chip doesn't enter low-voltage programming by

    accident, because WinPic only uses standard ("high-voltage") programming atthe moment.

    Contents

    Adapter for dsPIC30F201x (28 pin SDIP)

    Beware: The dsPIC30F2010's pinout looks similar to other PIC16F and PIC18F

    devices on first sight, but it is not compatible ! The following table may help to

    build an adapter for most dsPIC's with 28 pin standard DIP case, to be

    programmed with an old 18-pin PIC programming interface:

    Adapter from 18-pin PIC programmer to dsPIC30F2010 (and similar)

    Pin Function

    Pin Nr & Name

    PIC16F628 (SDIP18)

    Pin Nr & Name

    dsPIC30F2010 (SDIP28)

    Remarks

    Power supply14

    "Vdd"

    13, 20, 28

    "Vdd" and "AVdd"

    connect +5V to allsupply

    voltages, analog anddigita