title "" ;;; ********************************************************************* ;;; Filename: ;;; Purpose: ;;; Revision: ;;; Date: ;;; Author: ;;; Copyright: ;;; ********************************************************************* ;;; Revision History: ;;; ;;; ********************************************************************* list ; Turn on list output. ;; Include register, bit, and other info specific to ;; the specified device. ifdef __16F873 #include messg "Assembling for PIC16F873." endif ifdef __16F874 #include messg "Assembling for PIC16F874." endif ifdef __16F876 #include messg "Assembling for PIC16F876." endif ifdef __16F877 #include messg "Assembling for PIC16F877." endif ifdef __16F873A #include #define A_Device messg "Assembling for PIC16F873A." endif ifdef __16F874A #define A_Device #include messg "Assembling for PIC16F874A." endif ifdef __16F876A #define A_Device #include messg "Assembling for PIC16F876A." endif ifdef __16F877A #define A_Device #include messg "Assembling for PIC16F877A." endif ;;; -------------------------------------------------------------------- ;;; Included files (usually library headers). eg) #include "del_lib.h" ;;; -------------------------------------------------------------------- ;;; -------------------------------------------------------------------- ;;; Assembler Equates Section. Define assembly-time constants here ;;; using the EQU assembler directive. ;;; eg) DEBUGGING EQU 1 ;;; -------------------------------------------------------------------- ;;; --------------------------------------------------------------------- ;;; Variable Address Assignments. ;;; --------------------------------------------------------------------- UDATA ; Start of uninitialized data section. ; Reserve memory for variables using the ; "RES" directive here. Note that the ; linker will assign addresses. ; eg) ADcounter res 1 ; (reserves 1 byte for ADcounter). UDATA_OVR ; Uninitialized data overlay section. ; Upon occasion, temporary variables ; can be over-written by other temporary ; variables. These would appear here. ; BUT! If you ever intend on time-sliced ; or pre-emptive multitasking ; don't *ever* use this directive! UDATA_SHR ; Uninitialized data shared section. ; Variables that appear here appear ; across all banks, meaning that no ; bank selection will be required. ;;; --------------------------------------------------------------------- ;;; Establish the OPTION register bit values. ;;; --------------------------------------------------------------------- ;;; The '__CONFIG' directive is used to embed PIC configuration data ;;; within an assembly file. The labels following the directive ;;; are located in the .inc file. See the device data sheet for ;;; additional information on the configuration word. ifndef A_Device __CONFIG _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON & _XT_OSC & _WRT_ENABLE_ON & _LVP_OFF & _CPD_OFF endif ;;; _CP_OFF: turn off code protection. Don't change this unless you ;;; want a device that can never be programmed again. This ;;; is a "bug" in some PIC devices. ;;; _WDT_OFF: turn off the watchdog timer. ;;; _BODEN_ON: turn on power brown-out reset. ;;; _PWRTE_ON: turn on power-up timer. ;;; _XT_OSC: specify that the device is using an XT oscillator. ;;; _WRT_ENABLE_ON: enable writing to data EEPROM. ;;; _LVP_OFF: disable low-voltage in-circuit programming. ;;; _CPD_OFF: disable data EEPROM write protection. ifdef A_Device messg "A revision device." __CONFIG _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON & _XT_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF endif ;;; _CP_OFF: turn off code protection. Don't change this unless you ;;; want a device that can never be programmed again. This ;;; is a "bug" in some PIC devices. ;;; _WDT_OFF: turn off the watchdog timer. ;;; _BODEN_ON: turn on power brown-out reset. ;;; _PWRTE_ON: turn on power-up timer. ;;; _XT_OSC: specify that the device is using an XT oscillator. ;;; _WRT_OFF: disable write-protection of program FLASH. ;;; _LVP_OFF: disable low-voltage in-circuit programming. ;;; _CPD_OFF: disable data EEPROM write protection. ;;; -------------------------------------------------------------------- ;;; Main Program. ;;; -------------------------------------------------------------------- CODE ; Start of the code section. ;; Your code starts here. Main: ;; Don't let execution fall down to here, otherwise the ;; subroutines (or whatever follows) will be executed without ;; parameters, and chaos reigns when a "return" instruction ;; executes with no return address on the stack! ;;; -------------------------------------------------------------------- ;;; Application-specific Subroutines. ;;; -------------------------------------------------------------------- ;;; ******************************************************************** ;;; Subroutine Name: ;;; Description: ;;; Requires: ;;; Returns: ;;; Locations Affected: ;;; ******************************************************************** ;;; -------------------------------------------------------------------- ;;; Code-section Constant Data. ;;; -------------------------------------------------------------------- ;;; --------------------------------------------------------------------- ;;; Vectors Section. ;;; --------------------------------------------------------------------- ;;; Establish the reset vector. Note that the "0x0000" after the CODE ;;; directive ensures that the linker places the code at program memory ;;; location 0x0000. Reset: CODE 0x0000 pagesel Main ; Selects page of program memory with. goto Main ; the actual program, then goes to it. END ; End of file.