FILL PIC18CXXX Example

MPASM Assembler

FILL PIC18CXXX Example

Directives highlighted in this example for PIC18CXXX devices are:

  • fill

Program Functional Description

The fill directive is used to program successive program memory locations with a constant or an assembly instruction. For PIC18CXXX devices, only an even number is allowed to be specified as a count of locations to be filled.

Commented Code Listing

list p=18c452 ;Select device.

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

;for the selected device.

org 0000 ;Following code will be programmed

;in reset address 0.

goto start ;Jump to an address labelled

;'start'.

FILL 0, HI_INT-$ ;Fills 0 in 2 program memory

;locations: 0004 and 0006.

HI_INT org 0008

goto INTR_H

FILL (goto start),6 ;Fills 6 locations (each location

;is 2 bytes wide) with 3 numbers

;of 2 word wide instructions

;<goto start>

LO_INT org 0018

goto INTR_L

FILL 10a9, start-$ ;Fills address 1Ch and 1Eh with

;10a9h

ORG 0020

start ;Write your main program here

;

FILL (nop), 4 ;Fills 2 locations (4 bytes) with

;NOP

goto $

INTR_H ;

RETFIE

INTR_L ;

RETFIE

END


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