comparison code_part1/OSTC_code_asm_part1/menu_ppO2.asm @ 655:8c01edcf57fc

Allow any diluent to be "First gas" in CCR modes
author heinrichsweikamp
date Tue, 23 Oct 2012 10:03:47 +0200
parents 86b49e47b2f5
children 6e456a6398e0
comparison
equal deleted inserted replaced
654:a38d82918458 655:8c01edcf57fc
32 ; Diluent 3 (%O2,%He) 32 ; Diluent 3 (%O2,%He)
33 ; EEPROM BANK0 Byte102-103: 33 ; EEPROM BANK0 Byte102-103:
34 ; Diluent 4 (%O2,%He) 34 ; Diluent 4 (%O2,%He)
35 ; EEPROM BANK0 Byte104-105: 35 ; EEPROM BANK0 Byte104-105:
36 ; Diluent 5 (%O2,%He) 36 ; Diluent 5 (%O2,%He)
37 ; EEPROM BANK0 Byte106:
38 ; First Diluent (1-5)
37 39
38 40
39 menu_const_ppO2: 41 menu_const_ppO2:
40 movlw d'1' 42 movlw d'1'
41 movwf menupos 43 movwf menupos
113 movff decodata+0,lo 115 movff decodata+0,lo
114 incf lo,F 116 incf lo,F
115 bsf leftbind 117 bsf leftbind
116 output_99 118 output_99
117 PUTC ':' 119 PUTC ':'
120 call word_processor
121
122 WIN_LEFT .40
123 movf waitms_temp,W ; Load row into WREG
124 movff WREG,win_top
125 lfsr FSR2,letter
126
127 movlw d'106'
128 movwf EEADR
129 call read_eeprom ; Get current startgas 1-5 # into EEDATA
130 decf EEDATA,W ; 0-4
131 cpfseq decodata+0 ; =current displayed gas #?
132 bra menu_diluentsetup_Tx; no, do not display *
133 PUTC '*' ; display *
134 call word_processor
118 135
119 menu_diluentsetup_Tx: 136 menu_diluentsetup_Tx:
120 call word_processor
121
122 WIN_LEFT .48 137 WIN_LEFT .48
123 movf waitms_temp,W ; Load row into WREG 138 movf waitms_temp,W ; Load row into WREG
124 movff WREG,win_top 139 movff WREG,win_top
125 lfsr FSR2,letter 140 lfsr FSR2,letter
126 141
280 bcf first_FA ; Here: =1: -, =0: + 295 bcf first_FA ; Here: =1: -, =0: +
281 296
282 menu_diluentgas0: 297 menu_diluentgas0:
283 call PLED_ClearScreen 298 call PLED_ClearScreen
284 WIN_LEFT .20 299 WIN_LEFT .20
285 WIN_TOP .155 300 WIN_TOP .185
286 lfsr FSR2, letter 301 lfsr FSR2, letter
287 OUTPUTTEXT .11 ; Exit 302 OUTPUTTEXT .11 ; Exit
288 STRCAT_PRINT "" 303 STRCAT_PRINT ""
289 304
290 menu_diluentgas1: 305 menu_diluentgas1:
291 call menu_pre_loop_common ; Clear some menu flags, timeout and switches 306 call menu_pre_loop_common ; Clear some menu flags, timeout and switches
292
293 call diluent_title_bar2 ; Displays the title bar with the current Gas info 307 call diluent_title_bar2 ; Displays the title bar with the current Gas info
294 308
309 WIN_TOP .35
295 WIN_LEFT .20 310 WIN_LEFT .20
296 WIN_TOP .35 311 lfsr FSR2,letter
312 OUTPUTTEXT .88 ; First Gas?
313 PUTC ' '
314
315 movlw d'106'
316 movwf EEADR
317 call read_eeprom ; Get current startgas 1-5 # into EEDATA
318 decf EEDATA,W ; 0-4
319 cpfseq decodata+0 ; =current displayed gas #?
320 bra menu_firstdil0 ; no, display three spaces
321
322 OUTPUTTEXT .96 ; Yes
323 bsf second_FA ; Is first gas
324
325 bra menu_firstdil1
326
327 menu_firstdil0:
328 bcf second_FA ; Is not first gas
329 STRCAT " " ; 3 spaces.
330
331 menu_firstdil1:
332 call word_processor
333
334 WIN_LEFT .20
335 WIN_TOP .65
297 STRCPY TXT_O2_4 336 STRCPY TXT_O2_4
298 movff divemins+0,EEADR 337 movff divemins+0,EEADR
299 call read_eeprom ; O2 value 338 call read_eeprom ; O2 value
300 movff EEDATA,lo 339 movff EEDATA,lo
301 output_8 340 output_8
324 363
325 output_16 364 output_16
326 STRCAT_PRINT TXT_METER3 365 STRCAT_PRINT TXT_METER3
327 366
328 WIN_LEFT .20 367 WIN_LEFT .20
329 WIN_TOP .65 368 WIN_TOP .95
330 STRCPY TXT_HE4 369 STRCPY TXT_HE4
331 incf divemins+0,W 370 incf divemins+0,W
332 movwf EEADR 371 movwf EEADR
333 call read_eeprom ; He value 372 call read_eeprom ; He value
334 movff EEDATA,lo 373 movff EEDATA,lo
385 movff xC+1,hi 424 movff xC+1,hi
386 output_16 425 output_16
387 STRCAT_PRINT TXT_METER3 426 STRCAT_PRINT TXT_METER3
388 427
389 WIN_LEFT .20 428 WIN_LEFT .20
390 WIN_TOP .95 429 WIN_TOP .125
391 STRCPY "+/-: " 430 STRCPY "+/-: "
392 movlw '+' 431 movlw '+'
393 btfsc first_FA 432 btfsc first_FA
394 movlw '-' 433 movlw '-'
395 movwf POSTINC2 434 movwf POSTINC2
396 call word_processor 435 call word_processor
397 436
398 WIN_TOP .125 437 WIN_TOP .155
399 lfsr FSR2,letter 438 lfsr FSR2,letter
400 OUTPUTTEXT .89 ; Default: 439 OUTPUTTEXT .89 ; Default:
401 movlw .21 440 movlw .21
402 movwf lo ; Default always Air 441 movwf lo ; Default always Air
403 output_8 442 output_8
428 467
429 bra diluentgassetup_loop 468 bra diluentgassetup_loop
430 469
431 diluentgassetup2: 470 diluentgassetup2:
432 incf menupos,F 471 incf menupos,F
433 movlw d'6' 472 movlw d'7'
434 cpfseq menupos ; =6? 473 cpfseq menupos ; =7?
435 bra diluentgassetup3 ; No 474 bra diluentgassetup3 ; No
436 movlw d'1' 475 movlw d'1'
437 movwf menupos 476 movwf menupos
438 477
439 diluentgassetup3: 478 diluentgassetup3:
444 483
445 bcf menubit3 ; clear flag 484 bcf menubit3 ; clear flag
446 bra diluentgassetup_loop 485 bra diluentgassetup_loop
447 486
448 do_diluentgassetup: 487 do_diluentgassetup:
488 dcfsnz menupos,F
489 bra make_first_diluent
449 dcfsnz menupos,F 490 dcfsnz menupos,F
450 bra adjust_o2_diluent 491 bra adjust_o2_diluent
451 dcfsnz menupos,F 492 dcfsnz menupos,F
452 bra adjust_he_diluent 493 bra adjust_he_diluent
453 dcfsnz menupos,F 494 dcfsnz menupos,F
457 exit_diluentgassetup: ; exit... 498 exit_diluentgassetup: ; exit...
458 movff decodata+0,menupos 499 movff decodata+0,menupos
459 incf menupos,F 500 incf menupos,F
460 bra menu_diluentsetup_prelist 501 bra menu_diluentsetup_prelist
461 502
503 make_first_diluent:
504 movff decodata+0,EEDATA ; current gas (0-4) into EEDATA
505 incf EEDATA,F ; current gas (1-5) into EEDATA
506 movlw d'106'
507 movwf EEADR
508 call write_eeprom ; store in internal EEPROM
509 movlw d'1'
510 movwf menupos
511 bra menu_diluentgas1 ; return
512
462 toggle_plus_minus_diluentsetup: 513 toggle_plus_minus_diluentsetup:
463 btg first_FA 514 btg first_FA
464 movlw d'3' 515 movlw d'4'
465 movwf menupos 516 movwf menupos
466 bra menu_diluentgas1 ; return 517 bra menu_diluentgas1 ; return
467 518
468 adjust_o2_diluent: 519 adjust_o2_diluent:
469 movff divemins+0,EEADR ; read current value 520 movff divemins+0,EEADR ; read current value
513 adjust_o2_3_diluent: 564 adjust_o2_3_diluent:
514 movff divemins+0,EEADR ; save current value 565 movff divemins+0,EEADR ; save current value
515 movff lo,EEDATA 566 movff lo,EEDATA
516 call write_eeprom ; Low-value 567 call write_eeprom ; Low-value
517 568
518 movlw d'1' 569 movlw d'2'
519 movwf menupos 570 movwf menupos
520 bra menu_diluentgas1 ; return 571 bra menu_diluentgas1 ; return
521 572
522 adjust_he_diluent: 573 adjust_he_diluent:
523 incf divemins+0,W 574 incf divemins+0,W
558 incf divemins+0,W ; save current value 609 incf divemins+0,W ; save current value
559 movwf EEADR 610 movwf EEADR
560 movff lo,EEDATA 611 movff lo,EEDATA
561 call write_eeprom ; Low-value 612 call write_eeprom ; Low-value
562 613
563 movlw d'2' 614 movlw d'3'
564 movwf menupos 615 movwf menupos
565 bra menu_diluentgas1; 616 bra menu_diluentgas1;
566 617
567 restore_gas_diluent: 618 restore_gas_diluent:
568 movff divemins+0,EEADR ; save Default value (O2) 619 movff divemins+0,EEADR ; save Default value (O2)
570 movwf EEDATA 621 movwf EEDATA
571 call write_eeprom 622 call write_eeprom
572 incf EEADR,F ; Point to He 623 incf EEADR,F ; Point to He
573 clrf EEDATA 624 clrf EEDATA
574 call write_eeprom 625 call write_eeprom
575 movlw d'4' 626 movlw d'5'
576 movwf menupos 627 movwf menupos
577 bra menu_diluentgas1 628 bra menu_diluentgas1
578 629
579 630
580 diluent_title_bar2: 631 diluent_title_bar2:
702 STRCAT " (" 753 STRCAT " ("
703 754
704 OUTPUTTEXT d'192' ; Dil. 755 OUTPUTTEXT d'192' ; Dil.
705 PUTC ' ' 756 PUTC ' '
706 757
707 movlw d'96' ; = address for O2 ratio 758 rcall get_first_diluent ; Read first diluent into lo(O2) and hi(He)
708 movwf EEADR
709 call read_eeprom ; Read O2 ratio
710 movff EEDATA, lo ; O2 ratio
711 bsf leftbind 759 bsf leftbind
712 output_99 760 output_99 ; O2
713 PUTC '/' 761 PUTC '/'
714 movlw d'97' ; = address for He ratio 762 movff hi,lo
715 movwf EEADR 763 output_99 ; He
716 call read_eeprom ; Read He ratio
717 movff EEDATA,lo ; And copy into hold register
718 bsf leftbind
719 output_99
720 STRCAT_PRINT ")" 764 STRCAT_PRINT ")"
721
722 765
723 WIN_LEFT .20 766 WIN_LEFT .20
724 WIN_TOP .65 767 WIN_TOP .65
725 768
726 lfsr FSR2,letter 769 lfsr FSR2,letter
876 bra next_ppO22 919 bra next_ppO22
877 clrf decodata+0 ; yes, so reset to zero 920 clrf decodata+0 ; yes, so reset to zero
878 next_ppO22: 921 next_ppO22:
879 movlw d'1' 922 movlw d'1'
880 movwf menupos 923 movwf menupos
881 bra menu_const_ppO21 924 bra menu_const_ppO21
925
926 get_first_diluent: ; Read first diluent into lo(O2) and hi(He)
927 read_int_eeprom d'106' ; Read First Diluent (1-5)
928 decf EEDATA,W ; WREG: 0-4
929 mullw .2 ; PRODL: 0-8
930 movlw .96 ; Base address for O2
931 addwf PRODL,W
932 movwf EEADR
933 call read_eeprom ; Read O2
934 movff EEDATA,lo
935 incf EEADR,F
936 call read_eeprom ; Read He
937 movff EEDATA,hi
938 return
939