;********************************************************************** ; * ; Filename: xxx.asm * ; Date: * ; File Version: * ; * ; Author: * ; Company: * ; * ;********************************************************************** ; * ; Files required: P16F628A.INC * ; * ;********************************************************************** ; * ; Notes: * ; * ;********************************************************************** list p=16F628A ; list directive to define processor #include ; processor specific variable definitions errorlevel -302 ; suppress message 302 from list file __CONFIG _CP_OFF & _DATA_CP_OFF & _LVP_OFF & _BOREN_OFF & _MCLRE_ON & _WDT_OFF & _PWRTE_ON & _INTOSC_OSC_NOCLKOUT ; '__CONFIG' directive is used to embed configuration word within .asm file. ; The lables following the directive are located in the respective .inc file. ; See data sheet for additional information on configuration word settings. ;***** VARIABLE DEFINITIONS ******************************************* d1 equ 20h d2 equ 21h ;********************************************************************** RESET_VECTOR CODE 0x0000 ; processor reset vector goto START ; go to beginning of program INT_VECTOR CODE 0x0004 ; interrupt vector location retfie ; return from interrupt ;*********************************************************************** ; SUBROUTINES ;*********************************************************************** delay nop loop decfsz d1 goto loop decfsz d2 goto loop return ;*********************************************************************** ; PROGRAM START (initialization) ;*********************************************************************** START movlw 0x07 movwf CMCON ;deactivate comparators bsf STATUS,RP0 ;enter bank 1 clrf TRISB ;Set PORTB as output movlw b'11100000' ; movwf TRISA ;set ra5,ra6,ra7 on PORTA as inputs movlw b'11000100' movwf OPTION_REG ;configure Timer 0 clrf INTCON ;deactivate all interrupts bcf STATUS,RP0 ;return to bank 0 clrf PORTA ;clear PORTA and PORTB of junk clrf PORTB ;here begins the program main bsf PORTB,0 call delay bsf PORTB,1 call delay bsf PORTB,2 call delay bcf PORTB,0 call delay bcf PORTB,1 call delay bcf PORTB,2 call delay goto main ; initialize eeprom locations EE CODE 0x2100 DE 0x00, 0x01, 0x02, 0x03 END ; directive 'end of program'