Program PIC_READ
10 November 2006
pic_read [options]
Read the data from a Microchip PIC (registered trademark of Microchip Inc,
http://www.microchip.com) microcontroller via a PIC programmer conforming
to the Embed Inc PIC programmer protocol, described in the PICPRG_PROT
documentation file. Conforming programmers include the Embed Inc EasyProg
and ProProg.
The programmer must be on and the target chip properly connected before
this program is run. The programmer must also be connected via a serial
port (COM port on PC systems).
The command line options are:
-HEX filename
filename
Specifies the output file name. The ".hex" file name suffix will
be assumed and may be omitted from the FILENAME argument.
The first command line option that does not start with a dash (-)
is assumed to be the HEX output file name. This is a short form of
supplying the file name for convenience, but can not be used when
the file name starts with a dash. The full form of this option
using the -HEX keyword works whether the file name starts with a
dash or not. In either case, if the file name includes spaces or
some other special characters, it must be enclosed in quotes ("")
or apostrophies ('').
The output file name must be supplied. There is no default.
-SIO n
Selects the system serial line number to use in communicating with
the programmer. Only that programmer is accessed.
The default is to use the first available programmer known to be
connected to the system. If no known connected programmer exists,
then the programmer connected to serial line 1 is used.
-N name
Selects the programmer by name.
If no other command line option specifies a connection means to the
programmer (like -SIO), then the first programmer of this name from
those known to be connected to the system is used. A programmer is
known to be connected to the system if it is connected and uses a
connection type that the system can enumerate, such as USB.
If a connection type is specified, the first programmer found with
that name and connection type is used. Note that some connection
types inherently specify a unique programmer, such as serial line,
since only a single device can be attached to any one serial line.
In that case it is an error if the programmer does not have the
indicated name or does not have a name.
The NAME parameter is case-sensitive. Programmer names can
generally be set by the user (see the PIC_CTRL command). It is
strongly recommended that all programmers connected to a system
have a unique name. Otherwise the choice of programmer used when a
non-unique name is given is arbitrary, and there is no way to
select between multiple programmers of the same name. All Embed
Inc programmers that have names are initially given globally unique
names by Embed Inc.
-PIC name
Explicitly identifies the target PIC. Example names are "16F876",
"18F452", and "16LF628". Note that the suffixes denoting package
type, temperature range, etc, are not included. The NAME argument
is case-insensitive.
If this command line option is omitted, then the programmer
attempts to determine the target chip type by reading its hard
coded ID. If successful, the program will proceed assuming the
most generic variant with that ID. For example, the 16F628 and
16LF628 have the same ID word. If that ID is found, then the
16F628 will be assumed unless this command line option is used and
16LF628 specified.
Some PICs do not contain hard coded IDs, and it is not possible to
determine the exact target chip type. It appears that PICs with
the 12 bit "baseline" core, such as the 10F2xx, do not contain
target IDs. In case of such a target PIC, this command line option
is required. The program will abort with an error condition if
this command line option is omitted and the target PIC type can not
be determined.
If this command line option is supplied, then that particular
target PIC is verified to the extent possible. If that target type
has a unique ID, then the ID is read and checked against the
expected value. If the target has no unique ID, some test are
performed to verify the target chip, but these are not guaranteed
to be conclusive. The program will abort with an error condition
only if it can conclusively determine that the target PIC is not
the one specified with this command line option.
-LVP
Forces use of low voltage program mode entry in cases where the PIC
supports both high and low voltage over the same PGC/PGD interface.
High voltage means raising the MCLR pin above Vdd. Low voltage
usually means clocking in a special key sequence while MCLR is held
low. Most PICs require one or the other method, but some, like the
16F1xxx series support both.
By default, the high voltage method is chosen when it is supported
both by the PIC and the programmer. The high voltage method is
generally more desirable in that it unambiguously enters program
mode, and sometimes more features are available when program mode
is entered that way.
It may be necessary to force low voltage program mode entry due to
hardware limitations. For example, other circuitry connected to
MCLR may not tolerate voltages above Vdd, or the connection to the
programmer may prevent voltages above Vdd from reaching the MCLR
pin. In those cases, and if the programmer and the PIC both
supported high voltage mode, the program would fail due to not
being able to establish communication with the PIC.
In cases where the target hardware can be damaged by a higher
voltage on MCLR than Vdd, the -PIC command line option must also be
used.
The low voltage mode program entry described here is not the same
as on some older parts that required use of a separate PGM pin. In
all cases discussed here, the programmer is still connected to Vdd,
MCLR, PGC, PGD, and ground, never PGM. Although the PGM method is
also sometimes called "low voltage programming", that is not what
is referred to here.