Specifications

http://www.mikroelektronika.co.yu/english/product/books/PICbook/4_Poglavlje.htm
Since this data isn't important for the assembly translator, it is written as comments. It should be
noted that a comment always begins with a semicolon and it can be placed in a new row or it can
follow an instruction.
After the opening comment has been written, the directive must be included. This is shown in the
example above.
In order to function properly, we must define several microcontroller parameters such as: - type
of oscillator,
- whether watchdog timer is turned on, and
- whether internal reset circuit is enabled.
All this is defined by the following directive:
_CONFIG _CP_OFF&_WDT_OFF&PWRTE_ON&XT_OSC
When all the needed elements have been defined, we can start writing a program.
First, it is necessary to determine an address from which the microcontroller starts, following a
power supply start-up. This is (org 0x00).
The address from which the program starts if an interrupt occurs is (org 0x04).
Since this is a simple program, it will be enough to direct the microcontroller to the beginning of a
program with a "goto Main" instruction.
The instructions found in the Main select memory bank1 (BANK1) in order to access TRISB
register, so that port B can be declared as an output (movlw 0x00, movwf TRISB).
The next step is to select memory bank 0 and place status of logic one on port B (movlw 0xFF,
movwf PORTB), and thus the main program is finished.
We need to make another loop where the micro will be held so it doesn't "wander" if an error
http://www.mikroelektronika.co.yu/english/product/books/PICbook/4_Poglavlje.htm (5 of 15) [4/2/2003 16:18:10]