title "Flash - Flash an LED on an off" ; Mark Crosbie 8/22/98 mark@mastincrosbie.com ; ; The Program simply sets up Bit 0 of Port "A" to Output and then ; loops, setting the value alternatively low and high ; ; Hardware Notes: ; Reset is tied through a 4.7K Resistor to Vcc and PWRT is Enabled ; A 220 Ohm Resistor and LED is attached to PORTA.0 and Vcc ; LIST P=16C84, R=DEC errorlevel 0,-305 INCLUDE "\mpasm\P16C84.inc" ; Registers Temp equ 12 ; 16 Bit Dlay Variable __CONFIG _CP_OFF & _WDT_OFF & _XT_OSC & _PWRTE_ON PAGE ; Mainline of Flash org 0 clrf PORTA ; Clear all the Bits in Port "a" clrf STATUS bsf STATUS, RP0 ; Goto Bank 1 to set Port Direction bcf TRISA, 0 ; Set RA0 to Output bcf STATUS, RP0 ; Go back to Bank 0 Loop movlw 1 ; Turn on the LED on Port A movwf PORTA ; call Dlay ; Delay Before Changing Values movlw 0 ; Turn off the LED on Port A movwf PORTA ; call Dlay ; Delay Before Changing Values goto Loop ; Dlay Routine - Delay a Half Second before Returning Dlay ifndef Debug ; If Debug NOT Defined movlw 0 ; Actual Setup the Delay Value movwf Temp movlw 128 movwf Temp + 1 else ; If Debug Defined movlw 2 ; Programming Debug Delay Value movwf Temp movlw 1 movwf Temp + 1 endif D_Loop ; Loop Around Here until Complete decf Temp ; Decrement the lo Value btfsc STATUS, Z ; Is the Zero Flag Set? decf Temp + 1 movf Temp, w ; Are we At Zero for Both? iorwf Temp + 1, w btfss STATUS, Z goto D_Loop return end