sorry another question now...
how does this give a 500ms delay?
Code:
Delay500 clrf DelayL ; clear DelayL to 0
clrf DelayM ; clear DelayM to 0
movlw 3h ; set DelayH to 3
movwf DelayH
Wait1 decfsz DelayL ; subtract 1 from DelayL
goto Wait1 ; if not 0, goto Wait1
decfsz DelayM ; subtract 1 from DelayM
goto Wait1 ; if not 0, goto Wait1
decfsz DelayH ; subtract 1 from DelayH
goto Wait1 ; if not 0, goto Wait1
return ; finished the delay
i dont undetstand, the first 2 lines set the DelayL and delayM to 0...so how can they subtract 1 in line 5?
and the same for DelayM
how can i calculate a delay and how many loops i need to do?
say i have a 4mhz clock. that means the pic will do 4mill instructions a second? So to get a delay of 1s i would have to loop 4 million times?
:?
Kane