ORG PIC18CXXX Example
Directives highlighted in this example for PIC18CXXX devices are:
Program Functional Description
This example shows the usage of the
org
directive. Code generation begins at an address spcified byorg
<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 PICmicro device with EE data FLASH.Commented Code Listing
list p=18c452 ;Select the device.
#include <p18c452.inc> ;Include standard header file
;for the selected device.
org 0000 ;The following code will be
;programmed in reset address 0.
goto Main ;Jump to an address whose label is
;'Main'.
org 0008 ;The following code will be
;programmed in high priority
;interrupt address 8.
goto int_hi ;Jump to an address whose label is
;'int_hi'.
org 0018 ;The following code will be
;programmed in low priority
;interrupt address 18h.
goto int_lo ;Jump to an address whose label is
;'int_lo'.
org 0010 ;The following code section will
;be programmed starting from
;address 10H.
Main
; ;Write your main program here.
;
;
goto Main ;Loop back to 'Main'
org 0100 ;The following code section will
;be programmed starting from
;address 100H.
int_hi
;
; ;Write your high priority
; ;interrupt service routine here.
retfie ;Return from interrupt.
org 0200 ;The following code section will
;be programmed starting from
;address 200H.
int_lo
;
; ;Write your low priority
; ;interrupt service routine here.
retfie ;Return from interrupt.
org 1000 ;You can create a data or
;character table starting from any
;address in program memory. In
;this case the address is 1000h.
ch_tbl1 db "PICwithFLASH"
end
Microchip Technology Inc. Microchip's Web Site Voice: (480) 792-7200 Fax: (480) 899-9210 Microchip's E-mail Address |