Understanding & Programming the PIC16C84
(now 16F84A)
A beginners tutorial
Jim Brown BSc(Eng), HDipEdAd, GDE (Wits)
RTF --> HTML Translation by: Dan Creagan
HTML cleanup and breakup by: James Newton
Contents at a Glance
I'm a beginner at PIC wit the pic16c63 and the tutorial is very useful for
me. Thanks, Mario
Questions:
-
m.a.metcalfe-02@student.lboro.ac.uk
asks: " The current version of MPLAB from Microchip doesnt support the C84.
Is there an equivelant chip which i can select from its list? "
Yes the F84
-
sujith_pic@rediffmail.com
asks:
I am new to PIC programming. Is there any good links from which i can learn
the basics of PIC programming in C. I have downloaded MPLAB from microchip.
Can you plese guide me where to start from.
-
-
/techref/microchip/begin.htm
Comments:
-
In the beginning, MPLAB is recommended. For those of us without a Windows
computer, there are gpsim and gputils.
-
in 1985 i got my first computer (a commodore 64) at the age of 14. at that
age you learn fast and by the time i was 15 i could program in basic and
assembly using a machine code monitor. when i reached 16 i realised i was
somewhat of a nerd,sold the commodore 64 and took up drinking,smoking ,women
and started my apprenticeship as an electrician. by the time i was 23 a ressesion
had hit the uk and unemployment was high and lots of people were claiming
state benefit including me. during my boredom i realised that i should have
carried on with the computing when i was 16 and made a career out of it.
pc's were at this point were just begginng to take over from the miriad of
different computer companies (whose software only worked on their platform(not
suprising they all went bust really apart from mac whole survived
somehow))vaguely remembering the basics of of my teenage programming years
i searched the second hand pages for a by then outdated commodore 64 which
i found and purchased for next to nothing i got a few old books from the
library and remastered programming the c64 in no time. i wrote a program
in assembly which made a tank sprite (younger people will be be wondering
what a sprite is :-) )move around the screen controlled via a joystick. at
the time i thought how easy it would be to write a game for the commodore
but its an outdated computer and it would not sell so not being able to afford
a pc(which then would have been something pathetic like a 386/486 sx 50mhz
which is only good for the bin these days)i gave it up. by the time i was
26 i could afford a pc and bought a 120mhz pentium and was completely puzzled
by the whole windows operating system which seemed to mask any way of programming
the damded thing,the windows learning curve started there. in 2001 at the
age of 30 i realised that i had been working as an electrician for 14 years
and was still no better off moneywise than i was when i left school at 16
so i started back at college on a 2 year hnc course in electronic engineering
(1/3 of a degree)now in 2002 i am very conversant with windows, and also
due to my first year hnc,logic/boolean algebra/c programming(borland turbo
c 3.0) i have given you possibly too much history before cutting to the chase
but its fairly relevent. i recently purchased a 16f84a kit and soldered it
together the software that came with the kit was terrible (lights.pic) which
came as a .pic file (whatever one of those is)which then had to be converted
into a .hex file through some terrible dos program and uploaded to the pic
chip via a prog called picall.exe i was completely suprised that it worked
at all but it did work...it made 5 led's flash in a binary count.....woopy
doo , no programming tutorial or nothing . so i scoured the net for info
but everything i came across seemed to be aimed towards intermediate/expert
thank the lord i found this site i was on the verge of giving it up and binning
the 16f84a
Great site. One thing i found was when i wrote your first example program
sample.asm and tried to build it i got a cannot find .hex message when i
looked closer 3 lines needed altering H'10' H'15' and H'08' needed changing
to 0010h 0015h and 0008h then it worked perfectly. one thing i have noticed
whilst trying to find info on how to program the damnded pic is that programming
instructions have altered,the c programming instructions which i have recently
learnt seem different to the ones listed in examples which seem foriegn to
me. and ok i can accept this one since i learnt to program assembly on a
system developed 20 years ago, but why replace an easy to understand instruction
(opcode) such as lda #ff (load accumulator with hex ff) with movlw 00ffh
i originally remeber the x and y registers . did someone suddenly decide
to call the accumulator the w register? and sta #$0400 (store accumulator
at hex address 0400) seems much easier to me than movwf 0400h,f and why has
the command jmp been replaced by the BASIC command goto? well you can look
at my comments in a light hearted way and laugh thats why i basically put
this message up but any help would be greatly appreciated. i really wish
i had carried on at 16 because i would have been on top of things now and
been something of an expert but things have developed rapidly and i find
that as hard as i try to get a full understanding of things technology seems
to be increasing at a faster rate than my learning capabilities can cope
with. sound familier to anyone? :-)
next