Teknik Upload Program ke PIC

From OnnoWiki
Revision as of 07:40, 14 December 2009 by Onnowpurbo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Sumber: http://speakyssb.blogspot.com/2009/08/pic-programing-for-aprs-tracker.html

PIC programmer for APRS tracker
I am getting "digital"!!!

Funny thing was when I studied electronics I always considered digital being a subset of the real electronics. Having already done some digital circuit's I did see that was not all that 0 and 1's.

I wanted to make a bicycle mobile APRS setup, considered buying one allready made but that is half the fun an double the price. Searching for some aprs trackers settled by the standard "tinytrack" got the software and bough some PIC's (eventually some will get hurt!) For the PIC programing you have to have a PIC programmer... decided to make the simplest (not always a good choice) PIC programmer I could find.

Picprog.JPG
Picprogrammer.jpg

This time I made the circuit in a prototyping board since I was easy to remove the pic after programing and "zif" socket's were out of stock in my local electronics shop. The board still had in place one 555 IC and a photo transistor but honestly I can't remember what was it... an light controlled oscillator or something similar..

The circuit worked first time (had no 5V6 zener so placed a 5V1) but before real programing I had to compile the picrogr-1.9.0 software on my primary Linux system, if you don't use Linux, IRIX, AIX, SunOs (love them all, but Linux is cheaper) or any Unix like....I am sorry for you, can't help you, you are on your own with that buggy lousy operating system called.... :) I even can't write it's name but starts with a "W".

On a shell you can do like this, assuming you downloaded the picprog software (Thank you Jaakko Hyvätti for the software):

gunzip picprog-1.9.0.tar.gz
tar xvf picprog-1.9.0.tar
cd picprog-1.9.0
make dep
make
make install

Connected the programing circuit to the computer first serial port ( /dev/ttyS0 ) with the PIC16F84-4 already in the circuit and decided to read it's contents:

[root@work2 proj]# picprog --output 16f84-1.hex --pic /dev/ttyS0 
Picprog version 1.9.0, Copyright © 2008 Jaakko Hyvätti
Picprog comes with ABSOLUTELY NO WARRANTY; for details
type `picprog --warranty'. This is free software,
and you are welcome to redistribute it under certain conditions;
type `picprog --copying' for details.

Trying realtime priority 1
Bound to CPU 0
Using >1 µs delays. --rdtsc may work for faster timings.
/dev/ttyS0: id 0x0560: detected pic16f84a version 0x00
Device pic16f84a, program memory: 1024, data memory: 64.
Reading program memory,
reading data memory,
reading id words,
reading fuses,
done.

This will create a file, "16f84-1.hex", with the original contents of the PIC.

Now let's write!!! but it's better to erase the blody thing with the following command:

picprog --pic /dev/ttyS0 --erase --burn

If you don't follow this step you probably end up in a "ff0002:unable to read pic device id" error... I did...

Let's do the real writing now:

[root@work2 proj]# picprog --input-hexfile TinyTrak_1.6.hex --pic /dev/ttyS0 --burn
Picprog version 1.9.0, Copyright © 2008 Jaakko Hyvätti
Picprog comes with ABSOLUTELY NO WARRANTY; for details
type `picprog --warranty'. This is free software,
and you are welcome to redistribute it under certain conditions;
type `picprog --copying' for details.
Trying realtime priority 1
Bound to CPU 0
Using >1 µs delays. --rdtsc may work for faster timings.
/dev/ttyS0: id 0x0560: detected pic16f84a version 0x00
Device pic16f84a, program memory: 1024, data memory: 64.
Burning program memory, 999 locations,
burning data memory, 46 locations,
burning id words, 0 locations,
burning fuses, 1 location,
done.

Look's like it's done, next is to see if we can read and if the reading's output is the same as what was programed....and off course remove the pic an make the final board for the aprs tracker....

picprog --output 16f84-programed-tiny.hex --pic /dev/ttyS0 --ihx32

:020000040000FA
:100000005B2BFF3FFF3FFF3F9600030E97000A0860
:1000100098000A108A1083123F309C1A1D08810232
:1000200019089A071A0C95003F39951A403C2E2062
:10003000151B103C95000608F039150486009C0B32
:1000400026281B089900941420309C000B111808D6
:100050008A00170E8300960E160E090082070834D8

And the initial contents of the original file:

:020000005B2B78
:080008009600030E97000A08A0
:1000100098000A108A1083123F309C1A1D08810232
:1000200019089A071A0C95003F39951A403C2E2062
:10003000151B103C95000608F039150486009C0B32
:1000400026281B089900941420309C000B111808D6
:100050008A00170E8300960E160E090082070834D8


Looking to booth header's there are diferences but after it's the same so I guess it's ok... I will have to read more on PIC's to explain it but that's for when I found digital electronic's a litle more fun.

Now it's just a mather of making the final board for the aprs tracker.... but that's for another day.

Further reading:

http://pic16f84.hit.bg/ - schematic used
http://www.grennan.com/picprog/ - another diferent schematic
http://hyvatti.iki.fi/~jaakko/pic/picprog.html#3 - picprog info (RTFM)
http://www.qsl.net/zl1vfo/tinytrak/tinytrak.htm - tinytrack hex files

Some info on my Linux system:

serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
model name : Intel(R) Pentium(R) 4 CPU 3.06GHz
Fedora Core release 6 (Zod)
BIOS version 1.2 Flags 0x07 (Driver version 1.16ac)


Pranala Menarik