Download Assembler/Linker/Librarian User's Guide

Transcript
Directives
4.51.7
PIC18 Application Example - org
This example shows the usage of the org directive. Code generation begins at an
address specified by org address. The origin of a data table also can be specified by
this directive. A data table may be placed either in a program memory region or in an
EE data memory region, as in case of a PIC1X device with EE data FLASH.
#include p18f452.inc
;Include standard header file
;for the selected device.
org
0x0000
goto
Main
;The following code will be
;programmed in reset address 0.
;Jump to an address whose label is
;'Main'.
org
0x0008
goto
int_hi
org
0x0018
goto
int_lo
org
0x0020
Main
;
;
;
goto
org
ch_tbl1
;The following code section will
;be programmed starting from
;address 20H.
Main
;Loop back to 'Main'
0x0100
;The following code section will
;be programmed starting from
;address 100H.
;Write your high priority
;interrupt service routine here.
;Return from interrupt.
0x0200
int_lo
;
;
;
retfie
org
;The following code will be
;programmed in low priority
;interrupt address 18h.
;Jump to an address whose label is
;'int_lo'.
;Write your main program here.
int_hi
;
;
;
retfie
org
;The following code will be
;programmed in high priority
;interrupt address 8.
;Jump to an address whose label is
;'int_hi'.
;The following code section will
;be programmed starting from
;address 200H.
;Write your low priority
;interrupt service routine here.
;Return from interrupt.
0x1000
db
;You can create a data or
;character table starting from any
;address in program memory. In
;this case the address is 1000h.
"PICwithFLASH"
end
 1994-2013 Microchip Technology Inc.
DS33014L-page 143