PAGESEL Example

MPASM Assembler

PAGESEL Example

Directives highlighted in this example are:

  • pagesel

Program Functional Description

This program demonstrates the utility of the pagesel directive, which generates the appropriate code to set/clear PCLATH bits

Commented Code Listing

list p=16f877 ;Select the device.

#include <p16f877.inc> ;Include standard header file

;for the selected device.

RST CODE H'0' ;The code section named RST

;is placed at H'0'. The

;instruction 'goto start' is

;placed in code section RST.

goto start ;Jumps to the location labelled

;'start'.

INTRT CODE H'4' ;The code section named INTRT is

;placed at H'4'. The instruction

;'goto service_int' is placed in

;code section INTRT.

goto service_int ;Jumps to the location labelled

;'service_int'.

PGM0 CODE H'500' ;The code section named PGM0 is

;placed at H'500'.

start

PAGESEL page1_pgm ;address bits 12 & 11 of

;page1_pgm are copied to PCLATH

;4 & 3 respectively.

goto page1_pgm

PGM1 CODE H'900' ;The code section named PGM1 is

;placed at H'900'. Label

;page1_pgm is located in this

page1_pgm ;code section.

goto $

service_int

retfie

end


Microchip Technology Inc.
Microchip's Web Site
Voice: (480) 792-7200
Fax: (480) 899-9210
Microchip's E-mail Address
PreviousNext