comparison src/adc_lightsensor.asm @ 196:a0e0ddfc1b49

suppress ghost readings for long, open cables
author heinrichsweikamp
date Thu, 06 Nov 2014 12:00:44 +0100
parents e79bc535ef9e
children dcd513840c6c
comparison
equal deleted inserted replaced
195:bca0f054f023 196:a0e0ddfc1b49
328 addwfc o2_mv_sensor1+1,F 328 addwfc o2_mv_sensor1+1,F
329 ; Devide by 2 329 ; Devide by 2
330 bcf STATUS,C 330 bcf STATUS,C
331 rrcf o2_mv_sensor1+1,F ; /2 331 rrcf o2_mv_sensor1+1,F ; /2
332 rrcf o2_mv_sensor1+0,F 332 rrcf o2_mv_sensor1+0,F
333
334 movlw HIGH ignore_mv
335 cpfsgt o2_mv_sensor1+1 ; >ignore_mv?
336 bra get_analog_inputs2a ; No
337 ; Yes, ignore this reading
338 clrf o2_mv_sensor1+1
339 clrf o2_mv_sensor1+0
340 get_analog_inputs2a:
333 ; Ignore 1,2mV noise for not-connected inputs 341 ; Ignore 1,2mV noise for not-connected inputs
334 tstfsz o2_mv_sensor1+1 ; >25,5mV? 342 tstfsz o2_mv_sensor1+1 ; >25,5mV?
335 bra get_analog_inputs2 ; Yes, skip here 343 bra get_analog_inputs2 ; Yes, skip here
336 movlw .12 344 movlw .12
337 cpfsgt o2_mv_sensor1+0 ; >1,2mV? 345 cpfsgt o2_mv_sensor1+0 ; >1,2mV?
348 addwfc o2_mv_sensor2+1,F 356 addwfc o2_mv_sensor2+1,F
349 ; Devide by 2 357 ; Devide by 2
350 bcf STATUS,C 358 bcf STATUS,C
351 rrcf o2_mv_sensor2+1,F ; /2 359 rrcf o2_mv_sensor2+1,F ; /2
352 rrcf o2_mv_sensor2+0,F 360 rrcf o2_mv_sensor2+0,F
361
362 movlw HIGH ignore_mv
363 cpfsgt o2_mv_sensor2+1 ; >ignore_mv?
364 bra get_analog_inputs3a ; No
365 ; Yes, ignore this reading
366 clrf o2_mv_sensor2+1
367 clrf o2_mv_sensor2+0
368 get_analog_inputs3a:
353 ; Ignore 1,2mV noise for not-connected inputs 369 ; Ignore 1,2mV noise for not-connected inputs
354 tstfsz o2_mv_sensor2+1 ; >25,5mV? 370 tstfsz o2_mv_sensor2+1 ; >25,5mV?
355 bra get_analog_inputs3 ; Yes, skip here 371 bra get_analog_inputs3 ; Yes, skip here
356 movlw .12 372 movlw .12
357 cpfsgt o2_mv_sensor2+0 ; >1,2mV? 373 cpfsgt o2_mv_sensor2+0 ; >1,2mV?
368 addwfc o2_mv_sensor3+1,F 384 addwfc o2_mv_sensor3+1,F
369 ; Devide by 2 385 ; Devide by 2
370 bcf STATUS,C 386 bcf STATUS,C
371 rrcf o2_mv_sensor3+1,F ; /2 387 rrcf o2_mv_sensor3+1,F ; /2
372 rrcf o2_mv_sensor3+0,F 388 rrcf o2_mv_sensor3+0,F
389
390 movlw HIGH ignore_mv
391 cpfsgt o2_mv_sensor3+1 ; >ignore_mv?
392 bra get_analog_inputs4a ; No
393 ; Yes, ignore this reading
394 clrf o2_mv_sensor3+1
395 clrf o2_mv_sensor3+0
396 get_analog_inputs4a:
373 ; Ignore 1,2mV noise for not-connected inputs 397 ; Ignore 1,2mV noise for not-connected inputs
374 tstfsz o2_mv_sensor3+1 ; >25,5mV? 398 tstfsz o2_mv_sensor3+1 ; >25,5mV?
375 bra get_analog_inputs4 ; Yes, skip here 399 bra get_analog_inputs4 ; Yes, skip here
376 movlw .12 400 movlw .12
377 cpfsgt o2_mv_sensor3+0 ; >1,2mV? 401 cpfsgt o2_mv_sensor3+0 ; >1,2mV?