;************************************************************* ;Flashing LEDs 1. ;This program continuously outputs a series of led patterns, ;using ping-pong hardware. LED patterns are listed within ;the program. ;TJW 9.11.08 Tested in simulation 9.11.08 ;************************************************************* ;Clock is 800kHz ;Configuration Word: WDT off, power-up timer on, ; code protect off, RC oscillator ; list p=16F84A ; ;specify SFRs pcl equ 02 status equ 03 trisa equ 05 portb equ 06 trisb equ 06 ; delcntr1 equ 11 delcntr2 equ 12 ; org 00 ;Initialise start bsf status,5 ;select memory bank 1 movlw B'00011000' ;set port A right for hardware, movwf trisa ;even tho not used in this program. movlw 00 movwf trisb ;all port B bits output bcf status,5 ;select bank 0 ; ;The “main” program starts here loop movlw B'01010101' movwf portb ;set up new output pattern call delay movlw B'10101010' movwf portb ;set up new output pattern call delay goto loop ;loop again ; ;************************************************************* ;Subroutines ;************************************************************* ;Introduces delay of 500ms approx, for 800kHz clock delay movlw D'100' movwf delcntr2 outer movlw D'200' movwf delcntr1 inner nop nop decfsz delcntr1,1 goto inner decfsz delcntr2,1 goto outer return ; end