hi guys
i have programmed my pic 16f877a to do led chaser and here's the code in assembly languge
main:
clrf PORTD
bsf STATUS,RP0
movlw 0x00
movwf TRISD
bcf STATUS,RP0
movlw 0x09 ; number of shifts that the pic will do
movwf n1
movlw 0x08
movwf n2
movlw 0x07
movwf n3
movlw 0x06
movwf n4
movlw 0x05
movwf n5
movlw 0x04
movwf n6
movlw 0x03
movwf n7
movlw 0x02
movwf n8
movlw 0x01
movwf n9
Movlw 0x25
Movwf FSR
movlw 0x08
movwf var2
movlw 0x01
movwf var3
proc Clrf shift ; clear the varialble shift
Bsf STATUS,C ; set the carry to 1
incf FSR,f ; initialize the pointer
loop3
rrf shift,f ; rotate right
movf shift,w ; move the value from shift tot w
Movwf PORTD ; display the value on portd
call delay1 ; delay routine
Decfsz INDF,f ; decremenent the value of number of shift
goto loop3 ; if the number of shift is superior to zero continue shifting to the right
decfsz var2,f ; have we reached 8?
goto proc ; goto to label proc
goto main ; loop for ever
the result is on the folowing video :
https://www.youtube.com/watch?v=ZBIOi3K2kz0
i have a little problem : i want that every time the led reached the number of shift, all the led at right remains on.can some one help me because i can't find a way to do a bit test instruction because the bit i want to test is not fixed and its changing from 1 to 8.
thank you in advance guys