jccsantos
Junior Member level 2
- Joined
- May 10, 2004
- Messages
- 22
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,283
- Activity points
- 159
picloops v.2.1
Hi,
I want to make a delay of 3600 sec. with this code:
work´s great,
But i need to add this :
now the time is broken....... 2 cycles added......
How can i calc the rigth value for the delay routine????
There is any formula to calc this type of delay´s? type we enter the program and they give the cycles?????
Thank´s in advance.
Hi,
I want to make a delay of 3600 sec. with this code:
Code:
; Delay = 3600 seconds
; Clock frequency = 4 MHz
; Actual delay = 3600 seconds = 3600000000 cycles
; Error = 0 %
cblock
d1
d2
d3
d4
endc
Delay
;3599999989 cycles
movlw 0xFE
movwf d1
movlw 0x84
movwf d2
movlw 0xD8
movwf d3
movlw 0x18
movwf d4
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto $+2
decfsz d4, f
goto Delay_0
;7 cycles
goto $+1
goto $+1
goto $+1
nop
;4 cycles (including call)
return
; Generated by [I]**broken link removed**[/I] (December 7, 2005 version)
; Wed Sep 26 15:17:24 2007 GMT
; See also various delay routines at [url]http://www.piclist.com/techref/microchip/delays.htm[/url]
work´s great,
But i need to add this :
Code:
........
Delay_0
btfss Tecla
goto Main1
decfsz t1, f
goto $+2
decfsz t2, f
goto $+2
decfsz t3, f
goto $+2
decfsz t4,f
goto Delay_0
............
now the time is broken....... 2 cycles added......
How can i calc the rigth value for the delay routine????
There is any formula to calc this type of delay´s? type we enter the program and they give the cycles?????
Thank´s in advance.