Professional Documents
Culture Documents
STATUS equ 03h ; this assigns the word Status to the value of 03h,
; which is the address of the Status register.
TRISB equ 86h ; This assigns the word TRISB to the value of 86h,
; which is the address of the Tri-State register for PortB
PORTB equ 06h ; This assigns the word PORTB to 06h which is the
; address of Port B.
COUNT1 equ 08h ; First counter for our delay loops
COUNT2 equ 09h ; Second counter for our delay loops
COUNT3 equ 10h ; Third counter for our delay loop
COUNT4 equ 11h ; Fourth counter for our delay loop
COUNT5 equ 12h ; Fifth counter for our delay loop
COUNT6 equ 13h ; Sixth counter for our delay loop
COUNT7 equ 14h ; Seventh counter for our delay loop
COUNT8 equ 15h ; Eighth counter for our delay loop
COUNT9 equ 16h ; Ninth counter for our delay
COUNT10 equ 17h ; Tenth counter for our delay
;**********************************************************************
ORG 0x000 ; processor reset vector
goto main ; go to beginning of program
main
Start
call CW
call CW
call CW
call CW
call CW
call CW
call CW
call CW
call CW
call CW ;10th
call CW
call CW
call CW
call CW
call CW
call CW
call CW
call CW
call CW
call CW ;20th
call CW
call CW
call CW
call CW
call CW
call CW
call CW
call CW
call CW
call CW ;30th
call CW
call CW
call CW
call CW
call CW
call CW ;36th
call Delay2sec
call CCW
call CCW
call CCW
call CCW
call CCW
call CCW
call CCW
call CCW
call CCW
call CCW ;10th
call CCW
call CCW
call CCW
call CCW
call CCW
call CCW
call CCW
call CCW
call CCW
call CCW ;20th
call CCW
call CCW
call CCW
call CCW
call CCW
call CCW
call CCW
call CCW
call CCW
call CCW ;30th
call CCW
call CCW
call CCW
call CCW
call CCW
call CCW ;36th
call Delay2sec
goto Start
CCW
movlw b'00000001'
movwf PORTB
call DelayFast
movlw b'00010000'
movwf PORTB
call DelayFast
movlw b'00001000'
movwf PORTB
call DelayFast
movlw b'00000010'
movwf PORTB
call DelayFast
return
CW
movlw b'00000010'
movwf PORTB
call DelaySlow
movlw b'00001000'
movwf PORTB
call DelaySlow
movlw b'00010000'
movwf PORTB
call DelaySlow
movlw b'00000001'
movwf PORTB
call DelaySlow
return
Delay2sec
movlw D'12'
movwf COUNT1
movlw D'24'
movwf COUNT2
movlw D'167'
movwf COUNT3
Loop
decfsz COUNT3,1
goto Loop
decfsz COUNT2,1
goto Loop
decfsz COUNT1,1
goto Loop
return
DelaySlow
movlw D'6'
movwf COUNT4
movlw D'24'
movwf COUNT5
movlw D'167'
movwf COUNT6
Loop1
decfsz COUNT6,1
goto Loop1
decfsz COUNT5,1
goto Loop1
decfsz COUNT4,1
goto Loop1
return
DelayFast
movlw D'3'
movwf COUNT8
movlw D'24'
movwf COUNT9
movlw D'167'
movwf COUNT10
Loop2
decfsz COUNT10,1
goto Loop2
decfsz COUNT9,1
goto Loop2
decfsz COUNT8,1
goto Loop2
return
END