bgs28
Newbie level 1
Hi ,
Can anyone help?
Have recently started to look at PIC programming and looking at time delays.
I am struggling to understand some simple concepts it seems so cant make a start.
Can anyone please explain the following lines and how a 10ms delay is achieved.
wait10ms
movlw .256 - .10000/.256 ; set timer to 10ms delay
goto wait
wait50ms
movlw .256 - .50000/.256 ; set timer to 50ms delay
goto wait
wait
movwf TMR0
bcf INTCON, T0IF
clrwdt
btfss INTCON, T0IF
goto $-2
return
im struggling with the .256 - .10000/.256
and the $ -2 in particular
if anyone could explain how the delay is derived from these figures it would be a great help
thanks in advance
B Smyth
Can anyone help?
Have recently started to look at PIC programming and looking at time delays.
I am struggling to understand some simple concepts it seems so cant make a start.
Can anyone please explain the following lines and how a 10ms delay is achieved.
wait10ms
movlw .256 - .10000/.256 ; set timer to 10ms delay
goto wait
wait50ms
movlw .256 - .50000/.256 ; set timer to 50ms delay
goto wait
wait
movwf TMR0
bcf INTCON, T0IF
clrwdt
btfss INTCON, T0IF
goto $-2
return
im struggling with the .256 - .10000/.256
and the $ -2 in particular
if anyone could explain how the delay is derived from these figures it would be a great help
thanks in advance
B Smyth