title “Flash_D0.asm – Flash D0 LED” ; ---------------------------------- ; Flash_D0.asm ; ; Microprocessors A 17.383 ; ; xxxxxxxx - Put in Semester (i.e. Fall 2010) here ; ; xxxxxxxx - Put in your name here ; ; xx/xx/xx - Put date here ; ; ---------------------------------- list r=dec #include "p16f684.inc" __CONFIG _FCMEN_OFF & _IESO_OFF & _BOD_OFF & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _INTOSCIO ; ---------------------------------- ; Defining constants or variables in data memory space Cblock 0x20 ; start of GPR count ; endc ; This directive must be ; supplied to terminate the ; cblock list ; ; ----- main program -------------- org 0x000 ; Hex address 0x000, the first ; program memory location ; start BCF STATUS,RP0 ; Select Bank 0 ; CLRF PORTA ; Initialize PORTA (to all zeros) ; MOVLW 7 ; Load w with 7 MOVWF CMCON0 ; Load CMCON0 with 7 ; Turns off comparators ; BSF STATUS,RP0 ; Select Bank 1 ; CLRF ANSEL ; Shut off ADC (digital I/O) ; MOVLW b'001111' ; Load w – RA4 and RA5 outputs MOVWF TRISA ; copy w to TRIS PORTA ; BCF STATUS,RP0 ; Select Bank 0 ; Loop BSF PORTA,4 ; Make RA4 high -- D0 ON ; CALL Delay ; Goto the delay routine ; BCF PORTA,4 ; Make RA4 low -- D0 OFF ; CALL Delay ; Goto the delay routine ; GOTO Loop ; Do it again ; ; Delay MOVLW 10 ; Decimal 10 MOVWF count ; Initialize counter to 10 Repeat DECFSZ count,f ; Decrement counter GOTO Repeat ; If counter <> 0 RETURN ; If counter = 0 (end delay) ; end