PIC assembly.

inman inman at interpath.com
Sat Nov 20 15:36:17 CET 1999


Bill Layer wrote:
> I don't blame anyone who doesn't want to write in assembler; I'm currently
> re-learning it. Still, this PIC code is much easier than 6502 was...

I knew C when I started to learn PIC assembler.  The most daunting part of
learning Assembly was my belief -- based on the wierd little words used --
that this was completely different programming.  It wasn't until I figured
out that everything was the same that it clicked for me:

Declare you variables
Give them values
Start your program
Run some values through functions (sometime return a value, sometimes not)
Loop a function a couple of times
Stop the program

The only difference is instead of reading in numbers like 275.34, you read
in numbers like 0 ... or (my favorite) 1.  Instead of writing long strings
like "Your summarized data are contained in the file c:\newdata.txt," you
send out signals like 0... or 1.

The best book I have seen for helping an experienced programmer move to
assembly is Jim Peatman's Design with Pic Microcontrollers.  Many books
are good for a gentle touch beginner (the Square One books or PIC: Your
Personal Introductory Course).  But Peatman's book starts out by showing 
you how to structure an assembly program like C code with a Main function 
and all of the disciplined style rules most programmers know.  The only
shortcoming of the book is that it does not cover the F84 PIC most
people experiment with.  However, the basic chapters on structuring code
may help a byte programmer get down to the bit.

Elliot

PS.  After weeks of reading the Microchip handbook and Easy PicN', I 
still did not know the assembly commands and special registers.  I finally 
tried the 3rd grader learning multiplication method:  Put the command on 
one side of a notecard and the meaning on the other and test, test, test 
forwards and backwards.  I learned them all in about 2 lunch hours.  I 
would suggest that if you want to learn assembly, this method is best.  
Until you get all 35 commands in your head, you will forever be lost for 
anything but, as someone noted, "blinky" programming.  You can't read 
other people's code and you may underestimate the power of the PIC to do 
what you would like it to do.

PSS.  Never underestimate the fun of making LED's blink at your command.
Wasn't it God who said, "Let there be... a red LED every 2 seconds"? :-)



More information about the Synth-diy mailing list