comparison code_part1/OSTC_code_asm_part1/isr.asm @ 497:06db5dd9149f

show numeric _and_ graphic velocity, move desat, nofly and interval into isr
author heinrichsweikamp
date Wed, 09 Nov 2011 16:17:11 +0100
parents e565392e0fcc
children 77c8ff191cd7
comparison
equal deleted inserted replaced
496:97d3f5537b43 497:06db5dd9149f
386 movlw d'60' 386 movlw d'60'
387 cpfseq secs ; Secs == 60 ? 387 cpfseq secs ; Secs == 60 ?
388 return ; NO : done. 388 return ; NO : done.
389 clrf secs ; YES: increment minutes instead... 389 clrf secs ; YES: increment minutes instead...
390 bsf oneminupdate 390 bsf oneminupdate
391
392 btfss divemode ; In Divemode?
393 rcall check_nofly_desat_time ; No, so reduce NoFly and Desat and increase interval
394
391 incf mins,F 395 incf mins,F
392 movlw d'59' 396 movlw d'59'
393 cpfsgt mins 397 cpfsgt mins
394 return 398 return
395 clrf mins 399 clrf mins
437 return 441 return
438 movlw .1 442 movlw .1
439 movwf month 443 movwf month
440 incf year,F 444 incf year,F
441 return 445 return
446
447 check_nofly_desat_time:
448 bcf nofly_active ; Clear flag
449 movf nofly_time+0,W ; Is nofly null ?
450 iorwf nofly_time+1,W
451 bz check_nofly_desat_time2 ; yes...
452
453 bsf nofly_active ; Set flag (again)
454 movlw d'1'
455 subwf nofly_time+0,F
456 movlw d'0'
457 subwfb nofly_time+1,F ; reduce by one
458
459 check_nofly_desat_time2:
460 movff desaturation_time_buffer+0,lo
461 movff desaturation_time_buffer+1,hi
462
463 movf lo,W ; Is Desat null ?
464 iorwf hi,W
465 bz check_nofly_desat_time3 ; yes...
466
467 movlw d'1'
468 subwf lo,F
469 movlw d'0'
470 subwfb hi,F ; reduce by one...
471
472 movff lo,desaturation_time_buffer+0 ; ...and copy back
473 movff hi,desaturation_time_buffer+1
474
475 check_nofly_desat_time3:
476 ; Now increase interval timer
477 movff desaturation_time_buffer+0,lo
478 movff desaturation_time_buffer+1,hi
479 tstfsz lo ;=0?
480 bra calc_surface_interval2 ; No
481 tstfsz hi ;=0?
482 bra calc_surface_interval2 ; No
483 clrf surface_interval+0
484 clrf surface_interval+1 ; Clear surface interval timer
485 return ; Done.
486
487 calc_surface_interval2: ; Increase surface interval timer
488 movlw d'1'
489 addwf surface_interval+0,F
490 movlw d'0'
491 addwfc surface_interval+1,F
492 return ; Done