Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
;;
2
;;	include		DELAY.INC
3
;;
4
;;DELAY5	; Delka spozdeni v nasobcich 5us
5
;;DELAY1	; Delka spozdeni v nasobcich 1ms
6
;;
7
;
8
; Procedury pro generovani spozdeni SW prostredky
9
;
10
; Include 16C84.INC pro definici zakladnich registru
11
 
12
__DELAY__:	; Priznak modulu DELAY
13
 
14
	ifndef	__16C84__
15
	error	"Include file 16C84.INC"
16
	endif
17
 
18
	ifndef	DELAY5
19
	cblock
20
		DELAY5
21
	endc
22
	endif
23
 
24
	ifndef	DELAY1
25
	cblock
26
		DELAY1
27
	endc
28
	endif
29
 
30
;-----------------------
31
;
32
; Short Delay - 6 az 1281 us 'a 5us --> 1+5*DELAY5 [us]
33
;
34
;-----------------------
35
;
36
; Vstup:	DELAY5		pozadovane spozdeni v 5us jednotkach
37
; Nici:		DELAY5
38
 
39
del_0:
40
	goto	$+1			; Cyklus je 5us
41
delay5us:
42
	decfsz	DELAY5
43
	goto	del_0
44
	return			; Cas pro call a return je take zapocten
45
 
46
;-----------------------
47
;
48
; Jednorazove spozdeni 10ms
49
;
50
;-----------------------
51
;
52
; Nici:		W, DELAY1, DELAY5
53
 
54
delay10ms:
55
	movlw	10
56
	movwf	DELAY1
57
 
58
;-----------------------
59
;
60
; Long Delay - 1 az 256 ms 'a 1ms --> 1000*DELAY1 + 3 [us]
61
;
62
;-----------------------
63
;
64
; Vstup: 	DELAY1		pozadovane spozdeni v 1ms
65
; Znici: 	W, DELAY5, DELAY1
66
 
67
delay1ms:
68
	movlw	(1000 / 5 ) - 2	; 1us
69
	movwf	DELAY5		; 1us
70
	goto	$+1		; 2us
71
	goto	$+1		; 2us
72
	call	delay5us	; 198 * 5 + 1 = 991us
73
	decfsz	DELAY1		; 1/2us
74
	goto	delay1ms	; 2us
75
	return			; 2us