bianchi77
Advanced Member level 4
- Joined
- Jun 11, 2009
- Messages
- 1,313
- Helped
- 21
- Reputation
- 44
- Reaction score
- 20
- Trophy points
- 1,318
- Location
- California
- Activity points
- 9,442
Hi Guys,
Please correct me if I'm wrong,
I tried to count the overflow for creating a delay....
Are they correct ?
Thanks
Please correct me if I'm wrong,
I tried to count the overflow for creating a delay....
Are they correct ?
Thanks
Code:
LedTimer EQU .100 ;100 decimal (for content of the counter to get 100ms)
movf LedTimer,W ; load value to W , Status register bit Zero is altered according to value
;count for how many interrupts for the next state
counting btfss INTCON,T0IF ;is timer0 interrupt flag true ?
bcf INTCON,T0IF ;if T0IF=false clear timer0 interrupt flag
decf LedTimer,1 ;if T0IF=true reduce the counter
;check if LedTimer = 0 ?
btfsc STATUS, Z ;Z bit is set to 1 if W was 00 - skip next instruction if not 00
;LedTimer=0
goto next_state ;from btfsc if it's 1, go to next state
;LedTimer!=0
goto counting ;from btfsc if it's 0 keep counting interrupt
next_state incf LedState,1 ; if 00 increase the state, for the next state
return