PIC's by assmbler

For stand-alone microprocessors

PIC's by assmbler

Postby Starfire » Mon Jun 20, 2011 12:16 pm

This tutorial runs in parallel with Doug and William but present the PIC from an assembler viewpoint and uses a 10f200 most basic micro.
It is a fundamental primer to understanding and using PIC's and provides the basics which allow more sophistic programming to be learned and undertaken. It is not intended to cover all the possibilities or high level language but kick -start the learning process and provide a bit of fun making them work.
You have two basic things to learn – the assembler and the instruction set of the computer (chip) to programme
also how to count in hex and binary and in addition some other related things such as Mplab and the programmer software also some basic maths.

Here goes - So you think you know how to count, do you?


There is a difference between a quantity of something and a number used to express that quantity.

You can have a Quantity of oranges or a Quantity of cash but ' how many or how much?' needs a number to express this.

There are many ' Number ' systems which can be used to express this Quantity – typical a binary, an octal, a decimal, a hexadecimal or even a Roman etc.
Computers only work with Binary but it is difficult for a human to.
Humans are more comfortable with hexadecimal which is easy to convert from binary so we need to be able to convert between systems.

:( - Decimal is very awkward and impossible for a computer to use and difficult to convert from binary in your head, so like it or lump it – you just gotta learn these other systems.

Oh! - one other thing – the greatest invention in mathematics is the ' Zero ' - it was introduced by a man call Fabonacci in 1202 and has more importance for computers than for other systems – try counting in an other system that doesn't use a Zero such as Roman to see how difficult it is.

OK so lets see different number systems expressing the same quantity;-

binary Octal Decimal Hexadecimal
0 0 0 0
1 1 1 1
10 2 2 2
11 3 3 3
100 4 4 4
101 5 5 5
110 6 6 6
111 7 7 7
1000 10 8 8
1001 11 9 9
1010 12 10 A
1011 13 11 B
1100 14 12 C
1101 15 13 D
1110 16 14 E
1111 17 15 F
10000 20 16 10
10001 21 17 11
10010 22 18 12
10011 23 19 13
10100 24 20 14

You will notice there is no number 8 in the octal system or a symbol greater than 1 in a binary – the base limits the symbols that the system has.

A hexadecimal system has 16 symbols but the A,B,C,D,E,F in this context are numbers not letters as you are used to. (fun to get your head around) A decimal system has ten because you have ten fingers. ( I hope :)

Any quantity can be expressed in different number systems for example a quantity of 10100 apples in binary is the same amount as 20 apples in decimal ( the system you normally use) or 24 in octal or 14 in hex ( hexadecimal is normally abbreviated to hex ) each of these numbers is the same quantity and legit if the base is stated .

Key words are;-

Quantity
amount
number
numbers are symbols used to express quantity.

What's a base? - put simply a Radix, it defines the system you are using to count eg;- base '2' for binary – base '16' for hex or base '10' for decimal or base '8' for octal ( you normally presume base Ten for decimal and don't state it )

So now you can count the same quantity in different systems - aren't you a bright chap? ;)
Starfire
 
Posts: 143
Joined: Thu Aug 05, 2010 4:26 pm
Location: North Ireland

Return to Embedded software

Who is online

Users browsing this forum: No registered users and 2 guests

cron