annotate src/ms5541.asm @ 283:a2e19988e959

1.82beta with new compass calib code
author heinrichsweikamp
date Wed, 27 May 2015 10:57:29 +0200
parents 653a3ab08062
children 573f2251cf49
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
heinrichsweikamp
parents:
diff changeset
3 ; File ms5541.asm
heinrichsweikamp
parents:
diff changeset
4 ;
heinrichsweikamp
parents:
diff changeset
5 ; Sensor subroutines
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
heinrichsweikamp
parents:
diff changeset
10 ; 2011-08-03 : [mH] moving from OSTC code
heinrichsweikamp
parents:
diff changeset
11
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 255
diff changeset
12 #include "hwos.inc" ; Mandatory header
0
heinrichsweikamp
parents:
diff changeset
13 #include "math.inc" ; Math routines
heinrichsweikamp
parents:
diff changeset
14
heinrichsweikamp
parents:
diff changeset
15 sensors CODE
heinrichsweikamp
parents:
diff changeset
16
heinrichsweikamp
parents:
diff changeset
17 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
18 ; Expose internal variables, to ease debug:
heinrichsweikamp
parents:
diff changeset
19 global D1, D2
heinrichsweikamp
parents:
diff changeset
20 global C1, C2, C3, C4, C5, C6
heinrichsweikamp
parents:
diff changeset
21 global xdT, xdT2, OFF, SENS, amb_pressure_avg, temperature_avg
heinrichsweikamp
parents:
diff changeset
22
heinrichsweikamp
parents:
diff changeset
23 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
24 global calculate_compensation
heinrichsweikamp
parents:
diff changeset
25 calculate_compensation:
heinrichsweikamp
parents:
diff changeset
26 ; xdT = D2 - C5 (s16 range -11.400 .. +12.350)
heinrichsweikamp
parents:
diff changeset
27 movf C5+0,W ; Get Value to be subtracted
heinrichsweikamp
parents:
diff changeset
28 subwf D2+0,W ; Do the Low Byte
heinrichsweikamp
parents:
diff changeset
29 movwf xdT+0
heinrichsweikamp
parents:
diff changeset
30 movf C5+1,W ; Then the high byte.
heinrichsweikamp
parents:
diff changeset
31 subwfb D2+1,W
heinrichsweikamp
parents:
diff changeset
32 movwf xdT+1
heinrichsweikamp
parents:
diff changeset
33
heinrichsweikamp
parents:
diff changeset
34 ; Second order temperature calculation
heinrichsweikamp
parents:
diff changeset
35 ; xdT/128 is in range -89..+96, hence signed 8bit. dT/128 = (2*dT)/256
heinrichsweikamp
parents:
diff changeset
36 rlcf xdT+0,W ; put hit bit in carry.
heinrichsweikamp
parents:
diff changeset
37 rlcf xdT+1,W ; inject in high byte.
heinrichsweikamp
parents:
diff changeset
38 movwf isr_xA+0 ; and put result in low byte.
heinrichsweikamp
parents:
diff changeset
39 clrf isr_xA+1
heinrichsweikamp
parents:
diff changeset
40 btfsc xdT+1,7 ; If dT < 0
heinrichsweikamp
parents:
diff changeset
41 setf isr_xA+1 ; then signextend to -1
heinrichsweikamp
parents:
diff changeset
42 movff isr_xA+0,isr_xB+0 ; copy A to B
heinrichsweikamp
parents:
diff changeset
43 movff isr_xA+1,isr_xB+1
heinrichsweikamp
parents:
diff changeset
44 call isr_signed_mult16x16 ; dT*dT --> xC (32 bits)
heinrichsweikamp
parents:
diff changeset
45
heinrichsweikamp
parents:
diff changeset
46 ; dT >= 0: divide by 8, ie. 3 shifts rights.
heinrichsweikamp
parents:
diff changeset
47 ; dT < 0: divide by 2, ie. 1 shifts rights.
heinrichsweikamp
parents:
diff changeset
48 movlw .3
heinrichsweikamp
parents:
diff changeset
49 btfss xdT+1,7 ; Was dT negative ?
heinrichsweikamp
parents:
diff changeset
50 movlw .1
heinrichsweikamp
parents:
diff changeset
51 calc_loop_1:
heinrichsweikamp
parents:
diff changeset
52 bcf STATUS,C ;dT^2 is positive, so injected zeros.
heinrichsweikamp
parents:
diff changeset
53 rrcf isr_xC+1,F
heinrichsweikamp
parents:
diff changeset
54 rrcf isr_xC+0,F
heinrichsweikamp
parents:
diff changeset
55 decfsz WREG
heinrichsweikamp
parents:
diff changeset
56 bra calc_loop_1
heinrichsweikamp
parents:
diff changeset
57
heinrichsweikamp
parents:
diff changeset
58 movf isr_xC+0,W ; dT2 = dT - (dT/128)*(dT/128)/(2 ...or... 8)
heinrichsweikamp
parents:
diff changeset
59 subwf xdT+0,W
heinrichsweikamp
parents:
diff changeset
60 movwf xdT2+0
heinrichsweikamp
parents:
diff changeset
61 movf isr_xC+1,W
heinrichsweikamp
parents:
diff changeset
62 subwfb xdT+1,W
heinrichsweikamp
parents:
diff changeset
63 movwf xdT2+1
heinrichsweikamp
parents:
diff changeset
64
heinrichsweikamp
parents:
diff changeset
65 ; Calculate OFF = C2 + ((C4-250)*dT2)/2^12 + 10000
heinrichsweikamp
parents:
diff changeset
66 ; (range +9.246 .. +18.887)
heinrichsweikamp
parents:
diff changeset
67 movff C4+0,isr_xA+0
heinrichsweikamp
parents:
diff changeset
68 movff C4+1,isr_xA+1
heinrichsweikamp
parents:
diff changeset
69 ; movlw LOW(-.250) ; C4 - 250 --> A
heinrichsweikamp
parents:
diff changeset
70 ; addwf C4+0,W
heinrichsweikamp
parents:
diff changeset
71 ; movwf isr_xA+0
heinrichsweikamp
parents:
diff changeset
72 ; movlw -1 ; HIGH(- .250) is not understood...
heinrichsweikamp
parents:
diff changeset
73 ; addwfc C4+1,W
heinrichsweikamp
parents:
diff changeset
74 ; movwf isr_xA+1
heinrichsweikamp
parents:
diff changeset
75
heinrichsweikamp
parents:
diff changeset
76 movff xdT2+0,isr_xB+0 ; dT2 --> B
heinrichsweikamp
parents:
diff changeset
77 movff xdT2+1,isr_xB+1
heinrichsweikamp
parents:
diff changeset
78 call isr_signed_mult16x16
heinrichsweikamp
parents:
diff changeset
79 movlw .12-.8 ; A 12bit shift = 1 byte + 4 bits.
heinrichsweikamp
parents:
diff changeset
80 call isr_shift_C31
heinrichsweikamp
parents:
diff changeset
81
heinrichsweikamp
parents:
diff changeset
82 movlw LOW(.10000) ; Add 10000
heinrichsweikamp
parents:
diff changeset
83 addwf isr_xC+1,F
heinrichsweikamp
parents:
diff changeset
84 movlw HIGH(.10000)
heinrichsweikamp
parents:
diff changeset
85 addwfc isr_xC+2,F
heinrichsweikamp
parents:
diff changeset
86
heinrichsweikamp
parents:
diff changeset
87 movf C2+0,W ; Add C2, and save into OFF
heinrichsweikamp
parents:
diff changeset
88 addwf isr_xC+1,W
heinrichsweikamp
parents:
diff changeset
89 movwf OFF+0
heinrichsweikamp
parents:
diff changeset
90 movf C2+1,W
heinrichsweikamp
parents:
diff changeset
91 addwfc isr_xC+2,W
heinrichsweikamp
parents:
diff changeset
92 movwf OFF+1
heinrichsweikamp
parents:
diff changeset
93
heinrichsweikamp
parents:
diff changeset
94 ; Calculate SENS = C1/2 + ((C3+200)*dT)/2^13 + 3000
heinrichsweikamp
parents:
diff changeset
95 movlw LOW(.200) ; C3+200 --> A
heinrichsweikamp
parents:
diff changeset
96 addwf C3+0,W
heinrichsweikamp
parents:
diff changeset
97 movwf isr_xA+0
heinrichsweikamp
parents:
diff changeset
98 movlw HIGH(.200)
heinrichsweikamp
parents:
diff changeset
99 addwfc C3+1,W
heinrichsweikamp
parents:
diff changeset
100 movwf isr_xA+1
heinrichsweikamp
parents:
diff changeset
101 ; B still contains dT2
heinrichsweikamp
parents:
diff changeset
102 call isr_signed_mult16x16 ; A*B --> C
heinrichsweikamp
parents:
diff changeset
103 movlw .13-.8 ; A 13bit shift = 1 byte + 5 bits.
heinrichsweikamp
parents:
diff changeset
104 call isr_shift_C31
heinrichsweikamp
parents:
diff changeset
105
heinrichsweikamp
parents:
diff changeset
106 bcf STATUS,C ; SENS = C1 / 2
heinrichsweikamp
parents:
diff changeset
107 rrcf C1+1,W
heinrichsweikamp
parents:
diff changeset
108 movwf SENS+1
heinrichsweikamp
parents:
diff changeset
109 rrcf C1+0,W
heinrichsweikamp
parents:
diff changeset
110 movwf SENS+0
heinrichsweikamp
parents:
diff changeset
111
heinrichsweikamp
parents:
diff changeset
112 movlw LOW(.3000) ; Add 3000
heinrichsweikamp
parents:
diff changeset
113 addwf isr_xC+1,F
heinrichsweikamp
parents:
diff changeset
114 movlw HIGH(.3000)
heinrichsweikamp
parents:
diff changeset
115 addwfc isr_xC+2,F
heinrichsweikamp
parents:
diff changeset
116
heinrichsweikamp
parents:
diff changeset
117 movf isr_xC+1,W ; And sum into SENS
heinrichsweikamp
parents:
diff changeset
118 addwf SENS+0,F
heinrichsweikamp
parents:
diff changeset
119 movf isr_xC+2,W
heinrichsweikamp
parents:
diff changeset
120 addwfc SENS+1,F
heinrichsweikamp
parents:
diff changeset
121
heinrichsweikamp
parents:
diff changeset
122 ; calculate amb_pressure = (sens * (d1-off))/2^12 + 1000
heinrichsweikamp
parents:
diff changeset
123 movf OFF+0,W ; d1-off --> a
heinrichsweikamp
parents:
diff changeset
124 subwf D1+0,W
heinrichsweikamp
parents:
diff changeset
125 movwf isr_xA+0
heinrichsweikamp
parents:
diff changeset
126 movf OFF+1,W
heinrichsweikamp
parents:
diff changeset
127 subwfb D1+1,W
heinrichsweikamp
parents:
diff changeset
128 movwf isr_xA+1
heinrichsweikamp
parents:
diff changeset
129
heinrichsweikamp
parents:
diff changeset
130 movff SENS+0,isr_xB+0 ; sens --> b
heinrichsweikamp
parents:
diff changeset
131 movff SENS+1,isr_xB+1
heinrichsweikamp
parents:
diff changeset
132 call isr_signed_mult16x16
heinrichsweikamp
parents:
diff changeset
133 movlw .12-.8 ; a 12bit shift = 1 byte + 4 bits.
heinrichsweikamp
parents:
diff changeset
134 call isr_shift_C31
heinrichsweikamp
parents:
diff changeset
135
heinrichsweikamp
parents:
diff changeset
136 movlw LOW(.1000) ; add 1000
heinrichsweikamp
parents:
diff changeset
137 addwf isr_xC+1,F
heinrichsweikamp
parents:
diff changeset
138 movlw HIGH(.1000)
heinrichsweikamp
parents:
diff changeset
139 addwfc isr_xC+2,F
heinrichsweikamp
parents:
diff changeset
140
92
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
141 ; Add opt_pressure_adjust to result (SIGNED!)
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
142 movff opt_pressure_adjust,isr_xC+0
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
143
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
144 btfss isr_xC+0,7 ; <0?
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
145 bra pressure_extra_add ; No
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
146 ; Yes
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
147 comf isr_xC+0,F
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
148 incf isr_xC+0,F
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
149 ; Check for max. of 20mbar
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
150 movlw .21
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
151 cpfslt isr_xC+0
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
152 clrf isr_xC+0
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
153 ; Subtract
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
154 movf isr_xC+0,W
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
155 subwf isr_xC+1,F
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
156 movlw .0
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
157 subwfb isr_xC+2,F
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
158 bra pressure_extra_common
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
159
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
160 pressure_extra_add:
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
161 ; Check for max. of 20mbar
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
162 movlw .21
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
163 cpfslt isr_xC+0
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
164 clrf isr_xC+0
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
165 ; Add
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
166 movf isr_xC+0,W
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
167 addwf isr_xC+1,F
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
168 movlw .0
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
169 addwfc isr_xC+2,F
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
170
7ca1105751c7 add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents: 29
diff changeset
171 pressure_extra_common:
178
39f6c07ce2f6 BUGFIX: Average depth computation
heinrichsweikamp
parents: 92
diff changeset
172 banksel common ; flag2 is in bank 1
0
heinrichsweikamp
parents:
diff changeset
173 btfss simulatormode_active ; are we in simulator mode?
heinrichsweikamp
parents:
diff changeset
174 bra calc_compensation_2 ; no
heinrichsweikamp
parents:
diff changeset
175
heinrichsweikamp
parents:
diff changeset
176 movff sim_pressure+0,isr_xC+1 ; override readings with simulator values
heinrichsweikamp
parents:
diff changeset
177 movff sim_pressure+1,isr_xC+2
heinrichsweikamp
parents:
diff changeset
178
heinrichsweikamp
parents:
diff changeset
179 calc_compensation_2:
heinrichsweikamp
parents:
diff changeset
180 banksel isr_backup
heinrichsweikamp
parents:
diff changeset
181 movf isr_xC+1,W ; Then sum_up to pressure averaging buffer.
heinrichsweikamp
parents:
diff changeset
182 addwf amb_pressure_avg+0,F
heinrichsweikamp
parents:
diff changeset
183 movf isr_xC+2,W
heinrichsweikamp
parents:
diff changeset
184 addwfc amb_pressure_avg+1,F
heinrichsweikamp
parents:
diff changeset
185
heinrichsweikamp
parents:
diff changeset
186 ; calculate temp = 200 + dT*(C6+100)/2^11
heinrichsweikamp
parents:
diff changeset
187 movlw LOW(.100) ; C6 + 100 --> A
heinrichsweikamp
parents:
diff changeset
188 addwf C6+0,W
heinrichsweikamp
parents:
diff changeset
189 movwf isr_xA+0
heinrichsweikamp
parents:
diff changeset
190 movlw HIGH(.100)
heinrichsweikamp
parents:
diff changeset
191 addwfc C6+1,W
heinrichsweikamp
parents:
diff changeset
192 movwf isr_xA+1
heinrichsweikamp
parents:
diff changeset
193
heinrichsweikamp
parents:
diff changeset
194 movff xdT2+0,isr_xB+0 ; dT2 --> B
heinrichsweikamp
parents:
diff changeset
195 movff xdT2+1,isr_xB+1
heinrichsweikamp
parents:
diff changeset
196 call isr_signed_mult16x16 ; A*B
heinrichsweikamp
parents:
diff changeset
197 movlw .11-.8 ; A 12bit shift = 1 byte + 3 bits.
heinrichsweikamp
parents:
diff changeset
198 call isr_shift_C31
heinrichsweikamp
parents:
diff changeset
199
heinrichsweikamp
parents:
diff changeset
200 movlw LOW(.200) ; Add 200
heinrichsweikamp
parents:
diff changeset
201 addwf isr_xC+1,F
heinrichsweikamp
parents:
diff changeset
202 movlw HIGH(.200)
heinrichsweikamp
parents:
diff changeset
203 addwfc isr_xC+2,F
heinrichsweikamp
parents:
diff changeset
204
heinrichsweikamp
parents:
diff changeset
205 movf isr_xC+1,W
heinrichsweikamp
parents:
diff changeset
206 addwf temperature_avg+0,F
heinrichsweikamp
parents:
diff changeset
207 movf isr_xC+2,W
heinrichsweikamp
parents:
diff changeset
208 addwfc temperature_avg+1,F
heinrichsweikamp
parents:
diff changeset
209
heinrichsweikamp
parents:
diff changeset
210 return ; Done.
heinrichsweikamp
parents:
diff changeset
211
heinrichsweikamp
parents:
diff changeset
212 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
213 global get_pressure_start
heinrichsweikamp
parents:
diff changeset
214 get_pressure_start:
heinrichsweikamp
parents:
diff changeset
215 rcall reset_MS5541
heinrichsweikamp
parents:
diff changeset
216 movlw b'10100000' ;+3*high as start and 1+low as stop!
heinrichsweikamp
parents:
diff changeset
217 get_pressure_start2:
heinrichsweikamp
parents:
diff changeset
218 movwf isr1_temp
heinrichsweikamp
parents:
diff changeset
219 movlw d'12'
heinrichsweikamp
parents:
diff changeset
220 rcall send_data_MS5541
heinrichsweikamp
parents:
diff changeset
221 return
heinrichsweikamp
parents:
diff changeset
222
heinrichsweikamp
parents:
diff changeset
223 global get_pressure_value
heinrichsweikamp
parents:
diff changeset
224 get_pressure_value:
heinrichsweikamp
parents:
diff changeset
225 btfsc MS5541_miso ; Conversion done?
heinrichsweikamp
parents:
diff changeset
226 return ; No, Return
heinrichsweikamp
parents:
diff changeset
227 rcall get_2bytes_MS5541
heinrichsweikamp
parents:
diff changeset
228 movff dMSB,D1+1
heinrichsweikamp
parents:
diff changeset
229 movff dLSB,D1+0
heinrichsweikamp
parents:
diff changeset
230 return
heinrichsweikamp
parents:
diff changeset
231
heinrichsweikamp
parents:
diff changeset
232 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
233 global get_temperature_start
heinrichsweikamp
parents:
diff changeset
234 get_temperature_start:
heinrichsweikamp
parents:
diff changeset
235 rcall reset_MS5541
heinrichsweikamp
parents:
diff changeset
236 movlw b'10010000' ;+3*high as start and 1+low as stop!
heinrichsweikamp
parents:
diff changeset
237 bra get_pressure_start2 ; continue in "get_pressure"
heinrichsweikamp
parents:
diff changeset
238
heinrichsweikamp
parents:
diff changeset
239 global get_temperature_value
heinrichsweikamp
parents:
diff changeset
240 get_temperature_value:
heinrichsweikamp
parents:
diff changeset
241 btfsc MS5541_miso ; Conversion done?
heinrichsweikamp
parents:
diff changeset
242 return ; No, Return
heinrichsweikamp
parents:
diff changeset
243 rcall get_2bytes_MS5541
heinrichsweikamp
parents:
diff changeset
244 movff dMSB,D2+1
heinrichsweikamp
parents:
diff changeset
245 movff dLSB,D2+0
heinrichsweikamp
parents:
diff changeset
246 return
heinrichsweikamp
parents:
diff changeset
247
heinrichsweikamp
parents:
diff changeset
248 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
249 global get_calibration_data
heinrichsweikamp
parents:
diff changeset
250 get_calibration_data:
heinrichsweikamp
parents:
diff changeset
251 banksel common
heinrichsweikamp
parents:
diff changeset
252 bsf no_sensor_int ; disable sensor interrupts
heinrichsweikamp
parents:
diff changeset
253 banksel isr_backup ; Back to Bank0 ISR data
heinrichsweikamp
parents:
diff changeset
254
heinrichsweikamp
parents:
diff changeset
255 rcall reset_MS5541
heinrichsweikamp
parents:
diff changeset
256 movlw b'01010100' ;+3*high as start and 1+low as stop!
heinrichsweikamp
parents:
diff changeset
257 movwf isr1_temp
heinrichsweikamp
parents:
diff changeset
258 movlw d'13'
heinrichsweikamp
parents:
diff changeset
259 rcall send_data_MS5541
heinrichsweikamp
parents:
diff changeset
260 rcall get_2bytes_MS5541
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
261 movff dMSB,ir_s8_buffer+1
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
262 movff dLSB,ir_s8_buffer+0
0
heinrichsweikamp
parents:
diff changeset
263
heinrichsweikamp
parents:
diff changeset
264 movlw b'01011000' ;+3*high as start and 1+low as stop!
heinrichsweikamp
parents:
diff changeset
265 movwf isr1_temp
heinrichsweikamp
parents:
diff changeset
266 movlw d'13'
heinrichsweikamp
parents:
diff changeset
267 rcall send_data_MS5541
heinrichsweikamp
parents:
diff changeset
268 rcall get_2bytes_MS5541
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
269 movff dMSB,ir_s8_buffer+3
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
270 movff dLSB,ir_s8_buffer+2
0
heinrichsweikamp
parents:
diff changeset
271
heinrichsweikamp
parents:
diff changeset
272 movlw b'01100100' ;+3*high as start and 1+low as stop!
heinrichsweikamp
parents:
diff changeset
273 movwf isr1_temp
heinrichsweikamp
parents:
diff changeset
274 movlw d'13'
heinrichsweikamp
parents:
diff changeset
275 rcall send_data_MS5541
heinrichsweikamp
parents:
diff changeset
276 rcall get_2bytes_MS5541
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
277 movff dMSB,ir_s8_buffer+5
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
278 movff dLSB,ir_s8_buffer+4
0
heinrichsweikamp
parents:
diff changeset
279
heinrichsweikamp
parents:
diff changeset
280 movlw b'01101000' ;+3*high as start and 1+low as stop!
heinrichsweikamp
parents:
diff changeset
281 movwf isr1_temp
heinrichsweikamp
parents:
diff changeset
282 movlw d'13'
heinrichsweikamp
parents:
diff changeset
283 rcall send_data_MS5541
heinrichsweikamp
parents:
diff changeset
284 rcall get_2bytes_MS5541
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
285 movff dMSB,ir_s8_buffer+7
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
286 movff dLSB,ir_s8_buffer+6
0
heinrichsweikamp
parents:
diff changeset
287
heinrichsweikamp
parents:
diff changeset
288 ; calculate C1 (16Bit)
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
289 movff ir_s8_buffer+1, C1+1
0
heinrichsweikamp
parents:
diff changeset
290 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
291 rrcf C1+1
heinrichsweikamp
parents:
diff changeset
292 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
293 rrcf C1+1
heinrichsweikamp
parents:
diff changeset
294 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
295 rrcf C1+1
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
296 movff ir_s8_buffer+0, C1+0
0
heinrichsweikamp
parents:
diff changeset
297 bsf STATUS,C
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
298 btfss ir_s8_buffer+1,0
0
heinrichsweikamp
parents:
diff changeset
299 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
300 rrcf C1+0
heinrichsweikamp
parents:
diff changeset
301 bsf STATUS,C
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
302 btfss ir_s8_buffer+1,1
0
heinrichsweikamp
parents:
diff changeset
303 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
304 rrcf C1+0
heinrichsweikamp
parents:
diff changeset
305 bsf STATUS,C
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
306 btfss ir_s8_buffer+1,2
0
heinrichsweikamp
parents:
diff changeset
307 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
308 rrcf C1+0
heinrichsweikamp
parents:
diff changeset
309
heinrichsweikamp
parents:
diff changeset
310 ; calculate C2 (16Bit)
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
311 movff ir_s8_buffer+2, C2+0
0
heinrichsweikamp
parents:
diff changeset
312 bsf STATUS,C
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
313 btfss ir_s8_buffer+3,0
0
heinrichsweikamp
parents:
diff changeset
314 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
315 rrcf C2+0
heinrichsweikamp
parents:
diff changeset
316 bsf STATUS,C
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
317 btfss ir_s8_buffer+3,1
0
heinrichsweikamp
parents:
diff changeset
318 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
319 rrcf C2+0
heinrichsweikamp
parents:
diff changeset
320 bsf STATUS,C
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
321 btfss ir_s8_buffer+3,2
0
heinrichsweikamp
parents:
diff changeset
322 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
323 rrcf C2+0
heinrichsweikamp
parents:
diff changeset
324 bsf STATUS,C
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
325 btfss ir_s8_buffer+3,3
0
heinrichsweikamp
parents:
diff changeset
326 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
327 rrcf C2+0
heinrichsweikamp
parents:
diff changeset
328 bsf STATUS,C
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
329 btfss ir_s8_buffer+3,4
0
heinrichsweikamp
parents:
diff changeset
330 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
331 rrcf C2+0
heinrichsweikamp
parents:
diff changeset
332 bsf STATUS,C
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
333 btfss ir_s8_buffer+3,5
0
heinrichsweikamp
parents:
diff changeset
334 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
335 rrcf C2+0
heinrichsweikamp
parents:
diff changeset
336
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
337 movff ir_s8_buffer+3, C2+1
0
heinrichsweikamp
parents:
diff changeset
338 bsf STATUS,C
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
339 btfss ir_s8_buffer+0,0
0
heinrichsweikamp
parents:
diff changeset
340 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
341 rrcf C2+1
heinrichsweikamp
parents:
diff changeset
342 bsf STATUS,C
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
343 btfss ir_s8_buffer+0,1
0
heinrichsweikamp
parents:
diff changeset
344 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
345 rrcf C2+1
heinrichsweikamp
parents:
diff changeset
346 bsf STATUS,C
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
347 btfss ir_s8_buffer+0,2
0
heinrichsweikamp
parents:
diff changeset
348 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
349 rrcf C2+1
heinrichsweikamp
parents:
diff changeset
350 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
351 rrcf C2+1
heinrichsweikamp
parents:
diff changeset
352 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
353 rrcf C2+1
heinrichsweikamp
parents:
diff changeset
354 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
355 rrcf C2+1
heinrichsweikamp
parents:
diff changeset
356
heinrichsweikamp
parents:
diff changeset
357 ; calculate C3 (16Bit)
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
358 movff ir_s8_buffer+5,C3+0
0
heinrichsweikamp
parents:
diff changeset
359 bsf STATUS,C
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
360 btfss ir_s8_buffer+4,7
0
heinrichsweikamp
parents:
diff changeset
361 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
362 rlcf C3+0
heinrichsweikamp
parents:
diff changeset
363 bsf STATUS,C
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
364 btfss ir_s8_buffer+4,6
0
heinrichsweikamp
parents:
diff changeset
365 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
366 rlcf C3+0
heinrichsweikamp
parents:
diff changeset
367 clrf C3+1
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
368 btfsc ir_s8_buffer+5,7
0
heinrichsweikamp
parents:
diff changeset
369 bsf C3+1,1
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
370 btfsc ir_s8_buffer+5,6
0
heinrichsweikamp
parents:
diff changeset
371 bsf C3+1,0
heinrichsweikamp
parents:
diff changeset
372
heinrichsweikamp
parents:
diff changeset
373 ; calculate C4 (16Bit)
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
374 movff ir_s8_buffer+7,C4+0
0
heinrichsweikamp
parents:
diff changeset
375 bsf STATUS,C
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
376 btfss ir_s8_buffer+6,7
0
heinrichsweikamp
parents:
diff changeset
377 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
378 rlcf C4+0
heinrichsweikamp
parents:
diff changeset
379 clrf C4+1
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
380 btfsc ir_s8_buffer+7,7
0
heinrichsweikamp
parents:
diff changeset
381 bsf C4+1,0
heinrichsweikamp
parents:
diff changeset
382
heinrichsweikamp
parents:
diff changeset
383 ; C4=C4-250
heinrichsweikamp
parents:
diff changeset
384 movlw LOW(-.250) ; C4 - 250 --> C4
heinrichsweikamp
parents:
diff changeset
385 addwf C4+0,W
heinrichsweikamp
parents:
diff changeset
386 movwf C4+0
heinrichsweikamp
parents:
diff changeset
387 movlw -1 ; HIGH(- .250) is not understood...
heinrichsweikamp
parents:
diff changeset
388 addwfc C4+1,W
heinrichsweikamp
parents:
diff changeset
389 movwf C4+1
heinrichsweikamp
parents:
diff changeset
390
heinrichsweikamp
parents:
diff changeset
391 ; calculate C5 (16Bit)
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
392 movff ir_s8_buffer+4,C5+0
0
heinrichsweikamp
parents:
diff changeset
393 bcf C5+0,6
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
394 btfsc ir_s8_buffer+2,0
0
heinrichsweikamp
parents:
diff changeset
395 bsf C5+0,6
heinrichsweikamp
parents:
diff changeset
396 bcf C5+0,7
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
397 btfsc ir_s8_buffer+2,1
0
heinrichsweikamp
parents:
diff changeset
398 bsf C5+0,7
heinrichsweikamp
parents:
diff changeset
399 clrf C5+1
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
400 btfsc ir_s8_buffer+2,2
0
heinrichsweikamp
parents:
diff changeset
401 bsf C5+1,0
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
402 btfsc ir_s8_buffer+2,3
0
heinrichsweikamp
parents:
diff changeset
403 bsf C5+1,1
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
404 btfsc ir_s8_buffer+2,4
0
heinrichsweikamp
parents:
diff changeset
405 bsf C5+1,2
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
406 btfsc ir_s8_buffer+2,5
0
heinrichsweikamp
parents:
diff changeset
407 bsf C5+1,3
heinrichsweikamp
parents:
diff changeset
408
heinrichsweikamp
parents:
diff changeset
409 ; calculate C5 = UT1
heinrichsweikamp
parents:
diff changeset
410 ; C5 = 8*C5 + 10000 (u16 range 10.000 .. +42.760)
heinrichsweikamp
parents:
diff changeset
411 clrf isr_xA+1
heinrichsweikamp
parents:
diff changeset
412 movlw d'8'
heinrichsweikamp
parents:
diff changeset
413 movwf isr_xA+0
heinrichsweikamp
parents:
diff changeset
414 movff C5+0,isr_xB+0
heinrichsweikamp
parents:
diff changeset
415 movff C5+1,isr_xB+1
heinrichsweikamp
parents:
diff changeset
416 call isr_unsigned_mult16x16 ;isr_xA*isr_xB=isr_xC
heinrichsweikamp
parents:
diff changeset
417 movff isr_xC+0,C5+0
heinrichsweikamp
parents:
diff changeset
418 movff isr_xC+1,C5+1
heinrichsweikamp
parents:
diff changeset
419 movlw LOW d'10000'
heinrichsweikamp
parents:
diff changeset
420 addwf C5+0,F
heinrichsweikamp
parents:
diff changeset
421 movlw HIGH d'10000'
heinrichsweikamp
parents:
diff changeset
422 addwfc C5+1,F ; = 8*C5 + 10000
heinrichsweikamp
parents:
diff changeset
423
heinrichsweikamp
parents:
diff changeset
424 ; calculate C6 (16Bit)
heinrichsweikamp
parents:
diff changeset
425 clrf C6+1
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 178
diff changeset
426 movff ir_s8_buffer+6,C6+0
0
heinrichsweikamp
parents:
diff changeset
427 bcf C6+0,7
heinrichsweikamp
parents:
diff changeset
428
heinrichsweikamp
parents:
diff changeset
429 banksel common
heinrichsweikamp
parents:
diff changeset
430 bcf no_sensor_int ; enable sensor interrupts
heinrichsweikamp
parents:
diff changeset
431 bcf pressure_refresh ; Clear flag
heinrichsweikamp
parents:
diff changeset
432 banksel isr_backup ; Back to Bank0 ISR data
heinrichsweikamp
parents:
diff changeset
433
heinrichsweikamp
parents:
diff changeset
434 clrf sensor_state_counter ; Then reset State counter
heinrichsweikamp
parents:
diff changeset
435
heinrichsweikamp
parents:
diff changeset
436 return
heinrichsweikamp
parents:
diff changeset
437
heinrichsweikamp
parents:
diff changeset
438 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
439 reset_MS5541_one:
heinrichsweikamp
parents:
diff changeset
440 bsf MS5541_mosi
heinrichsweikamp
parents:
diff changeset
441 bra send_clk_pulse ; Send one high-low sequence on MS5541_clk -> and return
heinrichsweikamp
parents:
diff changeset
442
heinrichsweikamp
parents:
diff changeset
443 reset_MS5541_zero:
heinrichsweikamp
parents:
diff changeset
444 bcf MS5541_mosi
heinrichsweikamp
parents:
diff changeset
445 bra send_clk_pulse ; Send one high-low sequence on MS5541_clk -> and return
heinrichsweikamp
parents:
diff changeset
446
heinrichsweikamp
parents:
diff changeset
447 reset_MS5541:
heinrichsweikamp
parents:
diff changeset
448 rcall reset_MS5541_one ;0
heinrichsweikamp
parents:
diff changeset
449 rcall reset_MS5541_zero
heinrichsweikamp
parents:
diff changeset
450 rcall reset_MS5541_one
heinrichsweikamp
parents:
diff changeset
451 rcall reset_MS5541_zero
heinrichsweikamp
parents:
diff changeset
452 rcall reset_MS5541_one
heinrichsweikamp
parents:
diff changeset
453 rcall reset_MS5541_zero
heinrichsweikamp
parents:
diff changeset
454 rcall reset_MS5541_one
heinrichsweikamp
parents:
diff changeset
455 rcall reset_MS5541_zero
heinrichsweikamp
parents:
diff changeset
456 rcall reset_MS5541_one
heinrichsweikamp
parents:
diff changeset
457 rcall reset_MS5541_zero
heinrichsweikamp
parents:
diff changeset
458 rcall reset_MS5541_one
heinrichsweikamp
parents:
diff changeset
459 rcall reset_MS5541_zero
heinrichsweikamp
parents:
diff changeset
460 rcall reset_MS5541_one
heinrichsweikamp
parents:
diff changeset
461 rcall reset_MS5541_zero
heinrichsweikamp
parents:
diff changeset
462 rcall reset_MS5541_one
heinrichsweikamp
parents:
diff changeset
463 rcall reset_MS5541_zero ;15
heinrichsweikamp
parents:
diff changeset
464 rcall reset_MS5541_zero
heinrichsweikamp
parents:
diff changeset
465 rcall reset_MS5541_zero
heinrichsweikamp
parents:
diff changeset
466 rcall reset_MS5541_zero
heinrichsweikamp
parents:
diff changeset
467 rcall reset_MS5541_zero
heinrichsweikamp
parents:
diff changeset
468 rcall reset_MS5541_zero ;20
heinrichsweikamp
parents:
diff changeset
469 return
heinrichsweikamp
parents:
diff changeset
470
heinrichsweikamp
parents:
diff changeset
471 get_2bytes_MS5541:
heinrichsweikamp
parents:
diff changeset
472 movlw d'8'
heinrichsweikamp
parents:
diff changeset
473 movwf clock_count
heinrichsweikamp
parents:
diff changeset
474 rcall recieve_loop
heinrichsweikamp
parents:
diff changeset
475 movff isr1_temp,dMSB
heinrichsweikamp
parents:
diff changeset
476
heinrichsweikamp
parents:
diff changeset
477 movlw d'8'
heinrichsweikamp
parents:
diff changeset
478 movwf clock_count
heinrichsweikamp
parents:
diff changeset
479 rcall recieve_loop
heinrichsweikamp
parents:
diff changeset
480 movff isr1_temp,dLSB
heinrichsweikamp
parents:
diff changeset
481 bra send_clk_pulse ; Send one high-low sequence on MS5541_clk -> and return
heinrichsweikamp
parents:
diff changeset
482 ;return
heinrichsweikamp
parents:
diff changeset
483
heinrichsweikamp
parents:
diff changeset
484 recieve_loop:
heinrichsweikamp
parents:
diff changeset
485 rcall send_clk_pulse ; Send one high-low sequence on MS5541_clk
heinrichsweikamp
parents:
diff changeset
486 btfss MS5541_miso ;MSB first
heinrichsweikamp
parents:
diff changeset
487 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
488 btfsc MS5541_miso ;MSB first
heinrichsweikamp
parents:
diff changeset
489 bsf STATUS,C
heinrichsweikamp
parents:
diff changeset
490 rlcf isr1_temp,F
heinrichsweikamp
parents:
diff changeset
491 decfsz clock_count,F
heinrichsweikamp
parents:
diff changeset
492 bra recieve_loop
heinrichsweikamp
parents:
diff changeset
493 return
heinrichsweikamp
parents:
diff changeset
494
heinrichsweikamp
parents:
diff changeset
495 send_clk_pulse:
heinrichsweikamp
parents:
diff changeset
496 bsf MS5541_clk
heinrichsweikamp
parents:
diff changeset
497 nop
heinrichsweikamp
parents:
diff changeset
498 nop
heinrichsweikamp
parents:
diff changeset
499 nop
heinrichsweikamp
parents:
diff changeset
500 nop
29
50c3e2c7ba7a adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents: 0
diff changeset
501 nop
50c3e2c7ba7a adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents: 0
diff changeset
502 nop
0
heinrichsweikamp
parents:
diff changeset
503 bcf MS5541_clk
heinrichsweikamp
parents:
diff changeset
504 nop
heinrichsweikamp
parents:
diff changeset
505 nop
29
50c3e2c7ba7a adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents: 0
diff changeset
506 nop
50c3e2c7ba7a adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents: 0
diff changeset
507 nop
0
heinrichsweikamp
parents:
diff changeset
508 return
heinrichsweikamp
parents:
diff changeset
509
heinrichsweikamp
parents:
diff changeset
510 send_data_MS5541:
heinrichsweikamp
parents:
diff changeset
511 movwf clock_count ; From WREG
heinrichsweikamp
parents:
diff changeset
512 ; send three startbits first
heinrichsweikamp
parents:
diff changeset
513 bcf MS5541_clk
29
50c3e2c7ba7a adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents: 0
diff changeset
514 nop
50c3e2c7ba7a adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents: 0
diff changeset
515 nop
0
heinrichsweikamp
parents:
diff changeset
516 bsf MS5541_mosi
heinrichsweikamp
parents:
diff changeset
517 movlw d'3'
heinrichsweikamp
parents:
diff changeset
518 subwf clock_count,F ; total bit counter
heinrichsweikamp
parents:
diff changeset
519 rcall send_clk_pulse ; Send one high-low sequence on MS5541_clk
heinrichsweikamp
parents:
diff changeset
520 rcall send_clk_pulse ; Send one high-low sequence on MS5541_clk
heinrichsweikamp
parents:
diff changeset
521 rcall send_clk_pulse ; Send one high-low sequence on MS5541_clk
heinrichsweikamp
parents:
diff changeset
522 ; now send 8 bytes from isr_temp1 and fill-up with zeros
heinrichsweikamp
parents:
diff changeset
523 send_data_MS5541_2:
heinrichsweikamp
parents:
diff changeset
524 bcf MS5541_clk
29
50c3e2c7ba7a adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents: 0
diff changeset
525 nop
50c3e2c7ba7a adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents: 0
diff changeset
526 nop
0
heinrichsweikamp
parents:
diff changeset
527
heinrichsweikamp
parents:
diff changeset
528 btfss isr1_temp,7 ;MSB first
heinrichsweikamp
parents:
diff changeset
529 bcf MS5541_mosi
heinrichsweikamp
parents:
diff changeset
530 btfsc isr1_temp,7 ;MSB first
heinrichsweikamp
parents:
diff changeset
531 bsf MS5541_mosi
heinrichsweikamp
parents:
diff changeset
532
heinrichsweikamp
parents:
diff changeset
533 bsf MS5541_clk
heinrichsweikamp
parents:
diff changeset
534
heinrichsweikamp
parents:
diff changeset
535 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
536 rlcf isr1_temp,F
29
50c3e2c7ba7a adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents: 0
diff changeset
537 nop
50c3e2c7ba7a adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents: 0
diff changeset
538 nop
0
heinrichsweikamp
parents:
diff changeset
539 ; nop
heinrichsweikamp
parents:
diff changeset
540 ; nop
heinrichsweikamp
parents:
diff changeset
541 ; nop
heinrichsweikamp
parents:
diff changeset
542 ; nop
heinrichsweikamp
parents:
diff changeset
543 ; bcf MS5541_clk
heinrichsweikamp
parents:
diff changeset
544
heinrichsweikamp
parents:
diff changeset
545 decfsz clock_count,F
heinrichsweikamp
parents:
diff changeset
546 bra send_data_MS5541_2
heinrichsweikamp
parents:
diff changeset
547 bcf MS5541_clk
heinrichsweikamp
parents:
diff changeset
548 return
heinrichsweikamp
parents:
diff changeset
549
heinrichsweikamp
parents:
diff changeset
550 END