Mercurial > public > mk2
changeset 472:360f540da5b2
Merge with Bugfix 463
author | JeanDo |
---|---|
date | Sun, 09 Oct 2011 17:36:07 +0200 |
parents | 42acd9316f7a (diff) 5546da23afab (current diff) |
children | 0ff08e0e5f70 |
files | |
diffstat | 9 files changed, 90 insertions(+), 449 deletions(-) [+] |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/alt_wait.asm Sun Sep 25 17:39:44 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,399 +0,0 @@ -; OSTC - diving computer code -; Copyright (C) 2008 HeinrichsWeikamp GbR -; This program is free software: you can redistribute it and/or modify -; it under the terms of the GNU General Public License as published by -; the Free Software Foundation, either version 3 of the License, or -; (at your option) any later version. -; This program is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. -; You should have received a copy of the GNU General Public License -; along with this program. If not, see <http://www.gnu.org/licenses/>. -; Wait routines -; written by: chsw, info@heinrichsweikamp.com -; written: 01/31/04 -; last updated: 11/05/07 -; known bugs: -; ToDo: - IFDEF Clk_4_MHZ - MESSG "wait_v2i: switched to 4 MHZ operation" - ELSE - IFDEF Clk_8_MHZ - MESSG "wait_v2i: switched to 8 MHZ operation" - ELSE - IFDEF Clk_16_MHZ - MESSG "wait_v2i: switched to 16 MHZ operation" - ELSE - IFDEF Clk_20_MHZ - MESSG "wait_v2i: switched to 20 MHZ operation" - ELSE - ERROR "wait_v2i: Operating Frequency has to be specified by #DEFINE Clk_4_MHZ or Clk_8_MHZ" - ENDIF - ENDIF - ENDIF - IFDEF Clk_16_MHZ -; ========================================================== -; WAIT 10 MICROSECONDS - 16 MHZ -; ========================================================== -WAIT10US macro wait_temp - movlw wait_temp - IFNDEF DEBUG - call WAIT10USX - ENDIF - endm - -WAIT10USX movwf wait_temp - goto JumpIn10us -WAIT10USX2 nop - nop - nop - nop - nop - nop - nop - nop - nop -JumpIn10us: - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - decfsz wait_temp,1 - goto WAIT10USX2 - return -; ========================================================== -; WAIT 1 MILLISECOND - 16 MHZ -; ========================================================== -WAITMS macro waitms_temp - movlw waitms_temp - IFNDEF DEBUG - call WAITMSX - ENDIF - endm -WAITMSX movwf waitms_temp - goto JumpInMSX -WAITMSX2 nop - nop - nop - nop - nop - nop - nop - nop - nop -JumpInMSX: - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - WAIT10US d'99' - decfsz waitms_temp,1 - goto WAITMSX2 - return - ELSE - IFDEF Clk_8_MHZ -; ========================================================== -; WAIT 10 MICROSECONDS - 8 MHZ -; ========================================================== -WAIT10US macro wait_temp - movlw wait_temp - IFNDEF DEBUG - call WAIT10USX - ENDIF - endm -WAIT10USX movwf wait_temp - goto JumpIn10us -WAIT10USX2 nop - nop - nop - nop - nop - nop - nop -JumpIn10us: - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - decfsz wait_temp,1 - goto WAIT10USX2 - return -; ========================================================== -; WAIT 1 MILLISECOND - 8 MHZ -; ========================================================== -WAITMS macro waitms_temp - movlw waitms_temp - IFNDEF DEBUG - call WAITMSX - ENDIF - endm -WAITMSX movwf waitms_temp - goto JumpInMSX - -WAITMSX2 nop - nop - nop - nop - nop - nop - nop -JumpInMSX: - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - WAIT10US d'99' - decfsz waitms_temp,1 - goto WAITMSX2 - return - ELSE - IFDEF Clk_4_MHZ -; ========================================================== -; WAIT 10 MICROSECONDS - 4 MHZ -; ========================================================== -WAIT10US macro wait_temp - movlw wait_temp - IFNDEF DEBUG - call WAIT10USX - ENDIF - endm -WAIT10USX movwf wait_temp - goto JumpIn10us -WAIT10USX2 nop - nop - nop - nop - nop - nop - nop -JumpIn10us: - decfsz wait_temp,1 - goto WAIT10USX2 - return -; ========================================================== -; WAIT 1 MILLISECOND - 4 MHZ -; ========================================================== -WAITMS macro waitms_temp - movlw waitms_temp - IFNDEF DEBUG - call WAITMSX - ENDIF - endm -WAITMSX movwf waitms_temp - goto JumpInMSX - -WAITMSX2 nop - nop - nop - nop - nop - nop - nop -JumpInMSX: - WAIT10US d'99' - decfsz waitms_temp,1 - goto WAITMSX2 - return - ELSE - IFDEF Clk_20_MHZ - ========================================================== -; WAIT 10 MICROSECONDS - 20 MHZ -; ========================================================== -WAIT10US macro wait_temp - movlw wait_temp - IFNDEF DEBUG - call WAIT10USX - ENDIF - endm -WAIT10USX movwf wait_temp - goto JumpIn10us -WAIT10USX2 nop - nop - nop - nop - nop - nop - nop -JumpIn10us: - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - decfsz wait_temp,1 - goto WAIT10USX2 - return -; ========================================================== -; WAIT 1 MILLISECOND - 20 MHZ -; ========================================================== -WAITMS macro waitms_temp - movlw waitms_temp - IFNDEF DEBUG - call WAITMSX - ENDIF - endm -WAITMSX movwf waitms_temp - goto JumpInMSX - -WAITMSX2 nop - nop - nop - nop - nop - nop - nop -JumpInMSX: - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - WAIT10US d'99' - decfsz waitms_temp,1 - goto WAITMSX2 - return - ENDIF - ENDIF - ENDIF - ENDIF - ENDIF - - -wait_one_second: - WAITMS d'250' - WAITMS d'250' - WAITMS d'250' - WAITMS d'250' - return
--- a/code_part1/OSTC_code_asm_part1/definitions.asm Sun Sep 25 17:39:44 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/definitions.asm Sun Oct 09 17:36:07 2011 +0200 @@ -41,6 +41,19 @@ #DEFINE logbook_profile_version 0x21 ; Do not touch! #DEFINE T0CON_debounce b'00000000' ; Timer0 Switch Debounce + +; CPU Speed Settings +; Standard 16MHz mode +; #DEFINE SPBRG_VALUE d'34' +; #DEFINE OSCCON_VALUE b'01101100' ; 4MHz (x4 PLL) +; #DEFINE SSPADD_VALUE d'8' ; 400kHz I2C clock @ 16MHz Fcy +; #DEFINE T0CON_VALUE b'00011111' ; Timer0 +; Experimental 32MHz mode + #DEFINE SPBRG_VALUE d'68' + #DEFINE OSCCON_VALUE b'01111100' ; 8MHz (x4 PLL) + #DEFINE SSPADD_VALUE d'16' ; 400kHz I2C clock @ 32MHz Fcy + #DEFINE T0CON_VALUE b'00010000' ; Timer0 + #DEFINE FT_SMALL .0 #DEFINE FT_MEDIUM .1 #DEFINE FT_LARGE .2
--- a/code_part1/OSTC_code_asm_part1/eeprom_rs232.asm Sun Sep 25 17:39:44 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/eeprom_rs232.asm Sun Oct 09 17:36:07 2011 +0200 @@ -126,7 +126,7 @@ movlw b'00001000' movwf BAUDCON clrf SPBRGH - movlw d'34' ; Take care of the baud rate when changing Fosc! + movlw SPBRG_VALUE ; Take care of the baud rate when changing Fosc! movwf SPBRG clrf RCREG clrf PIR1
--- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm Sun Sep 25 17:39:44 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm Sun Oct 09 17:36:07 2011 +0200 @@ -944,7 +944,7 @@ movlw .2 ; Check firmware x > 1 cpfslt hi ; <2? bsf show_cns_in_logbook ; No, set flag - output_8 + output_99x call word_processor ; Display Gas information bcf leftbind ; Clear flag
--- a/code_part1/OSTC_code_asm_part1/menu_reset.asm Sun Sep 25 17:39:44 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm Sun Oct 09 17:36:07 2011 +0200 @@ -324,23 +324,7 @@ bcf nofly_active ; Clear flag ; reset gases - clrf EEADRH ; EEPROM BANK 0 ! - - movlw d'3' ; address of first gas-1 - movwf EEADR - clrf hi ; He part (default for all gases: 0%) - movlw d'21' ; O2 part (21%) - rcall reset_gas ; saves default and current value for gas #1 - movlw d'21' ; O2 part (21%) - rcall reset_gas ; saves default and current value for gas #2 - movlw d'21' ; O2 part (21%) - rcall reset_gas ; saves default and current value for gas #3 - movlw d'21' ; O2 part (21%) - rcall reset_gas ; saves default and current value for gas #4 - movlw d'21' ; O2 part (21%) - rcall reset_gas ; saves default and current value for gas #5 - movlw d'21' ; O2 part (21%) - rcall reset_gas ; saves default and current value for gas #6 + rcall reset_gases reset_all_cf: movlw d'1' @@ -434,14 +418,44 @@ ;call reset_external_eeprom ; delete profile memory goto restart ; all reset, quit to surfmode +reset_gases: + clrf EEADRH ; EEPROM BANK 0 ! + + movlw d'3' ; address of first gas-1 + movwf EEADR + clrf hi ; He part (default for all gases: 0%) + movlw d'21' ; O2 part (21%) + rcall reset_gas ; saves current value for gas #1 + movlw d'21' ; O2 part (21%) + rcall reset_gas ; saves default value for gas #1 + movlw d'21' ; O2 part (21%) + rcall reset_gas ; saves current value for gas #2 + movlw d'21' ; O2 part (21%) + rcall reset_gas ; saves default value for gas #2 + movlw d'21' ; O2 part (21%) + rcall reset_gas ; saves current value for gas #3 + movlw d'21' ; O2 part (21%) + rcall reset_gas ; saves default value for gas #3 + movlw d'21' ; O2 part (21%) + rcall reset_gas ; saves current value for gas #4 + movlw d'21' ; O2 part (21%) + rcall reset_gas ; saves default value for gas #4 + movlw d'21' ; O2 part (21%) + rcall reset_gas ; saves current value for gas #5 + movlw d'21' ; O2 part (21%) + rcall reset_gas ; saves default value for gas #5 + movlw d'21' ; O2 part (21%) + rcall reset_gas ; saves current value for gas #6 + return + ; Write WREG:lo twice, w/o any type clearing, pre-incrementing EEADR reset_gas: movwf lo incf EEADR,F - movff lo, EEDATA ; Lowbyte Default value + movff lo, EEDATA ; O2 Default value call write_eeprom incf EEADR,F - movff hi, EEDATA ; Highbyte default value + movff hi, EEDATA ; He default value call write_eeprom return
--- a/code_part1/OSTC_code_asm_part1/ms5535.asm Sun Sep 25 17:39:44 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/ms5535.asm Sun Oct 09 17:36:07 2011 +0200 @@ -430,8 +430,8 @@ nop nop nop - nop - nop + btfsc OSCCON,4 ; 32MHz Mode? + rcall MS5535A_extra_wait ; Yes bcf sensor_CLK return @@ -443,11 +443,19 @@ nop nop nop - nop - nop + btfsc OSCCON,4 ; 32MHz Mode? + rcall MS5535A_extra_wait ; Yes bcf sensor_CLK return +MS5535A_extra_wait: + nop + nop + nop + nop + nop + return + reset_MS5535A: rcall reset_MS5535A_one ;0 rcall reset_MS5535A_zero @@ -487,8 +495,8 @@ nop nop nop - nop - nop + btfsc OSCCON,4 ; 32MHz Mode? + rcall MS5535A_extra_wait ; Yes bcf sensor_CLK return @@ -498,8 +506,8 @@ nop nop nop - nop - nop + btfsc OSCCON,4 ; 32MHz Mode? + rcall MS5535A_extra_wait ; Yes bcf sensor_CLK btfss sensor_SDI ;MSB first bcf STATUS,C @@ -521,39 +529,39 @@ nop nop nop - nop - nop + btfsc OSCCON,4 ; 32MHz Mode? + rcall MS5535A_extra_wait ; Yes bcf sensor_CLK nop nop nop nop - nop - nop + btfsc OSCCON,4 ; 32MHz Mode? + rcall MS5535A_extra_wait ; Yes bsf sensor_CLK nop nop nop nop - nop - nop + btfsc OSCCON,4 ; 32MHz Mode? + rcall MS5535A_extra_wait ; Yes bcf sensor_CLK nop nop nop nop - nop - nop + btfsc OSCCON,4 ; 32MHz Mode? + rcall MS5535A_extra_wait ; Yes bsf sensor_CLK nop nop nop nop - nop - nop + btfsc OSCCON,4 ; 32MHz Mode? + rcall MS5535A_extra_wait ; Yes bcf sensor_CLK ; now send 8 bytes from isr_temp1 and fill-up with zeros -datenbits: +databits: btfss isr1_temp,7 ;MSB first bcf sensor_SDO btfsc isr1_temp,7 ;MSB first @@ -566,10 +574,10 @@ nop nop nop - nop - nop + btfsc OSCCON,4 ; 32MHz Mode? + rcall MS5535A_extra_wait ; Yes bcf sensor_CLK decfsz clock_count,F - bra datenbits + bra databits return
--- a/code_part1/OSTC_code_asm_part1/start.asm Sun Sep 25 17:39:44 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/start.asm Sun Oct 09 17:36:07 2011 +0200 @@ -142,6 +142,9 @@ write_int_eeprom d'193' write_int_eeprom d'194' ; Reset Default and Current Value to zero clrf EEADRH + +; reset gases (Bug in 2.0 stable) + call reset_gases ; goto reset_all_cf ; resets all custom functions bank0 and bank1 and jumps to "restart" restart: @@ -269,7 +272,7 @@ ; Pre-load modes for OC, GF 90/90 and no Aponoe or Gauge. bcf no_deco_customviews ; Clear no-deco-mode-flag movlw d'0' - movff WREG,char_I_deco_model ; Clear Flagbyte + movff WREG,char_I_deco_model ; ZH-L16 ; Load GF values into RAM movlw d'90' movff WREG,char_I_GF_Low_percentage @@ -395,7 +398,7 @@ bra start3 ; continue with normal start init: - movlw b'01101100' ; 4MHz (x4 PLL) + movlw OSCCON_VALUE movwf OSCCON movlw b'00010001' ; I/O Ports @@ -417,7 +420,7 @@ movlw b'01000000' ; Bit6: PPL enable movwf OSCTUNE - movlw b'00011111' ; Timer0 + movlw T0CON_VALUE ; Timer0 movwf T0CON movlw b'00000111' ; Timer1 @@ -449,7 +452,7 @@ movwf SSPCON1 movlw b'00000000' movwf SSPCON2 - movlw d'8' ; 400kHz I2C clock @ 16MHz Fcy + movlw SSPADD_VALUE ; I²C Speed movwf SSPADD clrf CCP1CON ; PWM Module off @@ -468,7 +471,7 @@ movlw b'00001000' movwf BAUDCON clrf SPBRGH - movlw d'34' + movlw SPBRG_VALUE movwf SPBRG clrf RCREG clrf PIR1
--- a/code_part1/OSTC_code_asm_part1/surfmode.asm Sun Sep 25 17:39:44 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/surfmode.asm Sun Oct 09 17:36:07 2011 +0200 @@ -99,6 +99,8 @@ ; Desaturation time needs: ; int_I_pres_surface ; char_I_desaturation_multiplier + movlw d'0' + movff WREG,char_I_deco_model ; ZH-L16 GETCUSTOM8 d'12' ; Desaturation multiplier % movff WREG,char_I_desaturation_multiplier