Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/ms5535.asm @ 81:31fa973a70fd
Kludges to emulate inexisting devices when debugged with the MPLAB software SIMulator.
author | JeanDo |
---|---|
date | Mon, 06 Dec 2010 18:05:39 +0100 |
parents | 2b5c52ae3923 |
children | 3e351e25f5d1 |
comparison
equal
deleted
inserted
replaced
80:d2d7cb96100d | 81:31fa973a70fd |
---|---|
259 movwf clock_count | 259 movwf clock_count |
260 rcall send_data_MS55535A | 260 rcall send_data_MS55535A |
261 return | 261 return |
262 | 262 |
263 get_pressure_value: | 263 get_pressure_value: |
264 #ifndef TESTING | |
265 ; Use register injection instead when in MPLab Sim emulation... | |
264 rcall get_2bytes_MS5535A | 266 rcall get_2bytes_MS5535A |
265 movff dMSB,D1+1 | 267 movff dMSB,D1+1 |
266 movff dLSB,D1+0 | 268 movff dLSB,D1+0 |
269 #endif | |
267 return | 270 return |
268 | 271 |
269 get_temperature_start: | 272 get_temperature_start: |
270 rcall reset_MS5535A | 273 rcall reset_MS5535A |
271 movlw b'10010000' ;+3*high as start and 1+low as stop! | 274 movlw b'10010000' ;+3*high as start and 1+low as stop! |
272 bra get_pressure_start2 ; continue in "get_pressure" | 275 bra get_pressure_start2 ; continue in "get_pressure" |
273 | 276 |
274 get_temperature_value: | 277 get_temperature_value: |
278 #ifndef TESTING | |
279 ; Use register injection instead... | |
275 rcall get_2bytes_MS5535A | 280 rcall get_2bytes_MS5535A |
276 movff dMSB,D2+1 | 281 movff dMSB,D2+1 |
277 movff dLSB,D2+0 | 282 movff dLSB,D2+0 |
283 #endif | |
278 return | 284 return |
279 | 285 |
280 get_calibration_data: | 286 get_calibration_data: |
281 ; ; read addional temperature correction from internal EEPROM 0x100 | 287 ; ; read addional temperature correction from internal EEPROM 0x100 |
282 ; bsf no_sensor_int ; No sensor interupt! | 288 ; bsf no_sensor_int ; No sensor interupt! |
289 ; clrf EEADRH ; Only 256Bytes used in normal program | 295 ; clrf EEADRH ; Only 256Bytes used in normal program |
290 ; movlw d'200' ; limit value | 296 ; movlw d'200' ; limit value |
291 ; cpfsgt EEDATA ; EEDATA>200? | 297 ; cpfsgt EEDATA ; EEDATA>200? |
292 ; movff EEDATA, temperature_correction ; No, Store for compensation | 298 ; movff EEDATA, temperature_correction ; No, Store for compensation |
293 ; | 299 ; |
300 ifdef TESTING | |
301 ; Get example calibration values (Intersema 5535B datasheet, p12). | |
302 movlw LOW .18556 | |
303 movwf W1+0 | |
304 movlw HIGH .18556 | |
305 movwf W1+1 | |
306 | |
307 movlw LOW .49183 | |
308 movwf W1+0 | |
309 movlw HIGH .49183 | |
310 movwf W1+1 | |
311 | |
312 movlw LOW .22354 | |
313 movwf W1+0 | |
314 movlw HIGH .22354 | |
315 movwf W1+1 | |
316 | |
317 movlw LOW .28083 | |
318 movwf W1+0 | |
319 movlw HIGH .28083 | |
320 movwf W1+1 | |
321 else | |
294 rcall reset_MS5535A | 322 rcall reset_MS5535A |
295 movlw d'13' | 323 movlw d'13' |
296 movwf clock_count | 324 movwf clock_count |
297 movlw b'01010100' ;+3*high as start and 1+low as stop! | 325 movlw b'01010100' ;+3*high as start and 1+low as stop! |
298 movwf isr1_temp | 326 movwf isr1_temp |
325 movwf isr1_temp | 353 movwf isr1_temp |
326 rcall send_data_MS55535A | 354 rcall send_data_MS55535A |
327 rcall get_2bytes_MS5535A | 355 rcall get_2bytes_MS5535A |
328 movff dMSB,W4+1 | 356 movff dMSB,W4+1 |
329 movff dLSB,W4+0 | 357 movff dLSB,W4+0 |
358 endif | |
330 | 359 |
331 ; calculate C1 (16Bit) | 360 ; calculate C1 (16Bit) |
332 movff W1+1, C1+1 | 361 movff W1+1, C1+1 |
333 bcf STATUS,C | 362 bcf STATUS,C |
334 rrcf C1+1 | 363 rrcf C1+1 |