-
PICList: Subscribe to the PICList
http://www.piclist.com. Don't post, just read for a while.
-
PIC: Select a chip and
buy one.
-
The simplest chip to program, find code for, learn on is the
16F84,
-
More bang for the buck is the
16F877 and it is mostly code
compatible with the 'F84.
-
The most bang for the buck is the 18F series chips and they have many new
and advanced features.
-
Static - don't touch the pins without grounding yourself.
-
Programmer Find a programmer
that supports your chip.
(The exhaustive list of all known programmers is at
/techref/microchip/devprogs.htm )
-
DO NOT ENABLE CODE PROTECTION! No, it can't be undone. You will have
to replace the chip. Read the documentation on your programmer to figure
out how to avoid this.
-
Read Goto
http://www.microchip.com find, download
and read the datasheet for your chip from cover to cover. Read Jim's
introduction to the PIC, the
PIC FAQ and ask questions on the
PICList if you don't understand something. If your
brain is completely fried at this point, don't worry, lots of top-notch engineers
have been also. Here are some other ideas:
-
Intros and Tutorials,
-
Understanding & Programming the
PIC16C84 by Jim Browns (also at:
http://talkingelectronics.com/html/PIC-for-Beginners.html) is
the classic intro to the classic PIC16C84. The chip is still available as
the 16F84A and the tutorial is still quite valid although it refers to figures
in an older version of the Microchip datasheets cached here:
30445B.PDF.
-
CHEAPIC by Stan Ockers [ockers at
anl.gov] getting started and some nice projects.
-
The PIC Source
Book explains PIC programming in terms of the
BASIC Stamp
-
A Beginner's simple Bike Computer
project by Fred Maher includes PIC programming, making PCB's circuit
design, everything.
-
http://www.voti.nl/swp/index_1.html Starting with
PICmicro controllers (C) 2002 Wouter van Ooijen
-
http://amqrp.org/elmer160/lessons/
"PIC Elmer 160 Course Lessons" by John McDonough, WB8RCR
is a *very* detailed "click
here, press that button" introduction. Gives step-by-step instructions, with
screenshots, for downloading and using MPLAB, programming the PIC, single-step
debugging, I/O, and subroutines.
-
http://homepage.ntlworld.com/matthew.rowe/micros/dosgear.htm
A nice startup page with a (frighteningly) simple programer, DOS software
and a sample program
-
http://www.cq-tv.com/articles/picprog.htm
Brian Kellys brief introduction
-
http://www.dhmicro.com/prod_fedc.html
is a good downloadable beginners' tutorial that is PIC
C language specific. As a C newcomer
I found this one the most user-friendly and encouraging source.
-
http://www.interq.or.jp/japan/se-inoue/e_pic.htm
(cached
20010731113152)
If you can get past the poor English, this is a nice site. Does anybody have
the time or desire to help him out with his English translations?
-
Books: there are a lot of good
books about the PIC
-
Courses: some universities offer courses in embedded design.
-
Starting Projects:
http://www.piclist.com/projects
-
Language: Select a development
language. Many years ago everyone used assembly language because there
was no alternative. A few years ago many people used assembly language because
the alternatives were expensive. Now there are lots of alternatives, many
of them free. See development
language.
-
Start with very simple code like a LED coming on when a switch is
pressed, and build from this once it is working.
-
Don't Float: Tie the switch
pin Hi or Lo with a ~10K resistor or use internal pullups to avoid
floating inputs when the switch is open. In general,
do something with unused pins don't just
leave them floating
-
TRIS - make sure they are set
properly for in/out pins.
-
Debounce the switches to avoid false switch states.
-
RA4 on a 16F84 is "open collector" - it can pull to ground but will
not pull up to Vcc. You can still use it to drive LEDs by hanging
the LED & resistor between RA4 and +5V supply. (anode to +5V) This means
that the logic is now inverted; 1 = off and 0 = on
-
Diasble WDT if not needed
-
Check MCLR is connected to Vcc
-
Connect ALL Vcc and Vdd pins. Not just one of
each.
-
Make sure Osc fuses are set for your type
of oscillator, crystal (XT), RC (RC),
resonator (HS). etc
-
Sample code for most common applications (including serial io, LCD
interfaceing, keyboards, the internet, etc...) are available at the
PICList FAQ
http://www.piclist.com/faq
-
When your code doesn't work:
-
Set the entire program aside, find a way to seperate just a small, but functional
part of it and get that part working. Then, slowly add in the rest of the
code from the original program, testing and debugging each addition, untill
you have the entire program working
-
Comment each and every line of the code with what you think it is doing,
and then check the datasheet against your comments.
-
Post the commented code to the piclist with a subject line of "[PIC]: What
am I missing in this code?"
-
For good ideas on second and third projects, see:
http://www.piclist.com/projects. Good starting
projects with lasting value.
Still not getting anything to work? Try
If you are going to do this for a living, see the
begining engineers checklist
Questions:
-
-
-
-
-
visn@wbs.co.za
asks:
Nearly the end of 2007 and I want to get back into PICS
16F628 @ 1 , 16F88 @ 1.9(*price of 628) 16F873 @ 2.1 , 16F877 @ 2.9 and the
USB 18F4550 @ 3x.
Is the 628 still a drop in for the 84, or is the 88 a better bet to invest
a few?.
18F4550 is tempting, but I can't choose between that , the 877 , and the
AVR MEGA8-16 @ 0.8 (price of 628).
And my f84 programmer was dos based and is in pieces.
I want to know , though, the best drop in for the F84- F628?-or F88?
James
Newton replies: I think it's a toss up and depends more on what sort
of development you want to do in the future. If USB is important, go with
that, and so on.
-
-
tommowas@hotmail.com - hi ppl.
i have a problem with understanding the goto command.. i have encountered
source code which goes to a subroutine and then that subroutine has a 'return'
or 'retlw' in it. does goto work the same way as call? could someone please
explain its difference. regards. sorry about the double post.
James
Newton replies: See the
instruction list section of the
datasheet for the processor you are using for the exact action of the goto,
call, return, and retlw commands.
-
madyg@excite.com
asks: " the Pic can see a "1" or a "0" however
how can a Pic "see" the middle position of a 3 state dip sw?"
James
Newton replies: Assuming there is a 1k resistor between the switch
and the pin, set the pin as an output, pull it low then immediatly switch
back to an input and read the value. If it stayed low, repeat the process
but pull it high instead. If it stays where you put it, the switch is in
the middle.
This is making use of the pins own internal capacitance and would be more
reliable with a small cap between the pin and ground. At that point you basically
have an RC circuit such as is used in a sigma-delta A to D converter or the
POT command used in the BASIC STAMP.
See also:
Archive:
Comments:
See:
Bert
van Dam Says:
http://members.home.nl/b.vandam/lonely/index.html
Has lot's of information including a 'Getting started'and 'Tutorial' section
for beginners using JAL as PIC language. Also contains may pages for intermediate
and experts.
Interested: