IDLOC PIC18CXXX Example

MPASM Assembler

IDLOC PIC18CXXX Example

Directives highlighted in this example for PIC18CXXX devices are:

  • __idloc

Program Functional Description

This program demonstrates the utility of the __idlocs directive. This directive is used to program device ID bits in the IDLOC register during device programming.

Commented Code Listing

list p=18c452 ;Select device.

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

;for the selected device.

__IDLOCS _IDLOC0, H'1' ;IDLOC register 0 will be

;programmed to 1.

__IDLOCS _IDLOC1, H'2' ;IDLOC register 1 will be

;programmed to 2.

__IDLOCS _IDLOC2, H'3' ;IDLOC register 2 will be

;programmed to 3.

__IDLOCS _IDLOC3, H'4' ;IDLOC register 3 will be

;programmed to 4.

__IDLOCS _IDLOC4, H'5' ;IDLOC register 4 will be

;programmed to 5.

__IDLOCS _IDLOC5, H'6' ;IDLOC register 5 will be

;programmed to 6.

__IDLOCS _IDLOC6, H'7' ;IDLOC register 6 will be

;programmed to 7.

__IDLOCS _IDLOC7, H'8' ;IDLOC register 7 will be

;programmed to 8.

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'8' ;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'.

PGM CODE ;This is the begining of the code

;section named PGM. It is a

;relocatable code section since

;no absolute address is given along

start ;with directive 'CODE'.

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