comparison src/calibrate.asm @ 190:a0f9ec25852e

limit sensor-read ppO2 to 2.55bar
author heinrichsweikamp
date Wed, 29 Oct 2014 15:33:36 +0100
parents e79bc535ef9e
children efe70488a04b
comparison
equal deleted inserted replaced
189:e79bc535ef9e 190:a0f9ec25852e
263 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder 263 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
264 movlw d'1' 264 movlw d'1'
265 addwf xC+0,F 265 addwf xC+0,F
266 movlw d'0' 266 movlw d'0'
267 addwfc xC+1,F 267 addwfc xC+1,F
268 movff xC+0,o2_ppo2_sensor1+0 268 tstfsz xC+1 ; ppO2 is higher then 2.55bar?
269 movff xC+1,o2_ppo2_sensor1+1 ; result in 0.01bar 269 setf xC+0 ; Yes.
270 ; Set to zero if sensor is not active! 270 movff xC+0,o2_ppo2_sensor1 ; result in 0.01bar
271 ; Set to zero if sensor is not active!
271 btfss use_02_sensor1 272 btfss use_02_sensor1
272 clrf o2_ppo2_sensor1+0 273 clrf o2_ppo2_sensor1
273 btfss use_02_sensor1
274 clrf o2_ppo2_sensor1+1
275 274
276 ; o2_mv_sensor2:2 * opt_x_s1:2 = o2_ppo2_sensor2/10000 275 ; o2_mv_sensor2:2 * opt_x_s1:2 = o2_ppo2_sensor2/10000
277 movff o2_mv_sensor2+0,xA+0 276 movff o2_mv_sensor2+0,xA+0
278 movff o2_mv_sensor2+1,xA+1 277 movff o2_mv_sensor2+1,xA+1
279 movff opt_x_s2+0,xB+0 278 movff opt_x_s2+0,xB+0
286 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder 285 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
287 movlw d'1' 286 movlw d'1'
288 addwf xC+0,F 287 addwf xC+0,F
289 movlw d'0' 288 movlw d'0'
290 addwfc xC+1,F 289 addwfc xC+1,F
291 movff xC+0,o2_ppo2_sensor2+0 290 tstfsz xC+1 ; ppO2 is higher then 2.55bar?
292 movff xC+1,o2_ppo2_sensor2+1 ; result in 0.01bar 291 setf xC+0 ; Yes.
292 movff xC+0,o2_ppo2_sensor2 ; result in 0.01bar
293 ; Set to zero if sensor is not active! 293 ; Set to zero if sensor is not active!
294 btfss use_02_sensor2 294 btfss use_02_sensor2
295 clrf o2_ppo2_sensor2+0 295 clrf o2_ppo2_sensor2
296 btfss use_02_sensor2
297 clrf o2_ppo2_sensor2+1
298 296
299 ; o2_mv_sensor3:2 * opt_x_s1:2 = o2_ppo2_sensor3/10000 297 ; o2_mv_sensor3:2 * opt_x_s1:2 = o2_ppo2_sensor3/10000
300 movff o2_mv_sensor3+0,xA+0 298 movff o2_mv_sensor3+0,xA+0
301 movff o2_mv_sensor3+1,xA+1 299 movff o2_mv_sensor3+1,xA+1
302 movff opt_x_s3+0,xB+0 300 movff opt_x_s3+0,xB+0
309 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder 307 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
310 movlw d'1' 308 movlw d'1'
311 addwf xC+0,F 309 addwf xC+0,F
312 movlw d'0' 310 movlw d'0'
313 addwfc xC+1,F 311 addwfc xC+1,F
314 movff xC+0,o2_ppo2_sensor3+0 312 tstfsz xC+1 ; ppO2 is higher then 2.55bar?
315 movff xC+1,o2_ppo2_sensor3+1 ; result in 0.01bar 313 setf xC+0 ; Yes.
314 movff xC+0,o2_ppo2_sensor3 ; result in 0.01bar
316 ; Set to zero if sensor is not active! 315 ; Set to zero if sensor is not active!
317 btfss use_02_sensor3 316 btfss use_02_sensor3
318 clrf o2_ppo2_sensor3+0 317 clrf o2_ppo2_sensor3
319 btfss use_02_sensor3
320 clrf o2_ppo2_sensor3+1
321
322 return ; Done. 318 return ; Done.
323 319
324 320
325 compute_mvolts_for_all_sensors: ; Compute mV or all sensors (S8 Mode) 321 compute_mvolts_for_all_sensors: ; Compute mV or all sensors (S8 Mode)
326 ; compute AD results in 100µV steps (16bit/sensor) 322 ; compute AD results in 100µV steps (16bit/sensor)