Example 2-6
Example 2-6
; This file is a basic template for creating relocateable assembly code for *
; a PIC18F1320. Copy this file into your project directory and modify or *
; add to it as needed. Create a project with MPLINK as the language tool *
; for the hex file. Add this file and the 18F1320.LKR file to the project. *
; *
; The PIC18FXXXX architecture allows two interrupt configurations. This *
; template code is written for priority interrupt levels and the IPEN bit *
; in the RCON register must be set to enable priority levels. If IPEN is *
; left in its default zero state, only the interrupt vector at 0x008 will *
; be used and the WREG_TEMP, BSR_TEMP and STATUS_TEMP variables will not *
; be needed. *
; *
; Refer to the MPASM User's Guide for additional information on the *
; features of the assembler and linker. *
; *
; Refer to the PIC18F1220/1320 Data Sheet for additional information on the *
; architecture and instruction set. *
; *
;******************************************************************************
; *
; Filename: *
; Date: *
; File Version: *
; *
; Author: *
; Company: *
; *
;******************************************************************************
; *
; Files required: P18F1320.INC *
; 18F1320.LKR *
; *
;******************************************************************************
;******************************************************************************
;Configuration bits
; The __CONFIG directive defines configuration data within the .ASM file.
; The labels following the directive are defined in the P18F1320.INC file.
; The PIC18F1220/1320 Data Sheet explains the functions of the configuration
; bits. Change the following lines to suit your application.
;******************************************************************************
;Variable definitions
; These variables are only needed if low priority interrupts are used.
; More variables may be needed to store other special function registers used
; in the interrupt routines.
UDATA
UDATA_ACS
;******************************************************************************
;EEPROM data
; Data to be programmed into the Data EEPROM is defined here
DE "Test Data",0,1,2,3,4,5
;******************************************************************************
;Reset vector
; This code will start executing when a reset occurs.
;******************************************************************************
;******************************************************************************
;******************************************************************************
CODE
HighInt:
retfie FAST
;******************************************************************************
LowInt:
movff STATUS,STATUS_TEMP ;save STATUS register
movff WREG,WREG_TEMP ;save working register
movff BSR,BSR_TEMP ;save BSR register
;******************************************************************************
;Start of main program
; The main program code is placed here.
Main:
;******************************************************************************
;End of program
END