comparison code_part1/OSTC_code_asm_part1/wait.asm @ 486:c7b663939737

making waitms speed-independent, desat-time fix
author heinrichsweikamp
date Sat, 15 Oct 2011 15:03:53 +0200
parents e83f883c96b2
children 33abbc08f01e
comparison
equal deleted inserted replaced
485:e83f883c96b2 486:c7b663939737
79 nop 79 nop
80 decfsz wait_temp,1 80 decfsz wait_temp,1
81 goto WAIT10USX2 81 goto WAIT10USX2
82 return 82 return
83 ; ========================================================== 83 ; ==========================================================
84 ; WAIT 1 MILLISECOND - 16 MHZ 84 ; WAIT 1 MILLISECOND - Working with TMR1
85 ; ========================================================== 85 ; ==========================================================
86 IFDEF SPEED_16MHz
87 WAITMS macro waitms_temp 86 WAITMS macro waitms_temp
88 movlw waitms_temp 87 movlw waitms_temp
89 call WAITMSX 88 call WAITMSX
90 endm 89 endm
91 ENDIF
92 90
93 IFDEF SPEED_32MHz 91 WAITMSX movwf waitms_temp ; Holds number of ms to wait
94 WAITMS macro waitms_temp
95 movlw waitms_temp
96 call WAITMSX
97 movlw waitms_temp
98 call WAITMSX
99 endm
100 ENDIF
101 92
102 WAITMSX movwf waitms_temp 93 WAITMSX1:
103 goto JumpInMSX 94 movf TMR1L,W
104 WAITMSX2 nop 95 addlw d'66' ; 66*15,26µs ~ 1ms
105 nop 96
106 nop 97 WAITMSX2 cpfseq TMR1L
107 nop 98 bra WAITMSX2 ; loop here...
108 nop 99
109 nop 100 decfsz waitms_temp,F
110 nop 101 bra WAITMSX1
111 nop
112 JumpInMSX:
113 nop
114 nop
115 nop
116 nop
117 nop
118 nop
119 nop
120 nop
121 nop
122 nop
123 nop
124 nop
125 nop
126 nop
127 nop
128 nop
129 nop
130 nop
131 nop
132 nop
133 nop
134 nop
135 nop
136 nop
137 nop
138 nop
139 nop
140 nop
141 nop
142 nop
143 WAIT10US d'99'
144 decfsz waitms_temp,1
145 goto WAITMSX2
146 return 102 return