I thought of a simple way that just complements the carry flag.
Code:
clrf PORTB ;start all off
bsf STATUS,C ;set carry flag
Loop rrf PORTB ;shift carry into port b
movlw 1 ;Bit 0 = carry flag
xorwf STATUS,W ;complement carry flag
movwf STATUS ;write it back
call Delay ;must not corrupt the carry flag.
goto Loop ;do it all again
Delay movlw 0x1F
movwf d1
movlw 0x4F
movwf d2
Delay_0 decfsz d1, f
goto $+2
decfsz d2, f
goto Delay_0
return
It should be 1 instruction shorter but the simulator doesn't seem to execute xorwf STATUS,F correctly.
The code needed to do this is so elementary. Configuring the TRISB, interrupts and timers is more involved. How did you get pass the thicket yet drown in the puddles.
Like I said much earlier in this thread, check my tutorials, where I use the Delay Code Generator found on the PICList to generate the delays - or you could just take the subroutines from my tutorials.