ORG PIC16CXXX Example
Directives highlighted in this example for PIC16CXXX 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=16f877 ;Select the device.
#include <p16f877.inc> ;Include standard header file
;for the selected device.
org 0000 ;The following code will be
;placed in reset address 0.
goto Main ;Jump to an address whose label
;is 'Main'.
org 0004 ;The following code will be
;placed in interrupt address 4.
goto int_routine ;Jump to an address whose label
;is 'int_routine'.
org 0010 ;The following code section will
;placed starting from address 10H.
Main
; ;Write your main program here.
;
;
goto Main ;Loop back to 'Main'.
org 0100 ;The following code section will
;be placed starting from address
;100H.
int_routine
;
; ;Write your 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 da "PICwithFLASH" ;6 program memory locations
;(starting from 1000h) will
;be filled with six 14-bit
;packed numbers, each
;representing two 7-bit ASCII
;characters.
org 2100 ;The absolue address 2100h is
;mapped to the 0000 location of
;EE data memory in PIC16Fxxx.
;You can create a data or
;character table starting from
;any address in EE data memory.
ch_tbl2 de "PICwithFLASH" ;12 EE data memory locations
;(starting from 0) will be
;filled with 12 ASCII
;characters.
end
Microchip Technology Inc. Microchip's Web Site Voice: (480) 792-7200 Fax: (480) 899-9210 Microchip's E-mail Address |