;**********************************************************************
;   This file is a basic code template for object module code         *
;   generation on the PIC16C505. This file contains the               *
;   basic code building blocks to build upon.                         *
;                                                                     *
;   Refer to the MPASM User's Guide for additional information on     *
;   features of the assembler and linker (Document DS33014F).         *
;                                                                     *
;   Refer to the respective PIC data sheet for additional             *
;   information on the instruction set.                               *
;                                                                     *
;**********************************************************************
;                                                                     *
;    Filename:      xxx.asm                                           *
;    Date:                                                            *
;    File Version:                                                    *
;                                                                     *
;    Author:                                                          *
;    Company:                                                         *
;                                                                     * 
;                                                                     *
;**********************************************************************
;                                                                     *
;    Files required: P16C505.INC                                      *
;                                                                     *
;                                                                     *
;                                                                     *
;**********************************************************************
;                                                                     *
;    Notes:                                                           *
;                                                                     *
;                                                                     *
;                                                                     *
;                                                                     *
;**********************************************************************

    list      p=16c505            ; list directive to define processor
    #include <p16c505.inc>        ; processor specific variable definitions

    __CONFIG   _CP_OFF & _WDT_ON & _MCLRE_ON & _ExtRC_OSC_CLKOUTEN
 
; '__CONFIG' directive is used to embed configuration word within .asm file.
; The labels following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.


;***** VARIABLE DEFINITIONS
TEMP_VAR      UDATA_SHR           ;declare shared data section
temp          RES     1           ;example variable definition

TEMP_REG      UDATA               ;declare data section
count         RES     1           ;example variable definition

;**********************************************************************
        CODE    0x3FF             ; processor reset vector
; Internal RC calibration value is placed at location 0x3FF by Microchip
; as a movlw k, where the k is a literal value.

MAIN    CODE    0x0000             ; coding begins here
        movwf   OSCCAL            ; update register with factory cal value 
         
        banksel count             ; example coding
        clrf    count             ; example coding

; remaining code goes here




        END                       ; directive 'end of program'

