;**************************************************
; File Supercar8.asm
;
; Il file realizza un effetto supercar su 8 led
; uscite RB0..RB7 del pic16f84a, per lo schema
; fare riferimento al sito.
;
; (c) 2003,RIZZO GIULIANO 
; http://
;
;**************************************************


        PROCESSOR       16F84
        RADIX           DEC
        INCLUDE         "P16F84.INC"
        ERRORLEVEL      -302

        ;Setup of PIC configuration flags

        ;XT oscillator
        ;Disable watch dog timer
        ;Enable power up timer
        ;Disable code protect

        __CONFIG        0x3FF1

LED      EQU     0
LED1     EQU     1
LED2     EQU     2
LED3     EQU     3
LED4     EQU     4
LED5     EQU     5
LED6     EQU     6
LED7     EQU     7


        ORG     0x0C

Count   RES     2

        ;Reset Vector
        ;Start point at CPU reset

        ORG     0x00

        bsf     STATUS,RP0

        movlw   B'00011111'
        movwf   TRISA 

        movlw   B'00000000'
        movwf   TRISB 
	
	
        bcf     STATUS,RP0

        

MainLoop

call    Delay
        bsf     PORTB,LED
call    Delay
	bcf     PORTB,LED
call    Delay	
	bsf     PORTB,LED1
call    Delay
	bcf     PORTB,LED1
call    Delay
	bsf     PORTB,LED2
call    Delay
	bcf     PORTB,LED2
call    Delay
	bsf     PORTB,LED3
call    Delay
	bcf     PORTB,LED3
call    Delay
	bsf     PORTB,LED4
call    Delay
	bcf     PORTB,LED4
call    Delay
	bsf     PORTB,LED5
call    Delay
	bcf     PORTB,LED5
call    Delay	
	bsf     PORTB,LED6
call    Delay
	bcf     PORTB,LED6
call    Delay
	bsf     PORTB,LED7
call    Delay
	bcf     PORTB,LED7
call    Delay


;istruzioni ritorno

	
	bsf     PORTB,LED6
call    Delay
	bcf     PORTB,LED6
call    Delay
	bsf     PORTB,LED5
call    Delay
	bcf     PORTB,LED5
call    Delay
	bsf     PORTB,LED4
call    Delay
	bcf     PORTB,LED4
call    Delay
	bsf     PORTB,LED3
call    Delay
	bcf     PORTB,LED3
call    Delay
	bsf     PORTB,LED2
call    Delay
	bcf     PORTB,LED2
call    Delay	
	bsf     PORTB,LED1
call    Delay
	bcf     PORTB,LED1


	

        goto    MainLoop



        ;Subroutines

        ;Software delay

Delay
        clrf    Count
        clrf    Count+1

DelayLoop

        decfsz  Count,1
        goto    DelayLoop

        decfsz  Count+1,1
        goto    DelayLoop

        return

        END
