Programming PIC18F2450/2455
The pin-out for Microchip standard 6-pin connector for In-Circuit Serial
Programming (ICSP) is listed in table below
|
Pin |
Function |
|
1 |
_MCLR/Vpp
(programming voltage) |
|
2 |
Vcc(+5V) |
|
3 |
Gnd |
|
4 |
Data |
|
5 |
Clock |
|
6 |
LVP (low-voltage programming mode
control) |
PICKit 2 Starter Kit is the low cost ICSP programmer for Flash PICs with USB
interface introduced
recently by Microchip. Only
subset of PIC microcontrollers is supported, but the list is including
all the recent devices from PIC16 and PIC18 families. The software
upgrades are free and Microchip updates them in timely fashion. Even
more, the
source code and schematic
are freely available. You can buy only
programmer itself without kit from
Microchip Direct for $35.

My first PIC programmer was Melabs EPIC device with parallel port
interface. After upgrading my PC I have realized that parallel port
became legacy these days, as the most of new PC motherboards do not have
it all. The another annoying part about Melabs programmers in general is that even if you
buy the full package (hardware + software) upgrades are not free and
only beta stuff available for download. I have successfully burned all
my PIC18F2455 and 2450 chips using PICkit 2 and would definitely
recommend it.

It was just a proof of concepts. Here is the thing: If you do not have a PIC programmer around - what would you do?
Many PIC programmer schematics available on the Web due the ease ICSP
protocol. Surprisingly enough the most of them using parallel port
interface, like EL Cheapo programmer. Accessing parallel port
programmatically under Windows
2000/XP is a real pain and requires special kernel-mode driver. I have
opted in favor of the serial-port based
JDM2 as
the most simplest one. The programmer schematic was
shown in Figure 2 with all the updates required to program PIC18F chips. I have built it in an hour using
prototype board
from Radioshack.

The next step was trying to use the different software. WinPic800
failed miserably, even thought it claims to support JDM interface
and PIC18F2450 and 18F2455 chips but
WinPic
done well, see the picture below.

Using WinPic for programming PIC18F245X controllers got some
pitfalls. One of them is that it doesn't check the configuration word
properly, as the devices have user-configurable memory space from
300000h-30000Dh, see table below. Two config registers are missing,
namely CONFIG3L(300004h) and CONFIG4H(300007h). PICkit2 is aware about that and handles it
properly, but WinPic is trying to program it as contiguous memory block
and failing on verification.
|
Memory Address |
Bit7 |
Bit6 |
Bit5 |
Bit4 |
Bit3 |
Bit2 |
Bit1 |
Bit0 |
|
300000h |
CONFIG1L |
— |
— |
USBPLL |
CPUDIV1 |
CPUDIV0 |
PLLDIV2 |
PLLDIV1 |
PLLDIV0 |
|
300001h |
CONFIG1H |
IESO |
FCMEN |
— |
— |
FOSC3 |
FOSC2 |
FOSC1 |
FOSC0 |
|
300002h |
CONFIG2L |
— |
— |
VREGEN |
BORV1 |
BORV0 |
BOREN1
|
BOREN0
|
PWRTEN
|
|
300003h |
CONFIG2H
|
— |
— |
— |
WDTPS3
|
WDTPS2
|
WDTPS1
|
WDTPS0
|
WDTEN |
|
300005h |
CONFIG3H
|
MCLRE |
— |
— |
— |
— |
LPT1OSC
|
PBADEN
|
CCP2MX
|
|
300006h
|
CONFIG4L
|
DEBUG |
XINST |
ICPRT |
— |
— |
LVP |
— |
STVREN
|
|
300008h
|
CONFIG5L
|
— |
— |
— |
— |
— |
CP2 |
CP1 |
CP0 |
|
300009h
|
CONFIG5H
|
CPD |
CPB |
— |
— |
— |
— |
— |
— |
|
30000Ah
|
CONFIG6L
|
— |
— |
— |
— |
— |
WRT2 |
WRT1 |
WRT0 |
|
30000Bh |
CONFIG6H
|
WRTD
|
WRTB |
WRTC |
— |
— |
— |
— |
— |
|
30000Ch |
CONFIG7L
|
— |
— |
— |
— |
— |
EBTR2 |
EBTR1 |
EBTR0 |
|
30000Dh |
CONFIG7H
|
— |
EBTRB |
— |
— |
— |
— |
— |
— |
The simple solution would be just inject two extra lines in Hex file
to avoid WinPic confusion:
:0100000034CB
:010001000EF0
:010002003FBE
:010003001EDE
:0100040000FB
:01000500807A
:01000600C138
:0100070000F8
:0100080008EF
:0100090000F6
:01000A000FE6
:01000B00E014
:01000C000FE4
:01000D0040B2
:00000001FF
|