Mercurial > public > hwos_code
comparison src/eeprom_rs232.asm @ 629:237931377539
3.07 stable release
| author | heinrichsweikamp |
|---|---|
| date | Fri, 29 Nov 2019 18:48:11 +0100 |
| parents | cd58f7fc86db |
| children | 185ba2f91f59 |
comparison
equal
deleted
inserted
replaced
| 628:cd58f7fc86db | 629:237931377539 |
|---|---|
| 1 ;============================================================================= | 1 ;============================================================================= |
| 2 ; | 2 ; |
| 3 ; File eeprom_rs232.asm combined next generation V3.04.3 | 3 ; File eeprom_rs232.asm combined next generation V3.06.2 |
| 4 ; | 4 ; |
| 5 ; Internal EEPROM, RS232 | 5 ; Internal EEPROM, RS232 |
| 6 ; | 6 ; |
| 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. |
| 8 ;============================================================================= | 8 ;============================================================================= |
| 98 bsf INTCON,GIE ; ...but the flag for the ISR routines were still set, so they will interrupt now! | 98 bsf INTCON,GIE ; ...but the flag for the ISR routines were still set, so they will interrupt now! |
| 99 return | 99 return |
| 100 | 100 |
| 101 ;============================================================================= | 101 ;============================================================================= |
| 102 | 102 |
| 103 IFDEF _external_sensor | |
| 104 | |
| 105 global disable_ir_s8 | 103 global disable_ir_s8 |
| 106 disable_ir_s8: | 104 disable_ir_s8: |
| 107 banksel TXSTA2 ; select bank for IO register access | 105 banksel TXSTA2 ; select bank for IO register access |
| 108 clrf TXSTA2 | 106 clrf TXSTA2 |
| 109 clrf RCSTA2 | 107 clrf RCSTA2 |
| 110 banksel common ; back to bank common | 108 banksel common ; back to bank common |
| 111 bcf ir_power ; IR off | 109 bcf PIE3,RC2IE ; disable RC2 INT |
| 112 bcf mcp_power ; power-down instrumentation amp | 110 bcf ir_power ; IR off |
| 113 bsf s8_npower ; power-down S8 digital interface | 111 bcf mcp_power ; power-down instrumentation amp |
| 114 bcf s8_digital_avail ; digital S8 interface not available | 112 bsf s8_npower ; power-down S8 digital interface |
| 113 bcf s8_digital_avail ; digital S8 interface not available | |
| 115 return | 114 return |
| 116 | 115 |
| 117 | 116 |
| 118 global enable_ir_s8 | 117 global enable_ir_s8 |
| 119 enable_ir_s8: | 118 enable_ir_s8: |
| 131 clrf SPBRGH2 | 130 clrf SPBRGH2 |
| 132 movlw b'10010000' | 131 movlw b'10010000' |
| 133 movwf RCSTA2 | 132 movwf RCSTA2 |
| 134 banksel common ; - back to bank common | 133 banksel common ; - back to bank common |
| 135 bsf ir_power ; - power-up IR | 134 bsf ir_power ; - power-up IR |
| 136 btfss ir_power | 135 btfss ir_power ; - power-up confirmed? |
| 137 bra $-6 | 136 bra $-6 ; NO - loop and wait |
| 138 return | 137 bsf PIE3,RC2IE ; - enable RC2 INT |
| 138 return ; - done | |
| 139 | 139 |
| 140 enable_s8: | 140 enable_s8: |
| 141 banksel TXSTA2 ; select bank for IO register access | 141 banksel TXSTA2 ; select bank for IO register access |
| 142 clrf TXSTA2 | 142 clrf TXSTA2 |
| 143 clrf RCSTA2 | 143 clrf RCSTA2 |
| 144 banksel common ; back to bank common | 144 banksel common ; back to bank common |
| 145 ; Check for Digital/Analog | 145 ; Check for Digital/Analog |
| 146 bsf s8_npower ; power-down S8 HUD | 146 bsf s8_npower ; power-down S8 HUD |
| 176 movlw b'10010000' | 176 movlw b'10010000' |
| 177 movwf RCSTA2 | 177 movwf RCSTA2 |
| 178 banksel common ; back to bank common | 178 banksel common ; back to bank common |
| 179 bsf s8_digital_avail ; digital S8 interface available | 179 bsf s8_digital_avail ; digital S8 interface available |
| 180 return | 180 return |
| 181 | |
| 182 ENDIF ; _external_sensor | |
| 183 | 181 |
| 184 ;============================================================================= | 182 ;============================================================================= |
| 185 | 183 |
| 186 global enable_rs232 | 184 global enable_rs232 |
| 187 enable_rs232: | 185 enable_rs232: |
| 330 ; Vault in EEPROM 512...1023 | 328 ; Vault in EEPROM 512...1023 |
| 331 ; Write 0xAA at 512 to indicate valid data in vault | 329 ; Write 0xAA at 512 to indicate valid data in vault |
| 332 ; Store last time/date | 330 ; Store last time/date |
| 333 ; Store 0x700 to 0x780 (pres_tissue_N2 and pres_tissue_He) | 331 ; Store 0x700 to 0x780 (pres_tissue_N2 and pres_tissue_He) |
| 334 movlw HIGH .512 ; =2 | 332 movlw HIGH .512 ; =2 |
| 335 movwf EEADRH | 333 movwf EEADRH ; set EEPROM address, high byte |
| 336 | 334 |
| 337 ; indicate valid data in vault | 335 ; indicate valid data in vault |
| 338 movlw 0xAA | 336 movlw 0xAA |
| 339 movwf EEDATA | 337 movwf EEDATA |
| 340 write_int_eeprom .0 | 338 write_int_eeprom .0 |
| 362 movff int_O_desaturation_time+0,EEDATA; get desaturation time, low byte | 360 movff int_O_desaturation_time+0,EEDATA; get desaturation time, low byte |
| 363 write_int_eeprom .9 ; store value | 361 write_int_eeprom .9 ; store value |
| 364 movff int_O_desaturation_time+1,EEDATA; get desaturation time, high byte | 362 movff int_O_desaturation_time+1,EEDATA; get desaturation time, high byte |
| 365 write_int_eeprom .10 ; store value | 363 write_int_eeprom .10 ; store value |
| 366 | 364 |
| 367 SMOVII surface_interval,mpr ; ISR-safe copy of surface interval | 365 SMOVII surface_interval_mins,mpr ; ISR-safe copy of surface interval |
| 368 movff mpr+0,EEDATA ; get surface interval, low byte | 366 movff mpr+0,EEDATA ; get surface interval, low byte |
| 369 write_int_eeprom .11 ; store value | 367 write_int_eeprom .11 ; store value |
| 370 movff mpr+1,EEDATA ; get surface interval, high byte | 368 movff mpr+1,EEDATA ; get surface interval, high byte |
| 371 write_int_eeprom .12 ; store value | 369 write_int_eeprom .12 ; store value |
| 372 | 370 |
| 395 | 393 |
| 396 | 394 |
| 397 global restore_decodata_from_eeprom | 395 global restore_decodata_from_eeprom |
| 398 restore_decodata_from_eeprom: | 396 restore_decodata_from_eeprom: |
| 399 movlw LOW .512 ; =0 | 397 movlw LOW .512 ; =0 |
| 400 movwf EEADR | 398 movwf EEADR ; set EEPROM address, low byte |
| 401 movlw HIGH .512 ; =2 | 399 movlw HIGH .512 ; =2 |
| 402 movwf EEADRH | 400 movwf EEADRH ; set EEPROM address, high byte |
| 403 | 401 |
| 404 ; restore date and time | 402 ; restore date and time |
| 405 read_int_eeprom .1 | 403 read_int_eeprom .1 |
| 406 movff EEDATA,rtc_latched_year | 404 movff EEDATA,rtc_latched_year |
| 407 read_int_eeprom .2 | 405 read_int_eeprom .2 |
| 428 | 426 |
| 429 read_int_eeprom .11 ; read surface interval, low byte | 427 read_int_eeprom .11 ; read surface interval, low byte |
| 430 movff EEDATA,mpr+0 ; cache value in mpr | 428 movff EEDATA,mpr+0 ; cache value in mpr |
| 431 read_int_eeprom .12 ; read surface interval, high byte | 429 read_int_eeprom .12 ; read surface interval, high byte |
| 432 movff EEDATA,mpr+1 ; cache value in mpr | 430 movff EEDATA,mpr+1 ; cache value in mpr |
| 433 SMOVII mpr,surface_interval ; ISR-safe copy-back of surface interval | 431 SMOVII mpr,surface_interval_mins ; ISR-safe copy-back of surface interval |
| 434 | 432 |
| 435 read_int_eeprom .13 ; read leading tissue's supersaturation | 433 read_int_eeprom .13 ; read leading tissue's supersaturation |
| 436 movff EEDATA,int_O_lead_supersat+0 ; restore value | 434 movff EEDATA,int_O_lead_supersat+0 ; restore value |
| 437 | 435 |
| 438 read_int_eeprom .14 ; read no-fly/no-altitude time, low byte | 436 read_int_eeprom .14 ; read no-fly/no-altitude time, low byte |
| 450 call read_eeprom ; EEPROM@EEADR into EEDATA | 448 call read_eeprom ; EEPROM@EEADR into EEDATA |
| 451 movff EEDATA,POSTINC1 | 449 movff EEDATA,POSTINC1 |
| 452 incf EEADR,F | 450 incf EEADR,F |
| 453 decfsz lo,F ; all done? | 451 decfsz lo,F ; all done? |
| 454 bra restore_decodata_from_eeprom2 ; NO - loop | 452 bra restore_decodata_from_eeprom2 ; NO - loop |
| 455 clrf EEADRH ; YES | 453 clrf EEADRH ; YES - revert EEPROM high address pointer to default |
| 456 return | 454 return ; - done |
| 457 | 455 |
| 458 ;============================================================================= | 456 ;============================================================================= |
| 459 | 457 |
| 460 global reset_battery_pointer ; called from comm and menu tree | 458 global reset_battery_pointer ; called from comm and menu tree |
| 461 global reset_battery_internal_only | 459 global reset_battery_internal_only |
