You are on page 1of 3

Serial Port Professional PIC Programmer

G Home
G PIC Simulator IDE
G Z80 Simulator IDE
G 8085 Simulator IDE
G Downloads
G Licenses
G Comments
G Cities
G About the Author
G Contact Form


Serial Port Professional PIC Programmer


The PIC programmer project presented here is intended to be used by more experienced
developers who already have access to a simple PIC programmer, because the programmer
hardware is built around one 16F628A microcontroller that has to be preprogrammed with
firmware. The presented solution uses PC's serial port for reliable communication
between the programming software and 'intelligent' PIC programmer hardware.
Here is the list of currently supported flash devices from Microchip PICmicro product
line: 12F629, 12F675, 16F627, 16F627A, 16F628, 16F628A, 16F630, 16F648A, 16F676,
16F72, 16F73, 16F74, 16F76, 16F77, 16F737, 16F747, 16F767, 16F777, 16F83, 16F84,
16F84A, 16F87, 16F88, 16F818, 16F819, 16F870, 16F871, 16F872, 16F873, 16F873A,
16F874, 16F874A, 16F876, 16F876A, 16F877 and 16F877A.

OshonSoft.com Serial Port Professional PIC Programmer software is very easy to use and
works on all Windows platforms. It is free software and you can download it here (the
current version is 1.8) - download. PIC Simulator IDE should also be installed on your PC
prior to using this programming software.
The programmer firmware is given in the form of Basic source program that has to be
compiled with PIC Simulator IDE integrated Basic compiler to get the HEX file ready to
be programmed into an erased microcontroller. The correct microcontroller model needs
to be selected - 16F628A, and the selected clock frequency is supposed to be at least
http://www.oshonsoft.com/picprogpro.html (1 of 3)10/9/2005 10:50:43 PM
Serial Port Professional PIC Programmer
8MHz.

Here are the proposed programmer hardware schematics (also available from the
Hardware menu of the programming software) and the photo of my PIC programmer
prototype.

http://www.oshonsoft.com/picprogpro.html (2 of 3)10/9/2005 10:50:43 PM
Define CONF_WORD = 0x3f62
Define ALLOW_ALL_BAUDRATES = 1
Symbol clock = PORTB.4
Symbol data = PORTB.5
Symbol vpp = PORTB.6
Symbol vdd = PORTB.7
Symbol datadir = TRISB.5
TRISB = 0x0f
Gosub clock0
Gosub data0
Gosub vdd0
Gosub vpp0
Hseropen 56000
Dim bit1 As Bit
Dim byte1 As Byte
Dim word1 As Word
bit1 = 0
byte1 = 0
word1 = 0
Dim i As Byte
Dim in1 As Byte
loop:
Hserin in1
If in1 = 100 Then
Gosub eraseall
Endif
If in1 = 101 Then
Gosub enter
Endif
If in1 = 102 Then
Gosub exit
Endif
If in1 = 103 Then
Gosub delay3
Endif
If in1 = 104 Then
Hserin byte1
Gosub send6
Endif
If in1 = 105 Then
Hserin word1
Gosub send14
Endif
If in1 = 106 Then
Gosub get14
Hserout word1
word1 = 0
Endif
Hserout in1
Goto loop
End
eraseall:
Gosub enter
'erase program memory
byte1 = 0x02
Gosub send6
word1 = 0x3fff
Gosub send14
byte1 = 0x01
Gosub send6
byte1 = 0x07
Gosub send6
byte1 = 0x08
Gosub send6
Gosub delay3
byte1 = 0x01
Gosub send6
byte1 = 0x07
Gosub send6
'erase data memory
byte1 = 0x03
Gosub send6
word1 = 0x3fff
Gosub send14
byte1 = 0x01
Gosub send6
byte1 = 0x07
Gosub send6
byte1 = 0x08
Gosub send6
Gosub delay3
byte1 = 0x01
Gosub send6
byte1 = 0x07
Gosub send6
'erase configuration word
byte1 = 0x00
Gosub send6
word1 = 0x3fff
Gosub send14
For i = 1 To 7
byte1 = 0x06
Gosub send6
Next i
byte1 = 0x08
Gosub send6
Gosub delay3
byte1 = 0x06
Gosub send6
Gosub exit
Return
send6:
bit1 = byte1.0
Gosub send1
bit1 = byte1.1
Gosub send1
bit1 = byte1.2
Gosub send1
bit1 = byte1.3
Gosub send1
bit1 = byte1.4
Gosub send1
bit1 = byte1.5
Gosub send1
byte1 = 0
Return
send14:
bit1 = 0
Gosub send1
byte1 = word1.LB
Gosub send6
byte1 = word1.LB
bit1 = byte1.6
Gosub send1
bit1 = byte1.7
Gosub send1
byte1 = word1.HB
Gosub send6
bit1 = 0
Gosub send1
word1 = 0
Return
send1:
Gosub clock1
If bit1 Then
Gosub data1
Else
Gosub data0
Endif
Gosub clock0
Gosub data0
bit1 = 0
Return
get14:
datadir = 1
word1 = 0
byte1 = 0
Gosub get1
bit1 = 0
Gosub get1
byte1.0 = bit1
Gosub get1
byte1.1 = bit1
Gosub get1
byte1.2 = bit1
Gosub get1
byte1.3 = bit1
Gosub get1
byte1.4 = bit1
Gosub get1
byte1.5 = bit1
Gosub get1
byte1.6 = bit1
Gosub get1
byte1.7 = bit1
word1.LB = byte1
byte1 = 0
Gosub get1
byte1.0 = bit1
Gosub get1
byte1.1 = bit1
Gosub get1
byte1.2 = bit1
Gosub get1
byte1.3 = bit1
Gosub get1
byte1.4 = bit1
Gosub get1
byte1.5 = bit1
word1.HB = byte1
byte1 = 0
Gosub get1
bit1 = 0
datadir = 0
Return
get1:
Gosub clock1
bit1 = data
Gosub clock0
Return
enter:
Gosub vdd1
Gosub vpp1
Return
exit:
Gosub vpp0
Gosub vdd0
Return
vdd1:
vdd = 1
Gosub delay2
Return
vdd0:
Gosub delay2
vdd = 0
Return
vpp1:
vpp = 1
Gosub delay2
Return
vpp0:
Gosub delay2
vpp = 0
Return
clock1:
Gosub delay1
clock = 1
Gosub delay1
Return
clock0:
Gosub delay1
clock = 0
Gosub delay1
Return
data1:
data = 1
Return
data0:
data = 0
Return
delay1:
'clock delay
WaitUs 3
Return
delay2:
'enter & exit delay
WaitMs 50
Return
delay3:
'write delay
WaitMs 8
Return
Serial Port Professional PIC Programmer


The photo will be available

http://www.oshonsoft.com/picprogpro.html (3 of 3)10/9/2005 10:50:43 PM