This page deals with common problems in implementing some of Microchip's main development tools. These include MPLAB, PicStart, PICkit 2, ICD2, and the C compiler.
I have problems installing MPLAB
Installation of MPLAB on a recent PC running Windows should be straightforward, whether the latest version from the Microchip website is used, or the version on the book CD. Check the outline instructions on the CD to get you going.
If you have ongoing problems with installation, contact Microchip Technical Support direct. They are very fast and helpful.
Problems with MPLAB Recognising File Names
Note that MPLAB doesn't accept full-stops (periods) within a file name, even though Windows does. Therefore for example my.program.asm would not be a legal file name, and will not be recognised as an Assembler source file. Replace for example with my_program.asm .
I get multiple "Symbol not Previously Defined"
Messages
This occurs most often when an Include file is used, and the symbols defined in
this file are upper case (say), while the same symbols are used in lower case in
the program. This can occur in all the book programs, as these are written in
lower case, while Microchip use Upper Case in their include files. In the
List File, the error messages look like this:
0000
00040 org 00
00041
;Initialise, settings for Derbot Build Stage 1. For other stages
;settings will differ
Error[113] : Symbol not previously defined (status)
Error[113] : Symbol not previously defined (rp1)
0000 1000 00042 bcf status,rp1
Error[113] : Symbol not previously defined (status)
Error[113] : Symbol not previously defined (rp0)
0001 1400 00043 bsf status,rp0 ;select memory bank 1
0002 3000 00044 movlw B'00000000' ;set port A bits according to their function, ;1=input, 0=output
Error[113] : Symbol not previously defined (trisa)
0003 0080 00045 movwf trisa
To resolve, in MPLAB click Project -> Build Options -> project name, and click Disable Case Sensitivity.
I can't get one of the Programs
on the Book CD or web site to Run
Check the Book CD section
of this site, for any comments on that program. Otherwise email
the author.
How do I choose between PicStart, PICkit 2, and ICD2?
PicStart is a tool for programming PIC microcontrollers. It is driven from a PC, and requires the microcontroller to be taken out of the target circuit, and inserted into the PicStart socket. In its current version it connects to a PC via the RS232 port, so most laptops cannot connect directly to it (although USB to RS232 converters are available). It's great for programming PIC microcontrollers, and for reading and erasing if you need to. It's also a little annoying to have to keep switching the microcontroller back and forth, and can lead to broken pins on the i.c.. With the tools below it now feels a bit dated, but can still be a valuable tool.
The ICD2 (In Circuit Debugger) is an altogether more sophisticated tool. It can program and debug microcontrollers in the target circuit, as long as the circuit is designed to make that interconnection, and the microcontroller in use has the on-chip circuitry to communicate with the ICD2. As far as projects in the book are concerned, both the 16F873A and the 18F242 have this on-chip debug capability, and it is generally far simpler to use the ICD2. In this case you do not need a PicStart at all. There are of course do-it-yourself alternatives, whose designs can be found on the web. Some of these are undoubtedly very good, but I do not comment on them.
The PICkit 2 is like a simplified (and cheaper) ICD2. With it you can program and debug certain PIC chips. See the Microchip web site for the full list, which includes both the 16F873A and 18F242, as used in the book. One limitation is that it allows only one breakpoint, so debugging is limited. It has the same "feel" as the ICD2, as it can be used in programming and debugger modes. In the latter, it takes up the same internal resource as the ICD2. If you're using it with the Derbot, you'll need to make an adaptor cable, or wire in the right connector. See Using PICkit 2 with the Derbot.
The strange thing is that MPLAB doesn't look any different after the C compiler has been installed. Just work through the C18 tutorial from page 396 of the book, and you should find the compiler invoked when you attempt a Build of your C source code.
Should I use the Derbot, or a development board from Microchip?
The answer to this depends on your budget and ambition. The development boards
from Microchip, e.g. the ones that come with the ICD2 kit or the PICkit2, are
low cost and very effective. They allow you to develop a range of programs within
the environment defined by the board, but generally also allow you to extend
that by adding components to a prototyping area. They are certainly a safe and
low-cost option. Working with a Derbot gives you a slightly more open-ended
experience. You can work very directly with all the programs in the book.
However, as Derbots aren't at present sold in complete form, the
responsibility does lie with you to get the circuit going in the first place.
Once you have your Derbot working, you can use it to develop your skill and
knowledge, right up to the use of a Real Time Operating System. At the end of
the day, there's nothing quite like having your development board running across
the floor, executing a program which you have just developed!
Using PICkit 2 with the Derbot
The PICkit 2 uses exactly the same connections to the PIC microcontroller as the ICD2, However it unfortunately makes use of a different connector. The Table below shows connections for ICD2, PICkit 2, and the microcontroller itself. To connect the PICkit 2 to the Derbot you need to get a matching connector (e.g. RS Components part 479-181) and wire it as shown below. Trace the points to connect either from the ICD 2 connector itself, or from the microcontroller pins.
ICD 2 | PICkit 2 |
Connection to 16F873A or 18F242 |
|
|
Vpp/|MCLR
Pin 1 VDD Pin 20 VSS Pin 19 PGD Pin 28 PGC Pin 27 |
Revised: October 01, 2014.