Specifications
mikroElektronika | Free Online Book | PIC Microcontrollers | Appendix A: Programming a Microcontroller
● TOC
● Introduction
● Ch. 1
● Ch. 2
● Ch. 3
● Ch. 4
● Ch. 5
● Ch. 6
● Ch. 7
● Ch. 8
● Ch. 9
● App. A
● App. B
● App. C
Appendix A: Programming a Microcontroller
Microcontrollers and humans communicate through the medium of the programming language called Assembly language.
The word Assembler itself does not have any deeper meaning, it corresponds to the names of other languages such as
English or French. More precisely, assembly language is only a passing solution. In order that the microcontroller can
understand a program written in assembly language, it must be compiled into a language of zeros and ones. Assembly
language and Assembler do not have the same meaning. The first one refers to the set of rules used for writing program for
the microcontroller, while the later refers to a program on a personal computer used to translate assembly language
statements into the language of zeros and ones. A compiled program is also called Machine Code. A "Program" is a data file
stored on a computer hard disc (or in memory of the microcontroller, if loaded) and written according to the rules of
assembly or some other programming language. Assembly language is understandable for humans because it consists of
meaningful words and symbols of the alphabet. Let us take, for example the command "RETURN" which is, as its name
indicates, used to return the microcontroller from a subroutine. In machine code, the same command is represented by a
14-bit array of zeros and ones understandable by the microcontroller. All assembly language commands are similarly
compiled into the corresponding array of zeros and ones. A data file used for storing compiled program is called an
"executive file", i.e. "HEX data file". The name comes from the hexadecimal presentation of a data file and has a suffix of
"hex" as well, for example "probe.hex". After has been generated, the data file is loaded into the microcontroller using a
programmer. Assembly language programs may be written in any program for text processing (editor) able to create ASCII
data files on a hard disc or in a specialized work environment such as MPLAB described later.
ELEMENTS OF ASSEMBLY LANGUAGE
http://www.mikroe.com/en/books/picmcubook/appa/ (1 of 21)5/3/2009 11:35:35 AM