Mercurial > public > mk2
changeset 61:f254a568e73d
cleanup
author | heinrichsweikamp |
---|---|
date | Thu, 05 Aug 2010 09:50:24 +0200 |
parents | 3691ea95a34d |
children | 2972a06b0785 |
files | code_part1/OSTC_code_c_part2/p2_deco_main - 090915a.c code_part1/OSTC_code_c_part2/p2_deco_main - 090915b.c code_part1/OSTC_code_c_part2/p2_deco_main - 090915b.err code_part1/OSTC_code_c_part2/p2_deco_main - 090915b.i |
diffstat | 4 files changed, 0 insertions(+), 17806 deletions(-) [+] |
line wrap: on
line diff
--- a/code_part1/OSTC_code_c_part2/p2_deco_main - 090915a.c Thu Aug 05 09:49:32 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3202 +0,0 @@ -/* - * p2_deco_main.c - * - * Created on: 31.08.2009 - * Author: christian.w @ heinrichsweikamp.com - * - */ - -//#include <p2_deco_header_c_v102d.h> - -// OSTC - diving computer code -// Copyright (C) 2009 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/>. - - -// ***************************** -// ** I N T R O D U C T I O N ** -// ***************************** -// -// OSTC -// -// code: -// p2_deco_main_c_v101.c -// part2 of the OSTC code -// code with constant O2 partial pressure routines -// under construction !! -// -// summary: -// decompression routines -// for the OSTC experimental project -// written by Christian Weikamp -// last revision __________ -// comments added _________ -// -// additional files: -// p2_tables_v100.romdata (other files) -// 18f4685_ostc_v100.lkr (linker script) -// -// history: -// 01/03/08 v100: first release candidate -// 03/13/08 v101: start of programming ppO2 code -// 03/13/25 v101a: backup of interrim version with ppO2 calculation -// 03/13/25 v101: open circuit gas change during deco -// 03/13/25 v101: CNS_fraction calculation -// 03/13/26 v101: optimization of tissue calc routines -// 07/xx/08 v102a: debug of bottom time routine -// 09/xx/08 v102d: Gradient Factor Model implemenation -// 10/10/08 v104: renamed to build v103 for v118 stable -// 10/14/08 v104: integration of temp_depth_last_deco for Gradient Model -// 03/31/090 v107: integration of FONT Incon24 - -// -// literature: -// B"uhlmann, Albert: Tauchmedizin; 4. Auflage; -// Schr"oder, Kai & Reith, Steffen; 2000; S"attigungsvorg"ange beim Tauchen, das Modell ZH-L16, Funktionsweise von Tauchcomputern; http://www.achim-und-kai.de/kai/tausim/saett_faq -// Morrison, Stuart; 2000; DIY DECOMPRESSION; http://www.lizardland.co.uk/DIYDeco.html -// Balthasar, Steffen; Dekompressionstheorie I: Neo Haldane Modelle; http://www.txfreak.de/dekompressionstheorie_1.pdf -// Baker, Erik C.; Clearing Up The Confusion About "Deep Stops" -// Baker, Erik C.; Understanding M-values; http://www.txfreak.de/understanding_m-values.pdf - - -// ********************* -// ** I N C L U D E S ** -// ********************* - #include <p18f4685.h> - #include <math.h> - -// ******************************** -// ** C O N F I G U R A T I O N ** -// ** for simulation without asm ** -// ******************************** - #pragma config OSC = IRCIO67 - #pragma config FCMEN = OFF - #pragma config IESO = OFF - #pragma config PWRT = ON - #pragma config BOREN = OFF - #pragma config WDT = OFF - #pragma config WDTPS = 128 - #pragma config MCLRE = ON - #pragma config LPT1OSC = OFF - #pragma config PBADEN = OFF - #pragma config DEBUG = OFF - #pragma config XINST = OFF - #pragma config LVP = OFF - #pragma config STVREN = OFF - -// **************************** -// ** D E F I N E S ** -// ** missing in p18f4685.h ** -// **************************** -#define INT0IF 1 -#define INT1IF 0 -#define TMR1IF 0 - - -# define DBG_c_gas 0b0000000000000001 -# define DBG_c_ppO2 0b0000000000000010 -# define DBG_RUN 0b0000000000000100 -# define DBG_RESTART 0b0000000000001000 - -# define DBG_CdeSAT 0b0000000000010000 -# define DBG_C_MODE 0b0000000000100000 -# define DBG_C_SURF 0b0000000001000000 -# define DBG_HEwoHE 0b0000000010000000 - -# define DBG_C_DPPO2 0b0000000100000000 -# define DBG_C_DGAS 0b0000001000000000 -# define DBG_C_DIST 0b0000010000000000 -# define DBG_C_LAST 0b0000100000000000 - -# define DBG_C_GF 0b0001000000000000 -# define DBG_ZH16ERR 0b0010000000000000 -# define DBG_PHIGH 0b0100000000000000 -# define DBG_PLOW 0b1000000000000000 - - -# define DBS_mode 0b0000000000000001 -# define DBS_ppO2 0b0000000000000010 -# define DBS_HE_sat 0b0000000000000100 -# define DBS_ppO2chg 0b0000000000001000 - -# define DBS_SAT2l 0b0000000000010000 -# define DBS_SAT2h 0b0000000000100000 -# define DBS_GFLOW2l 0b0000000001000000 -# define DBS_GFLOW2h 0b0000000010000000 - -# define DBS_GFHGH2l 0b0000000100000000 -# define DBS_GFHGH2h 0b0000001000000000 -# define DBS_GASO22l 0b0000010000000000 -# define DBS_GASO22h 0b0000100000000000 - -# define DBS_DIST2h 0b0001000000000000 -# define DBS_LAST2h 0b0010000000000000 -# define DBS_DECOO2l 0b0100000000000000 -# define DBS_DECOO2h 0b1000000000000000 - - -# define DBS2_PRES2h 0b0000000000000001 -# define DBS2_PRES2l 0b0000000000000010 -# define DBS2_SURF2l 0b0000000000000100 -# define DBS2_SURF2h 0b0000000000001000 - -# define DBS2_DESAT2l 0b0000000000010000 -# define DBS2_DESAT2h 0b0000000000100000 -# define DBS2_GFDneg 0b0000000001000000 -# define DBS2_ 0b000000000000000 - -# define DBS2_ 0b000000000000000 -# define DBS2_ 0b000000000000000 -# define DBS2_ 0b000000000000000 -# define DBS2_ 0b000000000000000 - -// NDL_at_20mtr - - - -// *********************** -// ** V A R I A B L E S ** -// *********************** -// prefixes etc: -// _O_ = output for use in the assembler code -// _I_ = input from the assembler code for the c code -// char_ and int_ = used to identify output and input size -// var = variable (from b"uhlmann) -// pres = pressure -// gtissue = guiding tissue, the one limiting the ascent -// e2secs = exp of the b"uhlmann formula precalculated for a 2 second step -// e1min = same for 1 minute step -// sim = used in simulating the ascent to the surface -// nullzeit = remaining ground/bottom time for "no deco" -// hauptroutine = main - -#define WP_FONT_SMALL_HEIGHT 24 -#define WP_FONT_MEDIUM_HEIGHT 32 -#define WP_FONT_LARGE_HEIGHT 58 - -#define oled_rw PORTA,2,0 -#define oled_rs PORTE,0,0 - -#define U8 unsigned char -#define U16 unsigned int - -// IO assembler -#pragma udata bank0a=0x060 -volatile unsigned char wp_stringstore[26]; -volatile U8 wp_color1; -volatile U8 wp_color2; -volatile U8 wp_top; -volatile U8 wp_leftx2; -volatile U8 wp_font; -volatile U8 wp_invert; -volatile U8 wp_temp_U8; -// internal C -#pragma udata bank0b=0x081 -volatile U8 wp_txtptr; -volatile unsigned char wp_char; -volatile U8 wp_command; -volatile U16 wp_data_16bit; -volatile U8 wp_data_8bit_one; -volatile U8 wp_data_8bit_two; -volatile U16 wp_start; -volatile U16 wp_end; -volatile U16 wp_i; -volatile U8 wp_black; -// some spare -volatile U8 wp_debug_U8; - -// asm only -#pragma udata bank0c=0x0D0 -#define LENGTH_kf_bank0 48 -volatile unsigned char keep_free_bank0[LENGTH_kf_bank0]; - - -#pragma udata bank1=0x100 -#define LENGTH_kf_bank1 256 -volatile unsigned char keep_free_bank1[LENGTH_kf_bank1]; // used by the assembler code - - #pragma udata bank2a=0x200 -// output: - static unsigned int int_O_tissue_for_debug[32]; - static unsigned int int_O_GF_spare____; // 0x240 - static unsigned int int_O_GF_step; // 0x242 - static unsigned int int_O_gtissue_limit; // 0x244 - static unsigned int int_O_gtissue_press; // 0x246 - static unsigned int int_O_limit_GF_low; // 0x248 - static unsigned int int_O_gtissue_press_at_GF_low; // 0x24A -// 0x24C + 0x24D noch unbenutzt - - #pragma udata bank2b=0x24E - static unsigned char char_O_GF_low_pointer; // 0x24E - static unsigned char char_O_actual_pointer; // 0x24F - #pragma udata bank2c=0x250 - static unsigned char char_O_deco_table[32]; // 0x250 - #pragma udata bank2d=0x270 - static unsigned char char_I_table_deco_done[32]; - #pragma udata bank2e=0x290 - static unsigned int int_O_calc_tissue_call_counter; // 0x290 -// internal: - unsigned char lock_GF_depth_list; - static float temp_limit; - static float GF_low; - static float GF_high; - static float GF_delta; - static float GF_temp; - static float GF_step; - static float GF_step2; - static float temp_pres_gtissue; - static float temp_pres_gtissue_diff; - static float temp_pres_gtissue_limit_GF_low; - static float temp_pres_gtissue_limit_GF_low_below_surface; - static unsigned int temp_depth_limit; - static unsigned char temp_decotime; - static unsigned char temp_gtissue_no; - static unsigned int temp_depth_last_deco; // new in v.101 - - static unsigned char temp_depth_GF_low_meter; - static unsigned char temp_depth_GF_low_number; - static unsigned char internal_deco_pointer; - static unsigned char internal_deco_table[32]; - static float temp_pres_deco_GF_low; - -static unsigned int debug_temp; - - -#pragma udata bank3a=0x300 -static char output[32]; -// used by the math routines -#pragma udata bank3b=0x380 -volatile float pres_tissue_vault[32]; - #pragma udata bank4a=0x400 -// internal: - unsigned char ci ; // don't move - used in _asm routines - if moved then modify movlb commands - unsigned char x; - unsigned int main_i; - unsigned int int_temp; - unsigned int int_temp_decostatus; - static float pres_respiration; - static float pres_surface; - static float temp1; - static float temp2; - static float temp3; - static float temp4; - static float temp_deco; - static float temp_atem; - static float temp2_atem; - static float temp_tissue; - static float temp_surface; - static float N2_ratio; - static float He_ratio; - static float temp_ratio; - static float var_a; - static float var2_a; - static float var_b; - static float var2_b; - static float var_t05nc; - static float var2_t05nc; - static float var_e2secs; - static float var2_e2secs; - static float var_e1min; - static float var2_e1min; - static float var_halftimes; - static float var2_halftimes; - static float pres_gtissue_limit; - static float temp_pres_gtissue_limit; - static float actual_ppO2; // new in v.102 - #pragma udata bank4b=0x480 - static float pres_tissue[32]; - - #pragma udata bank5=0x500 -// don't move positions in this bank, the registers are addressed directly from assembler code -// input: - static unsigned int int_I_pres_respiration; // 0x500 - static unsigned int int_I_pres_surface; // 0x502 - static unsigned int int_I_temp; // 0x504 new in v101 - static unsigned char char_I_temp; // 0x506 new in v101 - static unsigned char char_I_actual_ppO2; // 0x507 - static unsigned int int_I_spare_3; - static unsigned int int_I_spare_4; - static unsigned int int_I_spare_5; - static unsigned int int_I_spare_6; - static unsigned char char_I_N2_ratio; // 0x510 - static unsigned char char_I_He_ratio; // 0x511 - static unsigned char char_I_saturation_multiplier; // for conservatism/safety values 1.0 (no conservatism) to 1.5 (50% faster saturation - static unsigned char char_I_desaturation_multiplier; // for conservatism/safety values 0.66 (50% slower desaturation) to 1.0 (no conservatism)// consveratism used in calc_tissue(), calc_tissue_step_1_min() and sim_tissue_1min() - static unsigned char char_I_GF_High_percentage; // 0x514 new in v.102 - static unsigned char char_I_GF_Low_percentage; // 0x515 new in v.102 - static unsigned char char_I_spare; // 0x516 - static unsigned char char_I_deco_distance; // 0x517 - static unsigned char char_I_const_ppO2; // 0x518 new in v.101 - static unsigned char char_I_deco_ppO2_change; // 0x519 new in v.101 - static unsigned char char_I_deco_ppO2; // 0x51A new in v.101 - static unsigned char char_I_deco_gas_change; // 0x51B new in v.101 - static unsigned char char_I_deco_N2_ratio; // 0x51C new in v.101 - static unsigned char char_I_deco_He_ratio; // 0x51D new in v.101 - static unsigned char char_I_depth_last_deco; // 0x51E new in v.101 unit: [m] - static unsigned char char_I_deco_model; // 0x51F new in v.102 ( 1 = MultiGraF, sonst Std. mit (de-)saturation_multiplier) -// output: - static unsigned int int_O_desaturation_time; // 0x520 - static unsigned char char_O_nullzeit; // 0x522 - static unsigned char char_O_deco_status; // 0x523 - static unsigned char char_O_array_decotime[7]; // 0x524 - static unsigned char char_O_array_decodepth[6]; // 0x52B - static unsigned char char_O_ascenttime; // 0x531 - static unsigned char char_O_gradient_factor; // 0x532 - static unsigned char char_O_tissue_saturation[32]; // 0x533 - static unsigned char char_O_array_gradient_weighted[16]; // 0x553 - static unsigned char char_O_gtissue_no; // 0x563 - static unsigned char char_O_diluent; // 0x564 new in v.101 - static unsigned char char_O_CNS_fraction; // 0x565 new in v.101 - static unsigned char char_O_relative_gradient_GF; // 0x566 new in v.102 - -// internal: - static float pres_tissue_limit[16]; - static float sim_pres_tissue_limit[16]; - static float pres_diluent; // new in v.101 - static float deco_diluent; // new in v.101 - static float const_ppO2; // new in v.101 - static float deco_ppO2_change; // new in v.101 - static float deco_ppO2; // new in v.101 - - - - #pragma udata bank6=0x600 -// internal: - static float sim_pres_tissue[32]; - static float sim_pres_tissue_backup[32]; - - //#pragma udata bank7=0x700 - //const unsigned char keep_free_bank7[256]; // used by the assembler code (DD font2display) - - #pragma udata bank8=0x800 - static char md_pi_subst[256]; - - #pragma udata bank9a=0x900 -// output: - static char md_state[48]; // DONT MOVE !! // has to be at the beginning of bank 9 for the asm code!!! - #pragma udata bank9b=0x930 -// output: - static unsigned int int_O_DBS_bitfield; // 0x930 new in v.108 - static unsigned int int_O_DBS2_bitfield; // 0x932 new in v.108 - static unsigned int int_O_DBG_pre_bitfield; // 0x934 new in v.108 - static unsigned int int_O_DBG_post_bitfield; // 0x936 new in v.108 - static char char_O_NDL_at_20mtr; // 0x938 new in v.108 // 0xFF == undefined, max. 254 -// internal: - static char md_t; - static char md_buffer[16]; - static char md_cksum[16]; - static char md_i; - static char md_j; - static char md_temp; - static unsigned int md_pointer; - static float deco_N2_ratio; // new in v.101 - static float deco_He_ratio; // new in v.101 - static float calc_N2_ratio; // new in v.101 - static float calc_He_ratio; // new in v.101 - static float deco_gas_change; // new in v.101 - static float CNS_fraction; // new in v.101 - static float float_saturation_multiplier; // new in v.101 - static float float_desaturation_multiplier; // new in v.101 - static float float_deco_distance; // new in v.101 -// internal, dbg: - static unsigned char DBG_char_I_deco_model; // new in v.108 - static unsigned char DBG_char_I_depth_last_deco; // new in v.108 - static float DBG_pres_surface; // new in v.108 - static float DBG_GF_low; // new in v.108 - static float DBG_GF_high; // new in v.108 - static float DBG_const_ppO2; // new in v.108 - static float DBG_deco_ppO2_change; // new in v.108 - static float DBG_deco_ppO2; // new in v.108 - static float DBG_deco_N2_ratio; // new in v.108 - static float DBG_deco_He_ratio; // new in v.108 - static float DBG_deco_gas_change; // new in v.108 - static float DBG_float_saturation_multiplier; // new in v.108 - static float DBG_float_desaturation_multiplier; // new in v.108 - static float DBG_float_deco_distance; // new in v.108 - static float DBG_deco_N2_ratio; // new in v.108 - static float DBG_deco_He_ratio; // new in v.108 - static float DBG_N2_ratio; // new in v.108 - static float DBG_He_ratio; // new in v.108 - static char flag_in_divemode; // new in v.108 - static int int_dbg_i; // new in v.108 - unsigned int temp_DBS; - -// ************************* -// ** P R O T O T Y P E S ** -// ************************* -void main_calc_hauptroutine(void); -void main_calc_without_deco(void); -void main_clear_tissue(void); -void main_calc_percentage(void); -void main_calc_wo_deco_step_1_min(void); -void main_debug(void); -void main_gradient_array(void); -void main_hash(void); - -void calc_hauptroutine(void); -void calc_tissue(void); -void calc_nullzeit(void); -void backup_sim_pres_tissue(void); -void restore_sim_pres_tissue(void); - -void calc_without_deco(void); -void clear_tissue(void); -void calc_ascenttime(void); -void update_startvalues(void); -void clear_decoarray(void); -void update_decoarray(void); -void sim_tissue_1min(void); -void sim_tissue_10min(void); -void calc_gradient_factor(void); -void calc_gradient_array_only(void); -void calc_desaturation_time(void); -void calc_wo_deco_step_1_min(void); -void calc_tissue_step_1_min(void); -void hash(void); -void clear_CNS_fraction(void); -void calc_CNS_fraction(void); -void calc_CNS_decrease_15min(void); -void calc_percentage(void); -void main(void); -void calc_hauptroutine_data_input(void); -void calc_hauptroutine_update_tissues(void); -void calc_hauptroutine_calc_deco(void); -void calc_hauptroutine_calc_ascend_to_deco(void); -void calc_nextdecodepth_GF(void); -void copy_deco_table_GF(void); -void clear_internal_deco_table_GF(void); -void update_internal_deco_table_GF(void); -void DD2_write(void); -void DD2_write_incon42(void); -void DD2_get_pointer_to_char(void); -void DD2_set_column(void); -void DD2_load_background(void); -void DD2_build_one_line_of_char(void); -void DD2_print_column(void); -void DD2_CmdWrite(void); -void DD2_DataWrite(void); -void push_tissues_to_vault(void); -void pull_tissues_from_vault(void); -void main_push_tissues_to_vault(void); -void main_pull_tissues_from_vault(void); -void wordprocessor(void); - -// ******************************* -// ** start ** -// ** necessary for compilation ** -// ******************************* -#pragma romdata der_code = 0x0000 -#pragma code der_start = 0x0000 -void der_start(void) -{ -_asm - goto main -_endasm -} - -// *********************************** -// ** main code for simulation / ** -// ** tests without assembler code ** -// ** is NOT a part of the OSTC ** -// *********************************** -#pragma code main = 0x9000 -void main(void) -{ - for(wp_temp_U8=0;wp_temp_U8<LENGTH_kf_bank0 - 1;wp_temp_U8++) - keep_free_bank0[wp_temp_U8] = 7; - keep_free_bank0[LENGTH_kf_bank0 - 1] = 7; - - for(wp_temp_U8=0;wp_temp_U8<LENGTH_kf_bank1 - 1;wp_temp_U8++) - keep_free_bank1[wp_temp_U8] = 7; - keep_free_bank1[LENGTH_kf_bank1 - 1] = 7; - -#if 1 -// new main to test DR-5 - -wp_top = 10; -wp_leftx2 = 10; -wp_color1 = 255; -wp_color2 = 255; -wp_font = 0; -wp_invert = 0; -wp_stringstore[0] = ' '; -wp_stringstore[1] = '!'; -wp_stringstore[2] = '"'; -wp_stringstore[3] = ':'; -wp_stringstore[4] = 0; -wordprocessor(); - -GF_low = 1.0; -GF_high = 1.0; - -GF_temp = GF_low * GF_high; - -clear_CNS_fraction(); -//char_I_const_ppO2 = 100; -//for (main_i=0;main_i<255;main_i++) -//{ -//calc_CNS_fraction(); -//} //for - - - - -int_I_pres_respiration = 1000;//980; -int_I_pres_surface = 1000;//980; -char_I_N2_ratio = 39; //38; -char_I_He_ratio = 40; //50; -char_I_deco_distance = 0; // 10 = 1 meter -char_I_depth_last_deco = 3; // values below 3 (meter) are ignored - -char_I_const_ppO2 = 0; -char_I_deco_ppO2_change = 0; // [dm] 10 = 1 meter -char_I_deco_ppO2 = 0; - -char_I_deco_gas_change = 0; // [m] 1 = 1 meter -char_I_deco_N2_ratio = 0; -char_I_deco_He_ratio = 0; - -//char_I_actual_ppO2; // 0x507 -char_I_GF_High_percentage = 100; // 0x514 new in v.102 -char_I_GF_Low_percentage = 100; // 0x515 new in v.102 - -char_I_saturation_multiplier = 110; -char_I_desaturation_multiplier = 90; - -char_I_deco_model = 0; - -main_clear_tissue(); - -int_I_pres_respiration = 1000 + int_I_pres_surface; -main_calc_wo_deco_step_1_min(); -int_I_pres_respiration = 3000 + int_I_pres_surface; -main_calc_wo_deco_step_1_min(); -int_I_pres_respiration = 5000 + int_I_pres_surface; -main_calc_wo_deco_step_1_min(); - -/* -int_I_pres_respiration = 6000 + int_I_pres_surface; -for (main_i=0;main_i<27;main_i++) - main_calc_wo_deco_step_1_min(); -*/ - -char_O_deco_status = 255; -while (char_O_deco_status) - main_calc_hauptroutine(); -_asm -nop -_endasm - -for (main_i=0;main_i<50;main_i++) -{ -main_calc_hauptroutine(); -} -int_I_pres_respiration = 10000; -for (main_i=0;main_i<1500;main_i++) -{ -main_calc_hauptroutine(); -} - -_asm -nop -_endasm - - -int_I_pres_respiration = 3000; -for (main_i=0;main_i<150;main_i++) -{ - calc_hauptroutine_data_input(); - calc_hauptroutine_update_tissues(); -} //for - - update_startvalues(); - clear_decoarray(); - clear_internal_deco_table_GF(); - calc_hauptroutine_calc_ascend_to_deco(); - if (char_O_deco_status > 15) // can't go up to first deco, too deep to calculate in the given time slot - { - char_O_deco_status = 2; -// char_O_lock_depth_list = 255; - } - else - { -// char_O_lock_depth_list = lock_GF_depth_list; - calc_hauptroutine_calc_deco(); - } -// build_debug_output(); - -_asm -nop -_endasm -while (char_O_deco_status == 1) -{ - char_O_deco_status = 0; -// char_O_lock_depth_list = 255; - calc_hauptroutine_calc_deco(); -// build_debug_output(); -_asm -nop -_endasm -}; -debug_temp = 60; // [mtr Aufstieg in 10 mtr/min (30steps'2sec/min] -int_I_pres_respiration = 9980; -for (main_i=0;main_i<debug_temp;main_i++) -{ -int_I_pres_respiration = int_I_pres_respiration - 33; - calc_hauptroutine_data_input(); - calc_hauptroutine_update_tissues(); -int_I_pres_respiration = int_I_pres_respiration - 33; - calc_hauptroutine_data_input(); - calc_hauptroutine_update_tissues(); -int_I_pres_respiration = int_I_pres_respiration - 34; - calc_hauptroutine_data_input(); - calc_hauptroutine_update_tissues(); -} //for -_asm -nop -_endasm - - update_startvalues(); - clear_decoarray(); - clear_internal_deco_table_GF(); - calc_hauptroutine_calc_ascend_to_deco(); - if (char_O_deco_status > 15) // can't go up to first deco, too deep to calculate in the given time slot - { - char_O_deco_status = 2; -// char_O_lock_depth_list = 255; - } - else - { -// char_O_lock_depth_list = lock_GF_depth_list; - calc_hauptroutine_calc_deco(); - } -// build_debug_output(); - -_asm -nop -_endasm -while (char_O_deco_status == 1) -{ - char_O_deco_status = 0; -// char_O_lock_depth_list = 255; - calc_hauptroutine_calc_deco(); -// build_debug_output(); -_asm -nop -_endasm -}; -_asm -nop -_endasm -debug_temp = 60; // [mtr Aufstieg in 10 mtr/min (30steps'2sec/min] -int_I_pres_respiration = 9980; -debug_temp = debug_temp * 3; -for (main_i=0;main_i<debug_temp;main_i++) -{ - calc_hauptroutine_data_input(); - calc_hauptroutine_update_tissues(); -} //for -_asm -nop -_endasm -#endif -// ----------------------- - -} // main - -// ****************************************************** -// ****************************************************** -// ** THE FOLLOWING CODE HAS TO BE COPPIED TO THE OSTC ** -// ****************************************************** -// ****************************************************** - -// *************** -// *************** -// ** THE FONTS ** -// *************** -// *************** -// all new for bigscreen - -#pragma romdata font_data_large = 0x09A00 -rom const rom U16 wp_large_data[] = -{ -#include "ostc90.drx.txt" -}; - -#pragma romdata font_table_medium = 0x0A000 -rom const rom U16 wp_medium_table[] = -{ -#include "ostc48.tbl.txt" // length 0x22 -}; - -#pragma romdata font_data_medium = 0x0A024 -rom const rom U16 wp_medium_data[] = -{ -#include "ostc48.drx.txt" // length 0x390 -}; - -#pragma romdata font_table_small = 0x0A39A -rom const rom U16 wp_small_table[] = -{ -#include "ostc28.tbl.txt" -}; - -#pragma romdata font_data_small = 0x0A484 -rom const rom U16 wp_small_data[] = -{ -#include "ostc28.drx.txt" -}; - -#pragma romdata font_table_large = 0x0BEE0 -rom const rom U16 wp_large_table[] = -{ -0x0000 -//#include "ostc90.tbl.txt" -}; - -// *********************** -// *********************** -// ** THE SUBROUTINES 2 ** -// *********************** -// *********************** -// all new in v.102 -// moved from 0x0D000 to 0x0C000 in v.108 - -#pragma code subroutines2 = 0x0C000 // can be adapted to fit the romdata tables ahead - -// ------------------------------- -// DBS - debug on start of dive // -// ------------------------------- -void create_dbs_set_dbg_and_ndl20mtr(void) -{ - int_O_DBS_bitfield = 0; - int_O_DBS2_bitfield = 0; - if(int_O_DBG_pre_bitfield & DBG_RUN) - int_O_DBG_pre_bitfield = DBG_RESTART; - else - int_O_DBG_pre_bitfield = DBG_RUN; - int_O_DBG_post_bitfield = 0; - char_O_NDL_at_20mtr = 255; - - DBG_N2_ratio = N2_ratio; - DBG_He_ratio = He_ratio; - DBG_char_I_deco_model = char_I_deco_model; - DBG_char_I_depth_last_deco = char_I_depth_last_deco; - DBG_pres_surface = pres_surface; - DBG_GF_low = GF_low; - DBG_GF_high = GF_high; - DBG_const_ppO2 = const_ppO2; - DBG_deco_ppO2_change = deco_ppO2_change; - DBG_deco_ppO2 = deco_ppO2; - DBG_deco_N2_ratio = deco_N2_ratio; - DBG_deco_He_ratio = deco_He_ratio; - DBG_deco_gas_change = deco_gas_change; - DBG_float_saturation_multiplier = float_saturation_multiplier; - DBG_float_desaturation_multiplier = float_desaturation_multiplier; - DBG_float_deco_distance = float_deco_distance; - - if(char_I_deco_model) - int_O_DBS_bitfield |= DBS_mode; - if(const_ppO2) - int_O_DBS_bitfield |= DBS_ppO2; - for(int_dbg_i = 16; int_dbg_i < 32; int_dbg_i++) - if(pres_tissue[int_dbg_i]) - int_O_DBS_bitfield |= DBS_HE_sat; - if(deco_ppO2_change) - int_O_DBS_bitfield |= DBS_ppO2chg; - if(float_saturation_multiplier < 0.99) - int_O_DBS_bitfield |= DBS_SAT2l; - if(float_saturation_multiplier > 1.3) - int_O_DBS_bitfield |= DBS_SAT2h; - if(GF_low < 0.19) - int_O_DBS_bitfield |= DBS_GFLOW2l; - if(GF_low > 1.01) - int_O_DBS_bitfield |= DBS_GFLOW2h; - if(GF_high < 0.6) - int_O_DBS_bitfield |= DBS_GFHGH2l; - if(GF_high > 1.01) - int_O_DBS_bitfield |= DBS_GFHGH2h; - if((N2_ratio + He_ratio) > 0.95) - int_O_DBS_bitfield |= DBS_GASO22l; - if((N2_ratio + He_ratio) < 0.05) - int_O_DBS_bitfield |= DBS_GASO22h; - if(float_deco_distance > 0.25) - int_O_DBS_bitfield |= DBS_DIST2h; - if(char_I_depth_last_deco > 8) - int_O_DBS_bitfield |= DBS_LAST2h; - if(DBG_deco_gas_change && ((deco_N2_ratio + deco_He_ratio) > 0.95)) - int_O_DBS_bitfield |= DBS_DECOO2l; - if(DBG_deco_gas_change && ((deco_N2_ratio + deco_He_ratio) < 0.05)) - int_O_DBS_bitfield |= DBS_DECOO2h; - if(pres_respiration > 3.0) - int_O_DBS2_bitfield |= DBS2_PRES2h; - if(pres_surface - pres_respiration > 0.2) - int_O_DBS2_bitfield |= DBS2_PRES2l; - if(pres_surface < 0.75) - int_O_DBS2_bitfield |= DBS2_SURF2l; - if(pres_surface > 1.11) - int_O_DBS2_bitfield |= DBS2_SURF2h; - if(float_desaturation_multiplier < 0.70) - int_O_DBS2_bitfield |= DBS2_DESAT2l; - if(float_desaturation_multiplier > 1.01) - int_O_DBS2_bitfield |= DBS2_DESAT2h; - if(GF_low > GF_high) - int_O_DBS2_bitfield |= DBS2_GFDneg; -} - -// ------------------------------- -// DBG - set DBG to end_of_dive // -// ------------------------------- -void set_dbg_end_of_dive(void) -{ - int_O_DBG_pre_bitfield &= (~DBG_RUN); - int_O_DBG_post_bitfield &= (~DBG_RUN); -} - -// ------------------------------- -// DBG - NDL at first 20 m. hit // -// ------------------------------- -void check_ndl(void) -{ - if((char_O_NDL_at_20mtr == -1) && (int_I_pres_respiration > 3000)) - { - char_O_NDL_at_20mtr = char_O_nullzeit; - if(char_O_NDL_at_20mtr == 255) - char_O_NDL_at_20mtr == 254; - } -} - -// ------------------------------- -// DBG - multi main during dive // -// ------------------------------- -void check_dbg(char is_post_check) -{ - temp_DBS = 0; - if( (DBG_N2_ratio != N2_ratio) || (DBG_He_ratio != He_ratio) ) - temp_DBS |= DBG_c_gas; - if(DBG_const_ppO2 != const_ppO2) - temp_DBS |= DBG_c_ppO2; - if((DBG_float_saturation_multiplier != float_saturation_multiplier) || (DBG_float_desaturation_multiplier != float_desaturation_multiplier)) - temp_DBS |= DBG_CdeSAT; - if(DBG_char_I_deco_model != char_I_deco_model) - temp_DBS |= DBG_C_MODE; - if(DBG_pres_surface != pres_surface) - temp_DBS |= DBG_C_SURF; - if((!DBS_HE_sat) && (!He_ratio)) - for(int_dbg_i = 16; int_dbg_i < 32; int_dbg_i++) - if(pres_tissue[int_dbg_i]) - temp_DBS |= DBG_HEwoHE; - if(DBG_deco_ppO2 != deco_ppO2) - temp_DBS |= DBG_C_DPPO2; - if((DBG_deco_gas_change != deco_gas_change) || (DBG_deco_N2_ratio != deco_N2_ratio) || (DBG_deco_He_ratio != deco_He_ratio)) - temp_DBS |= DBG_C_DGAS; - if(DBG_float_deco_distance != float_deco_distance) - temp_DBS |= DBG_C_DIST; - if(DBG_char_I_depth_last_deco != char_I_depth_last_deco) - temp_DBS |= DBG_C_LAST; - if((DBG_GF_low != GF_low) || (DBG_GF_high != GF_high)) - temp_DBS |= DBG_C_GF; - if(pres_respiration > 13.0) - temp_DBS |= DBG_PHIGH; - if(pres_surface - pres_respiration > 0.2) - temp_DBS |= DBG_PLOW; -/* - if() - temp_DBS |= ; - if() - temp_DBS |= ; - */ - if(is_post_check) - int_O_DBG_post_bitfield |= temp_DBS; - else - int_O_DBG_pre_bitfield |= temp_DBS; -} - -// ------------------------------- -// DBG - prior to calc. of dive // -// ------------------------------- -void check_pre_dbg(void) -{ - check_dbg(0); -} - -// ------------------------------- -// DBG - after decocalc of dive // -// ------------------------------- -void check_post_dbg(void) -{ - check_dbg(1); -} - - - -// ------------------------- -// calc_next_decodepth_GF // -// ------------------------- -// new in v.102 -void calc_nextdecodepth_GF(void) -{ -// INPUT, changing during dive: -// temp_pres_gtissue_limit_GF_low -// temp_pres_gtissue_limit_GF_low_below_surface -// temp_pres_gtissue -// temp_pres_gtissue_diff -// lock_GF_depth_list - -// INPUT, fixed during dive: -// pres_surface -// GF_delta -// GF_high -// GF_low -// temp_depth_last_deco -// float_deco_distance - -// OUTPUT -// GF_step -// temp_deco -// temp_depth_limt -// lock_GF_depth_list - -// USES -// temp1 -// temp2 -// int_temp - - char_I_table_deco_done[0] = 0; // safety if changed somewhere else. Needed for exit - if (char_I_deco_model == 1) - { - if (lock_GF_depth_list == 0) - { - temp2 = temp_pres_gtissue_limit_GF_low_below_surface / 0.29985; // = ... / 99.95 / 0.003; - int_temp = (int) (temp2 + 0.99); - if (int_temp > 31) - int_temp = 31; // deepest deco at 93 meter (31 deco stops) - if (int_temp < 0) - int_temp = 0; - temp_depth_GF_low_number = int_temp; - temp_depth_GF_low_meter = 3 * temp_depth_GF_low_number; - temp2 = (float)temp_depth_GF_low_meter * 0.09995; - temp_pres_deco_GF_low = temp2 + float_deco_distance + pres_surface; - if (temp_depth_GF_low_number == 0) - GF_step = 0; - else - GF_step = GF_delta / (float)temp_depth_GF_low_number; - if (GF_step < 0) - GF_step = 0; - if (GF_step > GF_delta) - GF_step = GF_delta; - int_O_GF_step = (int)(GF_step * 10000); - int_O_limit_GF_low = (int)(temp_pres_deco_GF_low * 1000); - int_O_gtissue_press_at_GF_low = (int)(temp_pres_gtissue * 1000); - char_O_GF_low_pointer = temp_depth_GF_low_number; - lock_GF_depth_list = 1; - internal_deco_pointer = 0; - } - if (internal_deco_pointer == 0) // new run - { - internal_deco_pointer = temp_depth_GF_low_number; - GF_temp = GF_high - ((float)internal_deco_pointer * GF_step); - int_temp = char_I_table_deco_done[internal_deco_pointer]; - output[8] = int_temp; - output[9] = 33; - } - else - { - int_temp = 1; - } - while (int_temp == 1) - { - int_temp = internal_deco_pointer - 1; - if (int_temp == 1) // new in v104 - { - temp2 = (float)(temp_depth_last_deco * int_temp) * 0.09995; - GF_step2 = GF_step/3.0 * ((float)(6 - temp_depth_last_deco)); - } - else - if (int_temp == 0) - { - temp2 = 0.0; - GF_step2 = GF_high - GF_temp; - } - else - { - temp2 = (float)(3 *int_temp) * 0.09995; - GF_step2 = GF_step; - } - temp2 = temp2 + pres_surface; // next deco stop to be tested - temp1 = ((GF_temp + GF_step2)* temp_pres_gtissue_diff) + temp_pres_gtissue; // upper limit (lowest pressure allowed) // changes GF_step2 in v104 - if (temp1 > temp2) // check if ascent to next deco stop is ok - { - int_temp = 0; // no - } - else - { - internal_deco_pointer = int_temp; - GF_temp = GF_temp + GF_step2; // changed in v104 - int_temp = char_I_table_deco_done[internal_deco_pointer]; // yes and check for ascent to even next stop if deco_done is set - } - } // while - if (internal_deco_pointer > 0) - { - temp2 = (float)(0.29985 * internal_deco_pointer); - temp_deco = temp2 + float_deco_distance + pres_surface; - if (internal_deco_pointer == 1) // new in v104 - temp_depth_limit = temp_depth_last_deco; - else - temp_depth_limit = 3 * internal_deco_pointer; - if (output[9] == 33) - { - output[9] = internal_deco_pointer; - output[10] = char_I_table_deco_done[internal_deco_pointer]; - output[12] = output[12] + 1; - if (output[12] == 100) - output[12] = 0; - } - } - else // if (char_I_deco_model == 1) - { - temp_deco = pres_surface; - temp_depth_limit = 0; - } - } - else - { - // calc_nextdecodepth - original - // optimized in v.101 - // depth_last_deco included in v.101 - - temp1 = temp_pres_gtissue_limit - pres_surface; - if (temp1 >= 0) - { - temp1 = temp1 / 0.29985; // = temp1 / 99.95 / 0.003; - temp_depth_limit = (int) (temp1 + 0.99); - temp_depth_limit = 3 * temp_depth_limit; // depth for deco [m] - if (temp_depth_limit == 0) - temp_deco = pres_surface; - else - { - if (temp_depth_limit < temp_depth_last_deco) - temp_depth_limit = temp_depth_last_deco; - temp1 = (float)temp_depth_limit * 0.09995; - temp_deco = temp1 + float_deco_distance + pres_surface; // depth for deco [bar] - } // if (temp_depth_limit == 0) - } // if (temp1 >= 0) - else - { - temp_deco = pres_surface; - temp_depth_limit = 0; - } // if (temp1 >= 0) - } // calc_nextdecodepth original -} // calc_nextdecodepth_GF - - -#if 0 -void build_debug_output(void) -{ -output[0] = 0; // not used in asm PLED output -output[1] = (int) (GF_low * 100); -output[2] = (int) (GF_high * 100); -output[3] = (int) (GF_step * 100); -output[4] = (int) temp_depth_GF_low_number; -output[5] = (int) temp_depth_GF_low_meter; -//output[6] -output[7] = (int) internal_deco_pointer; -//output[8] = char_I_table_deco_done[temp_depth_GF_low_number] -//output[9] = internal_deco_pointer @ new run -//output[10] = char_I_table_deco_done[internal_deco_pointer] @ new run -output [11] = (int) (temp_pres_deco_GF_low * 10); -} // build_debug_output -#endif - -// --------------------- -// copy_deco_table_GF // -// --------------------- -// new in v.102 -void copy_deco_table_GF(void) -{ - if (char_I_deco_model == 1) - { - int_temp = 32; - for (ci=0;ci<int_temp;ci++) - char_O_deco_table[ci] = internal_deco_table[ci]; - } -} // copy_deco_table_GF - - -// ------------------------------ -// clear_internal_deco_table_GF// -// ------------------------------ -// new in v.102 -void clear_internal_deco_table_GF(void) -{ - if (char_I_deco_model == 1) - { - for (ci=0;ci<32;ci++) // cycle through the 16 b"uhlmann tissues for Helium - { - internal_deco_table[ci] = 0; - } - } -} // clear_internal_deco_table_GF - - -// -------------------------------- -// update_internal_deco_table_GF // -// -------------------------------- -// new in v.102 -void update_internal_deco_table_GF(void) -{ - if ((char_I_deco_model == 1) && (internal_deco_table[internal_deco_pointer] < 255)) - internal_deco_table[internal_deco_pointer] = internal_deco_table[internal_deco_pointer] + 1; -} // update_internal_deco_table_GF - - -// --------------------- -// temp_tissue_safety // -// --------------------- -// outsourced in v.102 -void temp_tissue_safety(void) -{ - if (char_I_deco_model == 1) - { - } - else - { - if (temp_tissue < 0.0) - temp_tissue = temp_tissue * float_desaturation_multiplier; - else - temp_tissue = temp_tissue * float_saturation_multiplier; - } -} // temp_tissue_safety - -// ----------- -// dd2 OLD // -// ----------- -void DD2_write(void) -{ - _asm - nop - _endasm -} -void DD2_write_incon42(void) -{ - DD2_write(); -} - -void DD2_write_incon24(void) -{ - DD2_write(); -} -void DD2_get_pointer_to_char(void) -{ - DD2_write(); -} -void DD2_set_column(void) -{ - DD2_write(); -} -void DD2_load_background(void) -{ - DD2_write(); -} -void DD2_build_one_line_of_char(void) -{ - DD2_write(); -} -void DD2_print_column(void) -{ - DD2_write(); -} -void DD2_CmdWrite(void) -{ - DD2_write(); -} -void DD2_DataWrite(void) -{ - DD2_write(); -} - -// ********************** -// ********************** -// ** THE JUMP-IN CODE ** -// ** for the asm code ** -// ********************** -// ********************** -#pragma code main_calc_hauptroutine = 0x10000 -void main_calc_hauptroutine(void) -{ -calc_hauptroutine(); -int_O_desaturation_time = 65535; -} // divemode -#pragma code main_without_deco = 0x10020 -void main_calc_without_deco(void) -{ -calc_without_deco(); -calc_desaturation_time(); -} - -#pragma code main_clear_CNS_fraction = 0x10030 -void main_clear_CNS_fraction(void) -{ -clear_CNS_fraction(); -} - -#pragma code main_calc_CNS_decrease_15min = 0x10034 -void main_calc_CNS_decrease_15min(void) -{ -calc_CNS_decrease_15min(); -} - -#pragma code main_calc_percentage = 0x10038 -void main_calc_percentage (void) -{ -calc_percentage(); -} - -#pragma code main_clear_tissue = 0x10040 -void main_clear_tissue(void) -{ -clear_tissue(); -char_I_depth_last_deco = 0; // for compatibility with v.101pre_no_last_deco -} - -#pragma code main_calc_CNS_fraction = 0x10050 -void main_calc_CNS_fraction(void) -{ -calc_CNS_fraction(); -} - -#pragma code main_calc_desaturation_time = 0x10060 -void main_calc_desaturation_time(void) -{ -calc_desaturation_time(); -} - -#pragma code main_calc_wo_deco_step_1_min = 0x10080 -void main_calc_wo_deco_step_1_min(void) -{ -calc_wo_deco_step_1_min(); -char_O_deco_status = 3; // surface new in v.102 overwrites value of calc_wo_deco_step_1_min -calc_desaturation_time(); -} // surface mode - -#pragma code main_debug = 0x100A0 -void main_debug(void) -{ -//debug(); -} - -#pragma code main_DD2_write_incon42 = 0x100B0 -void main_DD2_write_incon42(void) -{ - DD2_write_incon42(); -} - -#pragma code main_DD2_write_incon24 = 0x100B4 -void main_DD2_write_incon24(void) -{ - DD2_write_incon24(); -} - -#pragma code main_wordprocessor = 0x100B8 -void main_wordprocessor(void) -{ - wordprocessor(); -} - -#pragma code main_gradient_array = 0x100C0 -void main_gradient_array(void) -{ -calc_gradient_array_only(); -} -#pragma code main_push_tissues = 0x100C4 -void main_push_tissues_to_vault(void) -{ - push_tissues_to_vault(); -} -#pragma code main_pull_tissues = 0x100C8 -void main_pull_tissues_from_vault(void) -{ - pull_tissues_from_vault(); -} - -#pragma code main_hash = 0x100E0 -void main_hash(void) -{ -hash(); -} - -// *********************** -// *********************** -// ** THE LOOKUP TABLES ** -// *********************** -// *********************** - -#pragma romdata tables = 0x10200 -#include <p2_tables.romdata> // new table for deco_main_v.101 (var_a modified) - -#pragma romdata tables2 = 0x10600 -rom const rom unsigned int md_pi[] = -{ - 0x292E, 0x43C9, 0xA2D8, 0x7C01, 0x3D36, 0x54A1, 0xECF0, 0x0613 - , 0x62A7, 0x05F3, 0xC0C7, 0x738C, 0x9893, 0x2BD9, 0xBC4C, 0x82CA - , 0x1E9B, 0x573C, 0xFDD4, 0xE016, 0x6742, 0x6F18, 0x8A17, 0xE512 - , 0xBE4E, 0xC4D6, 0xDA9E, 0xDE49, 0xA0FB, 0xF58E, 0xBB2F, 0xEE7A - , 0xA968, 0x7991, 0x15B2, 0x073F, 0x94C2, 0x1089, 0x0B22, 0x5F21 - , 0x807F, 0x5D9A, 0x5A90, 0x3227, 0x353E, 0xCCE7, 0xBFF7, 0x9703 - , 0xFF19, 0x30B3, 0x48A5, 0xB5D1, 0xD75E, 0x922A, 0xAC56, 0xAAC6 - , 0x4FB8, 0x38D2, 0x96A4, 0x7DB6, 0x76FC, 0x6BE2, 0x9C74, 0x04F1 - , 0x459D, 0x7059, 0x6471, 0x8720, 0x865B, 0xCF65, 0xE62D, 0xA802 - , 0x1B60, 0x25AD, 0xAEB0, 0xB9F6, 0x1C46, 0x6169, 0x3440, 0x7E0F - , 0x5547, 0xA323, 0xDD51, 0xAF3A, 0xC35C, 0xF9CE, 0xBAC5, 0xEA26 - , 0x2C53, 0x0D6E, 0x8528, 0x8409, 0xD3DF, 0xCDF4, 0x4181, 0x4D52 - , 0x6ADC, 0x37C8, 0x6CC1, 0xABFA, 0x24E1, 0x7B08, 0x0CBD, 0xB14A - , 0x7888, 0x958B, 0xE363, 0xE86D, 0xE9CB, 0xD5FE, 0x3B00, 0x1D39 - , 0xF2EF, 0xB70E, 0x6658, 0xD0E4, 0xA677, 0x72F8, 0xEB75, 0x4B0A - , 0x3144, 0x50B4, 0x8FED, 0x1F1A, 0xDB99, 0x8D33, 0x9F11, 0x8314 -}; - -// ********************* -// ********************* -// ** THE SUBROUTINES ** -// ********************* -// ********************* - -#pragma code subroutines = 0x10700 // can be adapted to fit the romdata tables ahead - - -// --------------- -// CLEAR tissue // -// --------------- -// optimized in v.101 (var_a) - -void clear_tissue(void) // preload tissues with standard pressure for the given ambient pressure -{ - - flag_in_divemode = 0; - int_O_DBS_bitfield = 0; - int_O_DBS2_bitfield = 0; - int_O_DBG_pre_bitfield = 0; - int_O_DBG_post_bitfield = 0; - char_O_NDL_at_20mtr = 255; - -_asm -lfsr 1, 0x300 // C math routines shall use this variable bank -movlw 0x01 -movwf TBLPTRU,0 -_endasm - -// N2_ratio = (float)char_I_N2_ratio; // the 0.0002 of 0.7902 are missing with standard air - N2_ratio = 0.7902; // N2_ratio / 100.0; - pres_respiration = (float)int_I_pres_respiration / 1000.0; -for (ci=0;ci<16;ci++) // cycle through the 16 b"uhlmann tissues -{ - pres_tissue[ci] = N2_ratio * (pres_respiration - 0.0627) ; -_asm -movlw 0x02 -movwf TBLPTRH,0 -movlb 4 // fuer ci -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addlw 0x80 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_a+1 -TBLRDPOSTINC -movff TABLAT,var_a -TBLRDPOSTINC -movff TABLAT,var_a+3 -TBLRD -movff TABLAT,var_a+2 -addlw 0x80 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_b+1 -TBLRDPOSTINC -movff TABLAT,var_b -TBLRDPOSTINC -movff TABLAT,var_b+3 -TBLRD -movff TABLAT,var_b+2 -_endasm - -pres_tissue_limit[ci] = (pres_tissue[ci] - var_a) * var_b ; -// now update the guiding tissue -if (pres_tissue_limit[ci] < 0) -pres_tissue_limit[ci] = 0; -} // for 0 to 16 - -for (ci=16;ci<32;ci++) // cycle through the 16 b"uhlmann tissues for Helium -{ - pres_tissue[ci] = 0.0; -} // for - - clear_decoarray(); - char_O_deco_status = 0; - char_O_nullzeit = 0; - char_O_ascenttime = 0; - char_O_gradient_factor = 0; - char_O_relative_gradient_GF = 0; -} // clear_tissue(void) - - -// -------------------- -// calc_without_deco // -// fixed N2_ratio ! // -// -------------------- -// optimized in v.101 (float_..saturation_multiplier) - -void calc_without_deco(void) -{ -_asm - lfsr 1, 0x300 -_endasm - N2_ratio = 0.7902; // FIXED RATIO !! sum as stated in b"uhlmann - pres_respiration = (float)int_I_pres_respiration / 1000.0; // assembler code uses different digit system - pres_surface = (float)int_I_pres_surface / 1000.0; - temp_atem = N2_ratio * (pres_respiration - 0.0627); // 0.0627 is the extra pressure in the body - temp2_atem = 0.0; - temp_surface = pres_surface; // the b"uhlmann formula using temp_surface does apply to the pressure without any inert ratio - float_desaturation_multiplier = char_I_desaturation_multiplier / 100.0; - float_saturation_multiplier = char_I_saturation_multiplier / 100.0; - - calc_tissue(); // update the pressure in the 16 tissues in accordance with the new ambient pressure - - clear_decoarray(); - char_O_deco_status = 0; - char_O_nullzeit = 0; - char_O_ascenttime = 0; - calc_gradient_factor(); - -} // calc_without_deco - - -// -------------------- -// calc_hauptroutine // -// -------------------- -// this is the major code in dive mode -// calculates: -// the tissues, -// the bottom time -// and simulates the ascend with all deco stops - -void calc_hauptroutine(void) -{ - calc_hauptroutine_data_input(); - - if(!flag_in_divemode) - { - flag_in_divemode = 1; - create_dbs_set_dbg_and_ndl20mtr(); - } - else - check_pre_dbg(); - - calc_hauptroutine_update_tissues(); - calc_gradient_factor(); - - - switch (char_O_deco_status) // toggle between calculation for nullzeit (bottom time), deco stops and more deco stops (continue) - { - case 0: - update_startvalues(); - calc_nullzeit(); - check_ndl(); - char_O_deco_status = 255; // calc deco next time - break; - case 1: - if (char_O_deco_status == 3) - break; - char_O_deco_status = 0; -// char_O_lock_depth_list = 255; - calc_hauptroutine_calc_deco(); -// build_debug_output(); - break; - case 3: // new dive - clear_decoarray(); - clear_internal_deco_table_GF(); - copy_deco_table_GF(); - internal_deco_pointer = 0; - lock_GF_depth_list = 0; - update_startvalues(); - calc_nextdecodepth_GF(); - char_O_deco_status = 0; - break; - default: - update_startvalues(); - clear_decoarray(); - clear_internal_deco_table_GF(); - output[6] = 1; - calc_hauptroutine_calc_ascend_to_deco(); - if (char_O_deco_status > 15) // can't go up to first deco, too deep to calculate in the given time slot - { - char_O_deco_status = 2; -// char_O_lock_depth_list = 255; - } - else - { -// char_O_lock_depth_list = lock_GF_depth_list; - calc_hauptroutine_calc_deco(); - } -// build_debug_output(); - break; - } - calc_ascenttime(); - check_post_dbg(); -} - -void calc_hauptroutine_data_input(void) -{ - pres_respiration = (float)int_I_pres_respiration / 1000.0; - pres_surface = (float)int_I_pres_surface / 1000.0; - - N2_ratio = (float)char_I_N2_ratio / 100.0;; // the 0.0002 of 0.7902 are missing with standard air - He_ratio = (float)char_I_He_ratio / 100.0;; - deco_N2_ratio = (float)char_I_deco_N2_ratio / 100.0; - deco_He_ratio = (float)char_I_deco_He_ratio / 100.0; - float_deco_distance = (float)char_I_deco_distance / 100.0; - if(char_I_deco_gas_change) - { - deco_gas_change = (float)char_I_deco_gas_change / 9.995 + pres_surface; - deco_gas_change = deco_gas_change + float_deco_distance; - } - else - deco_gas_change = 0; - const_ppO2 = (float)char_I_const_ppO2 / 100.0; - deco_ppO2_change = (float)char_I_deco_ppO2_change / 99.95 + pres_surface; - deco_ppO2_change = deco_ppO2_change + float_deco_distance; - deco_ppO2 = (float)char_I_deco_ppO2 / 100.0; - float_desaturation_multiplier = char_I_desaturation_multiplier / 100.0; - float_saturation_multiplier = char_I_saturation_multiplier / 100.0; - GF_low = (float)char_I_GF_Low_percentage / 100.0; - GF_high = (float)char_I_GF_High_percentage / 100.0; - GF_delta = GF_high - GF_low; - - temp2 = (pres_respiration - pres_surface) / 0.29985; - int_temp = (int)(temp2); - if (int_temp < 0) - int_temp = 0; - if (int_temp > 255) - int_temp = 255; - char_O_actual_pointer = int_temp; - - temp_depth_last_deco = (int)char_I_depth_last_deco; -} - -void calc_hauptroutine_update_tissues(void) -{ - int_O_calc_tissue_call_counter = int_O_calc_tissue_call_counter + 1; - if (char_I_const_ppO2 == 0) // new in v.101 - pres_diluent = pres_respiration; // new in v.101 - else // new in v.101 - pres_diluent = ((pres_respiration - const_ppO2)/(N2_ratio + He_ratio)); // new in v.101 - if (pres_diluent > pres_respiration) // new in v.101 - pres_diluent = pres_respiration; // new in v.101 - if (pres_diluent > 0.0627) // new in v.101 - { - temp_atem = N2_ratio * (pres_diluent - 0.0627); // changed in v.101 - temp2_atem = He_ratio * (pres_diluent - 0.0627); // changed in v.101 - char_O_diluent = (char)(pres_diluent/pres_respiration*100.0); - } - else // new in v.101 - { - temp_atem = 0.0; // new in v.101 - temp2_atem = 0.0; // new in v.101 - char_O_diluent = 0; - } - temp_surface = pres_surface; - calc_tissue(); - int_O_gtissue_limit = (int)(pres_tissue_limit[char_O_gtissue_no] * 1000); - int_O_gtissue_press = (int)((pres_tissue[char_O_gtissue_no] + pres_tissue[char_O_gtissue_no+16]) * 1000); - if (char_I_deco_model == 1) - { - temp1 = temp1 * GF_high; - } - else - { - temp1 = temp_surface; - } - if (pres_gtissue_limit > temp1 && char_O_deco_status == 0) // if guiding tissue can not be exposed to surface pressure immediately - { - char_O_nullzeit = 0; // deco necessary - char_O_deco_status = 255; // calculate deco skip nullzeit calculation - } -} // calc_hauptroutine_update_tissues -void calc_hauptroutine_calc_deco(void) -{ - do - { - int_temp_decostatus = 0; - calc_nextdecodepth_GF(); - if (temp_depth_limit > 0) - { - if (char_I_const_ppO2 == 0) // new in v.101 - { - deco_diluent = temp_deco; // new in v.101 - if (temp_deco > deco_gas_change) - { - calc_N2_ratio = N2_ratio; - calc_He_ratio = He_ratio; - } - else - { - calc_N2_ratio = deco_N2_ratio; - calc_He_ratio = deco_He_ratio; - } - } - else // new in v.101 - { - calc_N2_ratio = N2_ratio; - calc_He_ratio = He_ratio; - if (temp_deco > deco_ppO2_change) - { - deco_diluent = ((temp_deco - const_ppO2)/(N2_ratio + He_ratio)); // new in v.101 - } - else - { - deco_diluent = ((temp_deco - deco_ppO2)/(N2_ratio + He_ratio)); // new in v.101 - } - } - if (deco_diluent > temp_deco) // new in v.101 - deco_diluent = temp_deco; // new in v.101 - if (deco_diluent > 0.0627) // new in v.101 - { - temp_atem = calc_N2_ratio * (deco_diluent - 0.0627); // changed in v.101 - temp2_atem = calc_He_ratio * (deco_diluent - 0.0627); // changed in v.101 - } - else // new in v.101 - { - temp_atem = 0.0; // new in v.101 - temp2_atem = 0.0; // new in v.101 - } - sim_tissue_1min(); - update_internal_deco_table_GF(); - temp_decotime = 1; - update_decoarray(); - char_O_deco_status = char_O_deco_status + 1; - if (char_O_deco_status < 16) - int_temp_decostatus = 1; - } - else // if (temp_depth_limit > 0) - { - char_O_deco_status = 0; - } - } while (int_temp_decostatus == 1); - if (char_O_deco_status > 15) - { - char_O_deco_status = 1; - } - else - { - copy_deco_table_GF(); - char_O_deco_status = 0; - } -} - -void calc_hauptroutine_calc_ascend_to_deco(void) -{ - update_startvalues(); - char_O_deco_status = 0; - temp_deco = pres_respiration; - lock_GF_depth_list = 1; // new in v.102 - do // go up to first deco - { - int_temp_decostatus = 0; - temp_deco = temp_deco - 1.0; - if ( char_I_deco_model == 1) // new in v.102 , 4 = deep stops - temp_limit = temp_pres_gtissue_limit_GF_low; - else - temp_limit = temp_pres_gtissue_limit; - if ((temp_deco > temp_limit) && (temp_deco > pres_surface)) // changes in v.102 - { - lock_GF_depth_list = 0; // new in v.102, distance to first stop > 10 mtr. - output[6] = 0; - if (char_I_const_ppO2 == 0) // new in v.101 // calculate at half of the ascent - { - deco_diluent = temp_deco + 0.5; // new in v.101 - if (temp_deco + 0.5 > deco_gas_change) - { - calc_N2_ratio = N2_ratio; - calc_He_ratio = He_ratio; - } - else - { - calc_N2_ratio = deco_N2_ratio; - calc_He_ratio = deco_He_ratio; - } - } - else // new in v.101 - { - calc_N2_ratio = N2_ratio; - calc_He_ratio = He_ratio; - if (temp_deco + 0.5 > deco_ppO2_change) - deco_diluent = ((temp_deco + 0.5 - const_ppO2)/(N2_ratio + He_ratio)); // new in v.101 // calculate at half of the ascent - else - deco_diluent = ((temp_deco + 0.5 - deco_ppO2)/(N2_ratio + He_ratio)); // new in v.101 // calculate at half of the ascent - if (deco_diluent > (temp_deco +0.5)) // new in v.101 - deco_diluent = temp_deco + 0.5; // new in v.101 // calculate at half of the ascent - } - if (deco_diluent > 0.0627) // new in v.101 - { - temp_atem = calc_N2_ratio * (deco_diluent - 0.0627); // changed in v.101 - temp2_atem = calc_He_ratio * (deco_diluent - 0.0627); // changed in v.101 - } - else // new in v.101 - { - temp_atem = 0.0; // new in v.101 - temp2_atem = 0.0; // new in v.101 - } - sim_tissue_1min(); - char_O_deco_status = char_O_deco_status + 1; - if (char_O_deco_status < 16) // 16 is the limit of calculations for one time slot - int_temp_decostatus = 1; - } - } while (int_temp_decostatus == 1); -} // calc_hauptroutine_calc_ascend_to_deco - -// -------------- -// calc_tissue // -// -------------- -// optimized in v.101 - -void calc_tissue(void) -{ -_asm -lfsr 1, 0x300 -movlw 0x01 -movwf TBLPTRU,0 -_endasm - - char_O_gtissue_no = 255; - pres_gtissue_limit = 0.0; - -for (ci=0;ci<16;ci++) -{ -_asm -movlw 0x02 -movwf TBLPTRH,0 -movlb 4 // fuer ci -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_e2secs+1 // the order is confussing -TBLRDPOSTINC -movff TABLAT,var_e2secs // low byte first, high afterwards -TBLRDPOSTINC -movff TABLAT,var_e2secs+3 -TBLRD -movff TABLAT,var_e2secs+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_e2secs+1 -TBLRDPOSTINC -movff TABLAT,var2_e2secs -TBLRDPOSTINC -movff TABLAT,var2_e2secs+3 -TBLRD -movff TABLAT,var2_e2secs+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_a+1 -TBLRDPOSTINC -movff TABLAT,var_a -TBLRDPOSTINC -movff TABLAT,var_a+3 -TBLRD -movff TABLAT,var_a+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_a+1 -TBLRDPOSTINC -movff TABLAT,var2_a -TBLRDPOSTINC -movff TABLAT,var2_a+3 -TBLRD -movff TABLAT,var2_a+2 -addlw 0x40 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_b+1 -TBLRDPOSTINC -movff TABLAT,var_b -TBLRDPOSTINC -movff TABLAT,var_b+3 -TBLRD -movff TABLAT,var_b+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_b+1 -TBLRDPOSTINC -movff TABLAT,var2_b -TBLRDPOSTINC -movff TABLAT,var2_b+3 -TBLRD -movff TABLAT,var2_b+2 -_endasm - // the start values are the previous end values // write new values in temp - - if( (var_e2secs < 0.0000363) - || (var_e2secs > 0.00577) - || (var2_e2secs < 0.0000961) - || (var2_e2secs > 0.150) - || (var_a < 0.231) - || (var_a > 1.27) - || (var_b < 0.504) - || (var_b > 0.966) - || (var2_a < 0.510) - || (var2_a > 1.75) - || (var2_b < 0.423) - || (var2_b > 0.927) - ) - int_O_DBG_pre_bitfield |= DBG_ZH16ERR; - -// N2 - temp_tissue = (temp_atem - pres_tissue[ci]) * var_e2secs; - temp_tissue_safety(); - pres_tissue[ci] = pres_tissue[ci] + temp_tissue; - -// He - temp_tissue = (temp2_atem - pres_tissue[ci+16]) * var2_e2secs; - temp_tissue_safety(); - pres_tissue[ci+16] = pres_tissue[ci+16] + temp_tissue; - - temp_tissue = pres_tissue[ci] + pres_tissue[ci+16]; - - var_a = (var_a * pres_tissue[ci] + var2_a * pres_tissue[ci+16]) / temp_tissue; - var_b = (var_b * pres_tissue[ci] + var2_b * pres_tissue[ci+16]) / temp_tissue; - pres_tissue_limit[ci] = (temp_tissue - var_a) * var_b; - if (pres_tissue_limit[ci] < 0) - pres_tissue_limit[ci] = 0; - if (pres_tissue_limit[ci] > pres_gtissue_limit) - { - pres_gtissue_limit = pres_tissue_limit[ci]; - char_O_gtissue_no = ci; - }//if -} // for -}//calc_tissue(void) - -// ---------------- -// calc_nullzeit // -// ---------------- -// calculates the remaining bottom time - -// unchanged in v.101 - -void calc_nullzeit(void) -{ - char_O_nullzeit = 0; - int_temp = 1; - do - { - backup_sim_pres_tissue(); - sim_tissue_10min(); - char_O_nullzeit = char_O_nullzeit + 10; - int_temp = int_temp + 1; - if (char_I_deco_model == 1) - temp1 = GF_high * temp_pres_gtissue_diff + temp_pres_gtissue; - else - temp1 = temp_pres_gtissue_limit; - if (temp1 > temp_surface) // changed in v.102 , if guiding tissue can not be exposed to surface pressure immediately - int_temp = 255; - } while (int_temp < 17); - if (int_temp == 255) - { - restore_sim_pres_tissue(); - char_O_nullzeit = char_O_nullzeit - 10; - } //if int_temp == 255] - int_temp = 1; - if (char_O_nullzeit < 60) - { - do - { - sim_tissue_1min(); - char_O_nullzeit = char_O_nullzeit + 1; - int_temp = int_temp + 1; // new in v.102a - if (char_I_deco_model == 1) - temp1 = GF_high * temp_pres_gtissue_diff + temp_pres_gtissue; - else - temp1 = temp_pres_gtissue_limit; - if (temp1 > temp_surface) // changed in v.102 , if guiding tissue can not be exposed to surface pressure immediately - int_temp = 255; - } while (int_temp < 10); - if (int_temp == 255) - char_O_nullzeit = char_O_nullzeit - 1; - } // if char_O_nullzeit < 60 -} //calc_nullzeit - -// ------------------------- -// backup_sim_pres_tissue // -// ------------------------- -void backup_sim_pres_tissue(void) -{ - for (x = 0;x<16;x++) - { - sim_pres_tissue_backup[x] = sim_pres_tissue[x]; - sim_pres_tissue_backup[x+16] = sim_pres_tissue[x+16]; - } -} // backup_sim - -// -------------------------- -// restore_sim_pres_tissue // -// -------------------------- -void restore_sim_pres_tissue(void) -{ - for (x = 0;x<16;x++) - { - sim_pres_tissue[x] = sim_pres_tissue_backup[x]; - sim_pres_tissue[x+16] = sim_pres_tissue_backup[x+16]; - } -} // restore_sim - -// ------------------ -// calc_ascenttime // -// ------------------ - -void calc_ascenttime(void) -{ -if (pres_respiration > pres_surface) - { - switch (char_O_deco_status) - { - case 2: - char_O_ascenttime = 255; - break; - case 1: - break; - default: - temp1 = pres_respiration - pres_surface + 0.6; // + 0.6 hence 1 minute ascent time from a depth of 4 meter on - if (temp1 < 0) - temp1 = 0; - if (temp1 > 255) - temp1 = 255; - char_O_ascenttime = (char)temp1; - - for(ci=0;ci<7;ci++) - { - x = char_O_ascenttime + char_O_array_decotime[ci]; - if (x < char_O_ascenttime) - char_O_ascenttime = 255; - else - char_O_ascenttime = x; - } - } - } -else - char_O_ascenttime = 0; -} // calc_ascenttime() - - -// --------------------- -// update_startvalues // -// --------------------- -// updated in v.102 - -void update_startvalues(void) -{ - temp_pres_gtissue_limit = pres_gtissue_limit; - temp_pres_gtissue = pres_tissue[char_O_gtissue_no] + pres_tissue[char_O_gtissue_no+16]; - temp_pres_gtissue_diff = temp_pres_gtissue_limit - temp_pres_gtissue; // negative number - temp_pres_gtissue_limit_GF_low = GF_low * temp_pres_gtissue_diff + temp_pres_gtissue; - temp_pres_gtissue_limit_GF_low_below_surface = temp_pres_gtissue_limit_GF_low - pres_surface; - if (temp_pres_gtissue_limit_GF_low_below_surface < 0) - temp_pres_gtissue_limit_GF_low_below_surface = 0; - - temp_gtissue_no = char_O_gtissue_no; - for (x = 0;x<16;x++) - { - sim_pres_tissue[x] = pres_tissue[x]; - sim_pres_tissue[x+16] = pres_tissue[x+16]; - sim_pres_tissue_limit[x] = pres_tissue_limit[x]; - } -} // update_startvalues - - -// ------------------ -// sim_tissue_1min // -// ------------------ -// optimized in v.101 - -void sim_tissue_1min(void) -{ -temp_pres_gtissue_limit = 0.0; -temp_gtissue_no = 255; - -_asm -lfsr 1, 0x300 -movlw 0x01 -movwf TBLPTRU,0 -_endasm - - -for (ci=0;ci<16;ci++) -{ -_asm -movlw 0x02 -movwf TBLPTRH,0 -movlb 4 // fuer ci -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addlw 0x80 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_a+1 -TBLRDPOSTINC -movff TABLAT,var_a -TBLRDPOSTINC -movff TABLAT,var_a+3 -TBLRD -movff TABLAT,var_a+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_a+1 -TBLRDPOSTINC -movff TABLAT,var2_a -TBLRDPOSTINC -movff TABLAT,var2_a+3 -TBLRD -movff TABLAT,var2_a+2 -addlw 0x40 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_b+1 -TBLRDPOSTINC -movff TABLAT,var_b -TBLRDPOSTINC -movff TABLAT,var_b+3 -TBLRD -movff TABLAT,var_b+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_b+1 -TBLRDPOSTINC -movff TABLAT,var2_b -TBLRDPOSTINC -movff TABLAT,var2_b+3 -TBLRD -movff TABLAT,var2_b+2 -addlw 0xC0 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_e1min+1 -TBLRDPOSTINC -movff TABLAT,var_e1min -TBLRDPOSTINC -movff TABLAT,var_e1min+3 -TBLRD -movff TABLAT,var_e1min+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_e1min+1 -TBLRDPOSTINC -movff TABLAT,var2_e1min -TBLRDPOSTINC -movff TABLAT,var2_e1min+3 -TBLRD -movff TABLAT,var2_e1min+2 -_endasm -// N2 - temp_tissue = (temp_atem - sim_pres_tissue[ci]) * var_e1min; - temp_tissue_safety(); - sim_pres_tissue[ci] = sim_pres_tissue[ci] + temp_tissue; -// He - temp_tissue = (temp2_atem - sim_pres_tissue[ci+16]) * var2_e1min; - temp_tissue_safety(); - sim_pres_tissue[ci+16] = sim_pres_tissue[ci+16] + temp_tissue; -// pressure limit - temp_tissue = sim_pres_tissue[ci] + sim_pres_tissue[ci+16]; - var_a = (var_a * sim_pres_tissue[ci] + var2_a * sim_pres_tissue[ci+16]) / temp_tissue; - var_b = (var_b * sim_pres_tissue[ci] + var2_b * sim_pres_tissue[ci+16]) / temp_tissue; - sim_pres_tissue_limit[ci] = (temp_tissue - var_a) * var_b; - - if (sim_pres_tissue_limit[ci] < 0) - sim_pres_tissue_limit[ci] = 0; - if (sim_pres_tissue_limit[ci] > temp_pres_gtissue_limit) - { - temp_pres_gtissue = temp_tissue; - temp_pres_gtissue_limit = sim_pres_tissue_limit[ci]; - temp_gtissue_no = ci; - } -} // for - temp_pres_gtissue_diff = temp_pres_gtissue_limit - temp_pres_gtissue; - temp_pres_gtissue_limit_GF_low = GF_low * temp_pres_gtissue_diff + temp_pres_gtissue; - temp_pres_gtissue_limit_GF_low_below_surface = temp_pres_gtissue_limit_GF_low - pres_surface; - if (temp_pres_gtissue_limit_GF_low_below_surface < 0) - temp_pres_gtissue_limit_GF_low_below_surface = 0; -} //sim_tissue_1min() - -//-------------------- -// sim_tissue_10min // -//-------------------- - -// Attention!! uses var_e1min und var2_e1min to load 10min data !!! -// is identical to sim_tissue_1min routine except for the different load of those variables - -// optimized in v.101 - -void sim_tissue_10min(void) -{ -temp_pres_gtissue_limit = 0.0; -temp_gtissue_no = 255; - -_asm -lfsr 1, 0x300 -movlw 0x01 -movwf TBLPTRU,0 -_endasm - -for (ci=0;ci<16;ci++) -{ -_asm -movlw 0x02 -movwf TBLPTRH,0 -movlb 4 // fuer ci -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addlw 0x80 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_a+1 -TBLRDPOSTINC -movff TABLAT,var_a -TBLRDPOSTINC -movff TABLAT,var_a+3 -TBLRD -movff TABLAT,var_a+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_a+1 -TBLRDPOSTINC -movff TABLAT,var2_a -TBLRDPOSTINC -movff TABLAT,var2_a+3 -TBLRD -movff TABLAT,var2_a+2 -addlw 0x40 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_b+1 -TBLRDPOSTINC -movff TABLAT,var_b -TBLRDPOSTINC -movff TABLAT,var_b+3 -TBLRD -movff TABLAT,var_b+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_b+1 -TBLRDPOSTINC -movff TABLAT,var2_b -TBLRDPOSTINC -movff TABLAT,var2_b+3 -TBLRD -movff TABLAT,var2_b+2 -addlw 0xC0 // different to 1 min -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -incf TBLPTRH,1,0 // different to 1 min -TBLRDPOSTINC -movff TABLAT,var_e1min+1 -TBLRDPOSTINC -movff TABLAT,var_e1min -TBLRDPOSTINC -movff TABLAT,var_e1min+3 -TBLRD -movff TABLAT,var_e1min+2 -addlw 0x40 -movwf TBLPTRL,0 -//incf TBLPTRH,1,0 // different to 1 min -TBLRDPOSTINC -movff TABLAT,var2_e1min+1 -TBLRDPOSTINC -movff TABLAT,var2_e1min -TBLRDPOSTINC -movff TABLAT,var2_e1min+3 -TBLRD -movff TABLAT,var2_e1min+2 -_endasm -// N2 - temp_tissue = (temp_atem - sim_pres_tissue[ci]) * var_e1min; - temp_tissue_safety(); - sim_pres_tissue[ci] = sim_pres_tissue[ci] + temp_tissue; -// He - temp_tissue = (temp2_atem - sim_pres_tissue[ci+16]) * var2_e1min; - temp_tissue_safety(); - sim_pres_tissue[ci+16] = sim_pres_tissue[ci+16] + temp_tissue; -// pressure limit -temp_tissue = sim_pres_tissue[ci] + sim_pres_tissue[ci+16]; - var_a = (var_a * sim_pres_tissue[ci] + var2_a * sim_pres_tissue[ci+16]) / temp_tissue; - var_b = (var_b * sim_pres_tissue[ci] + var2_b * sim_pres_tissue[ci+16]) / temp_tissue; - -sim_pres_tissue_limit[ci] = (temp_tissue - var_a) * var_b; - if (sim_pres_tissue_limit[ci] < 0) - sim_pres_tissue_limit[ci] = 0; - if (sim_pres_tissue_limit[ci] > temp_pres_gtissue_limit) - { - temp_pres_gtissue = temp_tissue; - temp_pres_gtissue_limit = sim_pres_tissue_limit[ci]; - temp_gtissue_no = ci; - } -} // for - temp_pres_gtissue_diff = temp_pres_gtissue_limit - temp_pres_gtissue; // negative number - temp_pres_gtissue_limit_GF_low = GF_low * temp_pres_gtissue_diff + temp_pres_gtissue; - temp_pres_gtissue_limit_GF_low_below_surface = temp_pres_gtissue_limit_GF_low - pres_surface; - if (temp_pres_gtissue_limit_GF_low_below_surface < 0) - temp_pres_gtissue_limit_GF_low_below_surface = 0; -} //sim_tissue_10min() - - -// ------------------ -// clear_decoarray // -// ------------------ -// unchanged in v.101 - -void clear_decoarray(void) -{ -char_O_array_decodepth[0] = 0; -char_O_array_decodepth[1] = 0; -char_O_array_decodepth[2] = 0; -char_O_array_decodepth[3] = 0; -char_O_array_decodepth[4] = 0; -char_O_array_decodepth[5] = 0; -char_O_array_decotime[0] = 0; -char_O_array_decotime[1] = 0; -char_O_array_decotime[2] = 0; -char_O_array_decotime[3] = 0; -char_O_array_decotime[4] = 0; -char_O_array_decotime[5] = 0; -char_O_array_decotime[6] = 0; -} // clear_decoarray - - -// ------------------- -// update_decoarray // -// ------------------- -// unchanged in v.101 - -void update_decoarray() -{ - x = 0; - do - { - if (char_O_array_decodepth[x] == temp_depth_limit) - { - int_temp = char_O_array_decotime[x] + temp_decotime; - if (int_temp < 0) - int_temp = 0; - if (int_temp > 240) - int_temp = 240; - char_O_array_decotime[x] = int_temp; - x = 10; // exit - } // if - else - { - if (char_O_array_decodepth[x] == 0) - { - if (temp_depth_limit > 255) - char_O_array_decodepth[x] = 255; - else - char_O_array_decodepth[x] = (char)temp_depth_limit; - int_temp = char_O_array_decotime[x] + temp_decotime; - if (int_temp > 240) - char_O_array_decotime[x] = 240; - else - char_O_array_decotime[x] = (char)int_temp; - x = 10; // exit - } // if - else - x++; - } // else - } while (x<6); - if (x == 6) - { - int_temp = char_O_array_decotime[6] + temp_decotime; - if (int_temp > 220) - char_O_array_decotime[6] = 220; - else - char_O_array_decotime[6] = (char)int_temp; - } // if x == 6 -} // update_decoarray - - -// ----------------------- -// calc_gradient_factor // -// ----------------------- -// optimized in v.101 (var_a) -// new code in v.102 - -void calc_gradient_factor(void) -{ - // tissue > respiration (entsaettigungsvorgang) - // gradient ist wieviel prozent an limit mit basis tissue - // dh. 0% = respiration == tissue - // dh. 100% = respiration == limit - temp_tissue = pres_tissue[char_O_gtissue_no] + pres_tissue[char_O_gtissue_no+16]; - temp1 = temp_tissue - pres_respiration; - temp2 = temp_tissue - pres_tissue_limit[char_O_gtissue_no]; // changed in v.102 - temp2 = temp1/temp2; - temp2 = temp2 * 100; // displayed in percent - if (temp2 < 0) - temp2 = 0; - if (temp2 > 255) - temp2 = 255; - if (temp1 < 0) - char_O_gradient_factor = 0; - else - char_O_gradient_factor = (char)temp2; - - temp3 = temp2; - - if (char_I_deco_model == 1) // calculate relative gradient factor - { - temp1 = (float)temp_depth_GF_low_meter * 0.09995; - temp2 = pres_respiration - pres_surface; - if (temp2 <= 0) - temp1 = GF_high; - else - if (temp2 >= temp1) - temp1 = GF_low; - else - temp1 = GF_low + (temp1 - temp2)/temp1*GF_delta; - if (temp_depth_GF_low_meter == 0) - temp1 = GF_high; - temp2 = temp3 / temp1; // temp3 is already in percent - if (temp2 < 0) - temp2 = 0; - if (temp2 > 255) - temp2 = 255; - char_O_relative_gradient_GF = (char)temp2; - } // calc relative gradient factor - else - { - char_O_relative_gradient_GF = char_O_gradient_factor; - } -} // calc_gradient - -// --------------------------- -// calc_gradient_array_only // -// --------------------------- -// optimized in v.101 (var_a) -// new code in v.102 - -void calc_gradient_array_only() -{ - pres_respiration = (float)int_I_pres_respiration / 1000.0; // assembler code uses different digit system -for (ci=0;ci<16;ci++) -{ - temp_tissue = pres_tissue[ci] + pres_tissue[ci+16]; - temp1 = temp_tissue - pres_respiration; - temp2 = temp_tissue - pres_tissue_limit[ci]; - temp2 = temp1/temp2; - temp2 = temp2 * 200; // because of output in (Double-)percentage - if (temp2 < 0) - temp2 = 0; - if (temp2 > 255) - temp2 = 255; - if (temp1 < 0) - char_O_array_gradient_weighted[ci] = 0; - else - char_O_array_gradient_weighted[ci] = (char)temp2; -} // for -} // calc_gradient_array_only - - -// ------------------------- -// calc_desaturation_time // -// ------------------------- -// FIXED N2_ratio -// unchanged in v.101 - -void calc_desaturation_time(void) -{ -_asm -lfsr 1, 0x300 -movlw 0x01 -movwf TBLPTRU,0 -_endasm - N2_ratio = 0.7902; // FIXED sum as stated in b"uhlmann - pres_surface = (float)int_I_pres_surface / 1000.0; - temp_atem = N2_ratio * (pres_surface - 0.0627); - int_O_desaturation_time = 0; - float_desaturation_multiplier = char_I_desaturation_multiplier / 142.0; // new in v.101 (70,42%/100.=142) - -for (ci=0;ci<16;ci++) -{ -_asm -movlw 0x04 -movwf TBLPTRH,0 -movlb 4 // fuer ci -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addlw 0x80 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_halftimes+1 -TBLRDPOSTINC -movff TABLAT,var_halftimes -TBLRDPOSTINC -movff TABLAT,var_halftimes+3 -TBLRD -movff TABLAT,var_halftimes+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_halftimes+1 -TBLRDPOSTINC -movff TABLAT,var2_halftimes -TBLRDPOSTINC -movff TABLAT,var2_halftimes+3 -TBLRD -movff TABLAT,var2_halftimes+2 -_endasm - -// saturation_time (for flight) and N2_saturation in multiples of halftime -// version v.100: 1.1 = 10 percent distance to totally clean (totally clean is not possible, would take infinite time ) -// new in version v.101: 1.07 = 7 percent distance to totally clean (totally clean is not possible, would take infinite time ) -// changes in v.101: 1.05 = 5 percent dist to totally clean is new desaturation point for display and noFly calculations -// N2 - temp1 = 1.05 * temp_atem; - temp1 = temp1 - pres_tissue[ci]; - temp2 = temp_atem - pres_tissue[ci]; - if (temp2 >= 0.0) - { - temp1 = 0; - temp2 = 0; - } - else - temp1 = temp1 / temp2; - if (temp1 > 0.0) - { - temp1 = log(1.0 - temp1); - temp1 = temp1 / -0.6931; // temp1 is the multiples of half times necessary. - // 0.6931 is ln(2), because the math function log() calculates with a base of e not 2 as requested. - // minus because log is negative - temp2 = var_halftimes * temp1 / float_desaturation_multiplier; // time necessary (in minutes ) for complete desaturation (see comment about 10 percent) , new in v.101: float_desaturation_multiplier - } - else - { - temp1 = 0; - temp2 = 0; - } - -// He - temp3 = 0.1 - pres_tissue[ci+16]; -if (temp3 >= 0.0) - { - temp3 = 0; - temp4 = 0; - } - else - temp3 = -1.0 * temp3 / pres_tissue[ci+16]; - if (temp3 > 0.0) - { - temp3 = log(1.0 - temp3); - temp3 = temp3 / -0.6931; // temp1 is the multiples of half times necessary. - // 0.6931 is ln(2), because the math function log() calculates with a base of e not 2 as requested. - // minus because log is negative - temp4 = var2_halftimes * temp3 / float_desaturation_multiplier; // time necessary (in minutes ) for "complete" desaturation, new in v.101 float_desaturation_multiplier - } - else - { - temp3 = 0; - temp4 = 0; - } - -// saturation_time (for flight) - if (temp4 > temp2) - int_temp = (int)temp4; - else - int_temp = (int)temp2; - if(int_temp > int_O_desaturation_time) - int_O_desaturation_time = int_temp; - -// N2 saturation in multiples of halftime for display purposes - temp2 = temp1 * 20.0; // 0 = 1/8, 120 = 0, 249 = 8 - temp2 = temp2 + 80.0; // set center - if (temp2 < 0.0) - temp2 = 0.0; - if (temp2 > 255.0) - temp2 = 255.0; - char_O_tissue_saturation[ci] = (char)temp2; -// He saturation in multiples of halftime for display purposes - temp4 = temp3 * 20.0; // 0 = 1/8, 120 = 0, 249 = 8 - temp4 = temp4 + 80.0; // set center - if (temp4 < 0.0) - temp4 = 0.0; - if (temp4 > 255.0) - temp4 = 255.0; - char_O_tissue_saturation[ci+16] = (char)temp4; -} // for -} // calc_desaturation_time - - -// -------------------------- -// calc_wo_deco_step_1_min // -// -------------------------- -// FIXED N2 Ratio -// optimized in v.101 (...saturation_multiplier) -// desaturation slowed down to 70,42% - -void calc_wo_deco_step_1_min(void) -{ - if(flag_in_divemode) - { - flag_in_divemode = 0; - set_dbg_end_of_dive(); - } -_asm - lfsr 1, 0x300 -_endasm - N2_ratio = 0.7902; // FIXED, sum lt. buehlmann - pres_respiration = (float)int_I_pres_respiration / 1000.0; // assembler code uses different digit system - pres_surface = (float)int_I_pres_surface / 1000.0; - temp_atem = N2_ratio * (pres_respiration - 0.0627); // 0.0627 is the extra pressure in the body - temp2_atem = 0.0; - temp_surface = pres_surface; // the b"uhlmann formula using temp_surface does not use the N2_ratio - float_desaturation_multiplier = char_I_desaturation_multiplier / 142.0; // new in v.101 (70,42%/100.=142) - float_saturation_multiplier = char_I_saturation_multiplier / 100.0; - - calc_tissue_step_1_min(); // update the pressure in the 16 tissues in accordance with the new ambient pressure - clear_decoarray(); - char_O_deco_status = 0; - char_O_nullzeit = 0; - char_O_ascenttime = 0; - calc_gradient_factor(); - -} // calc_wo_deco_step_1_min(void) - - -// ------------------------- -// calc_tissue_step_1_min // -// ------------------------- -// optimized in v.101 - -void calc_tissue_step_1_min(void) -{ -_asm -lfsr 1, 0x300 -movlw 0x01 -movwf TBLPTRU,0 -_endasm - - char_O_gtissue_no = 255; - pres_gtissue_limit = 0.0; - -for (ci=0;ci<16;ci++) -{ -_asm -movlw 0x02 -movwf TBLPTRH,0 -movlb 4 // fuer ci -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addlw 0x80 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_a+1 -TBLRDPOSTINC -movff TABLAT,var_a -TBLRDPOSTINC -movff TABLAT,var_a+3 -TBLRD -movff TABLAT,var_a+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_a+1 -TBLRDPOSTINC -movff TABLAT,var2_a -TBLRDPOSTINC -movff TABLAT,var2_a+3 -TBLRD -movff TABLAT,var2_a+2 -addlw 0x40 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_b+1 -TBLRDPOSTINC -movff TABLAT,var_b -TBLRDPOSTINC -movff TABLAT,var_b+3 -TBLRD -movff TABLAT,var_b+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_b+1 -TBLRDPOSTINC -movff TABLAT,var2_b -TBLRDPOSTINC -movff TABLAT,var2_b+3 -TBLRD -movff TABLAT,var2_b+2 -addlw 0xC0 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_e1min+1 -TBLRDPOSTINC -movff TABLAT,var_e1min -TBLRDPOSTINC -movff TABLAT,var_e1min+3 -TBLRD -movff TABLAT,var_e1min+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_e1min+1 -TBLRDPOSTINC -movff TABLAT,var2_e1min -TBLRDPOSTINC -movff TABLAT,var2_e1min+3 -TBLRD -movff TABLAT,var2_e1min+2 -_endasm - -// N2 1 min - temp_tissue = (temp_atem - pres_tissue[ci]) * var_e1min; - temp_tissue_safety(); - pres_tissue[ci] = pres_tissue[ci] + temp_tissue; - -// He 1 min - temp_tissue = (temp2_atem - pres_tissue[ci+16]) * var2_e1min; - temp_tissue_safety(); - pres_tissue[ci+16] = pres_tissue[ci+16] + temp_tissue; - - temp_tissue = pres_tissue[ci] + pres_tissue[ci+16]; - var_a = (var_a * pres_tissue[ci] + var2_a * pres_tissue[ci+16]) / temp_tissue; - var_b = (var_b * pres_tissue[ci] + var2_b * pres_tissue[ci+16]) / temp_tissue; - pres_tissue_limit[ci] = (temp_tissue - var_a) * var_b; - if (pres_tissue_limit[ci] < 0) - pres_tissue_limit[ci] = 0; - if (pres_tissue_limit[ci] > pres_gtissue_limit) - { - pres_gtissue_limit = pres_tissue_limit[ci]; - char_O_gtissue_no = ci; - }//if - -// gradient factor array for graphical display -// display range is 0 to 250! in steps of 5 for 1 pixel -// the display is divided in 6 blocks -// -> double the gradient 100% = 200 -// tissue > respiration (entsaettigungsvorgang) -// gradient ist wieviel prozent an limit von tissue aus -// dh. 0% = respiration == tissue -// dh. 100% = respiration == limit -temp1 = temp_tissue - pres_respiration; -temp2 = temp_tissue - pres_tissue_limit[ci]; // changed in v.102 -temp2 = temp1/temp2; -temp2 = temp2 * 200; // because of output in (Double-)percentage -if (temp2 < 0) - temp2 = 0; -if (temp2 > 255) - temp2 = 255; -if (temp1 < 0) - char_O_array_gradient_weighted[ci] = 0; -else - char_O_array_gradient_weighted[ci] = (char)temp2; - -} // for -} // calc wo deco 1min - -#if 0 -// -------- -// debug // -// -------- -void debug(void) -{ -for (ci=0;ci<32;ci++) -{ - int_O_tissue_for_debug[ci] = (unsigned int)(pres_tissue[ci] *1000); -} -} // void debug(void) -#endif - -// ---------- -// md hash // -// ---------- -void hash(void) -{ -// init - for (md_i=0;md_i<16;md_i++) - { - md_state[md_i] = 0; - md_cksum[md_i] = 0; - } // for md_i 16 - -_asm - movlw 0x01 - movwf TBLPTRU,0 - movlw 0x06 - movwf TBLPTRH,0 - movlw 0x00 - movwf TBLPTRL,0 -_endasm - for (md_i=0;md_i<127;md_i++) - { -_asm - TBLRDPOSTINC - movff TABLAT,md_temp -_endasm - md_pi_subst[md_i] = md_temp; - } // for md_i 256 -_asm - TBLRDPOSTINC - movff TABLAT,md_temp -_endasm - md_pi_subst[127] = md_temp; - for (md_i=0;md_i<127;md_i++) - { -_asm - TBLRDPOSTINC - movff TABLAT,md_temp -_endasm - md_pi_subst[md_i+128] = md_temp; - } // for md_i 256 -_asm - TBLRD - movff TABLAT,md_temp -_endasm - md_pi_subst[255] = md_temp; - -_asm - movlw 0x00 - movwf TBLPTRU,0 - movlw 0x00 - movwf TBLPTRH,0 - movlw 0x00 - movwf TBLPTRL,0 -_endasm -// cycle buffers -for (md_pointer=0x0000;md_pointer<0x17f3;md_pointer++) -{ - md_t = 0; - for (md_i=0;md_i<16;md_i++) - { - if(md_pointer == 9) - md_temp = md_cksum[md_i]; - else - { -_asm - TBLRDPOSTINC - movff TABLAT,md_temp -_endasm - } // else - md_buffer[md_i] = md_temp; - md_state[md_i+16] = md_buffer[md_i]; - md_state[md_i+32] = (unsigned char)(md_buffer[md_i] ^ md_state[md_i]); - } // for md_i 16 - - for (md_i=0;md_i<18;md_i++) - { - for (md_j=0;md_j<48;md_j++) - { - md_state[md_j] = (unsigned char)(md_state[md_j] ^ md_pi_subst[md_t]); - md_t = md_state[md_j]; - } // for md_j 48 - md_t = (unsigned char)(md_t+1); - } // for md_i 18 - md_t = md_cksum[15]; - - for (md_i=0;md_i<16;md_i++) - { - md_cksum[md_i] = (unsigned char)(md_cksum[md_i] ^ md_pi_subst[(md_buffer[md_i] ^ md_t)]); - md_t = md_cksum[md_i]; - } // for md_i 16 -} // for md_pointer -} // void hash(void) - -// --------------------- -// clear_CNS_fraction // -// --------------------- -// new in v.101 - -void clear_CNS_fraction(void) -{ - CNS_fraction = 0.0; - char_O_CNS_fraction = 0; -} // void clear_CNS_fraction(void) - - -// -------------------- -// calc_CNS_fraction // -// -------------------- -// new in v.101 -// optimized in v.102 : with new variables char_I_actual_ppO2 and actual_ppO2 - -// Input: char_I_actual_ppO2 -// Output: char_O_CNS_fraction -// Uses and Updates: CNS_fraction -// Uses: acutal_ppO2 - -void calc_CNS_fraction(void) -{ - actual_ppO2 = (float)char_I_actual_ppO2 / 100.0; - - if (char_I_actual_ppO2 < 50) - CNS_fraction = CNS_fraction;// no changes - else if (char_I_actual_ppO2 < 60) - CNS_fraction = 1/(-54000.0 * actual_ppO2 + 54000.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 70) - CNS_fraction = 1/(-45000.0 * actual_ppO2 + 48600.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 80) - CNS_fraction = 1/(-36000.0 * actual_ppO2 + 42300.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 90) - CNS_fraction = 1/(-27000.0 * actual_ppO2 + 35100.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 110) - CNS_fraction = 1/(-18000.0 * actual_ppO2 + 27000.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 150) - CNS_fraction = 1/(-9000.0 * actual_ppO2 + 17100.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 160) - CNS_fraction = 1/(-22500.0 * actual_ppO2 + 37350.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 165) - CNS_fraction = 0.000755 + CNS_fraction; // Arieli et all.(2002): Modeling pulmonary and CNS O2 toxicity... Formula (A1) based on value for 1.55 and c=20 - else if (char_I_actual_ppO2 < 170) - CNS_fraction = 0.00102 + CNS_fraction; // example calculation: Sqrt((1.7/1.55)^20)*0.000404 - else if (char_I_actual_ppO2 < 175) - CNS_fraction = 0.00136 + CNS_fraction; - else if (char_I_actual_ppO2 < 180) - CNS_fraction = 0.00180 + CNS_fraction; - else if (char_I_actual_ppO2 < 185) - CNS_fraction = 0.00237 + CNS_fraction; - else if (char_I_actual_ppO2 < 190) - CNS_fraction = 0.00310 + CNS_fraction; - else if (char_I_actual_ppO2 < 195) - CNS_fraction = 0.00401 + CNS_fraction; - else if (char_I_actual_ppO2 < 200) - CNS_fraction = 0.00517 + CNS_fraction; - else if (char_I_actual_ppO2 < 230) - CNS_fraction = 0.0209 + CNS_fraction; - else - CNS_fraction = 0.0482 + CNS_fraction; // value for 2.5 - - if (CNS_fraction > 2.5) - CNS_fraction = 2.5; - if (CNS_fraction < 0.0) - CNS_fraction = 0.0; - char_O_CNS_fraction = (char)((CNS_fraction + 0.005)* 100.0); -} // void calc_CNS_fraction(void) - -// -------------------------- -// calc_CNS_decrease_15min // -// -------------------------- -// new in v.101 - -// calculates the half time of 90 minutes in 6 steps of 15 min - -// Output: char_O_CNS_fraction -// Uses and Updates: CNS_fraction - -void calc_CNS_decrease_15min(void) -{ - CNS_fraction = 0.890899 * CNS_fraction; - char_O_CNS_fraction = (char)((CNS_fraction + 0.005)* 100.0); -}// calc_CNS_decrease_15min(void) - - -// ------------------ -// calc_percentage // -// ------------------ -// new in v.101 - -// calculates int_I_temp * char_I_temp / 100 -// output is int_I_temp - -void calc_percentage(void) -{ - temp1 = (float)int_I_temp; - temp2 = (float)char_I_temp / 100.0; - temp3 = temp1 * temp2; - int_I_temp = (int)temp3; -} -void push_tissues_to_vault(void) -{ - for (ci=0;ci<32;ci++) - pres_tissue_vault[ci] = pres_tissue[ci]; -} -void pull_tissues_from_vault(void) -{ - for (ci=0;ci<32;ci++) - pres_tissue[ci] = pres_tissue_vault[ci]; -} - -void wp_write_command(void) -{ - _asm - bcf oled_rs - movff wp_command,PORTD - bcf oled_rw - bsf oled_rw - _endasm -} - -void wp_write_data(void) -{ - wp_data_8bit_one = wp_data_16bit >> 8; - wp_data_8bit_two = wp_data_16bit; -_asm - bsf oled_rs - movff wp_data_8bit_one,PORTD - bcf oled_rw - bsf oled_rw - movff wp_data_8bit_two,PORTD - bcf oled_rw - bsf oled_rw -_endasm -} - -void wp_write_black(void) -{ -_asm - movff wp_black,PORTD - bcf oled_rw - bsf oled_rw - bcf oled_rw - bsf oled_rw -_endasm -} - -void wp_write_color(void) -{ -_asm - movff wp_color1,PORTD - bcf oled_rw - bsf oled_rw - movff wp_color2,PORTD - bcf oled_rw - bsf oled_rw -_endasm -} - -void wp_set_window(void) -{ - // x axis start ( 0 - 319) - wp_command = 0x35; - wp_write_command(); - wp_data_16bit = ((U16)wp_leftx2) << 1; - wp_write_data(); - // x axis end ( 0 - 319) - wp_command = 0x36; - wp_write_command(); - wp_data_16bit = 319; - wp_write_data(); - // y axis start + end ( 0 - 239 ) - wp_command = 0x37; - wp_write_command(); - // the bottom part - wp_data_16bit = wp_top; - if(wp_font == 2) - wp_data_16bit += WP_FONT_LARGE_HEIGHT; - else if(wp_font == 1) - wp_data_16bit += WP_FONT_MEDIUM_HEIGHT; - else - wp_data_16bit += WP_FONT_SMALL_HEIGHT; - wp_data_16bit--; - if(wp_data_16bit > 239) - wp_data_16bit = 239; - // the top part - wp_data_16bit |= ((U16)wp_top) << 8; - // all together in one 16bit transfer - wp_write_data(); - - // start - wp_command = 0x20; - wp_write_command(); - wp_data_16bit = wp_top; - wp_write_data(); - - wp_command = 0x21; - wp_write_command(); - wp_data_16bit = ((U16)wp_leftx2) << 1; - wp_write_data(); -} - -void wp_set_char_font_small(void) -{ - // space is A1 - if (wp_char > 0x7E) // skip space between ~ and ¡ - wp_char -= 34; - - if (wp_char == ' ') - wp_char = 0xA1; - - if((wp_char < '!') || (wp_char > 0xA1)) // font has 34 chars after ~ // ¾ + 4 chars limit to end of battery at the moment - wp_char = 0x82; // ¤ - - wp_start = wp_small_table[wp_char - '!']; - wp_end = wp_small_table[1 + wp_char - '!']; -} - -void wp_set_char_font_medium(void) -{ - // space is 3E - if (wp_char == 0x27) // 0x27 == ' - wp_char = 0x3B; - if (wp_char == '"') - wp_char = 0x3C; - if (wp_char == 'm') - wp_char = 0x3D; - if (wp_char == ' ') - wp_char = 0x3E; - - if((wp_char < '.') || (wp_char > 0x3E)) - wp_char = 0x3E; - wp_start = wp_medium_table[wp_char - '.']; - wp_end = wp_medium_table[1 + wp_char - '.']; -} - -void wp_set_char_font_large(void) -{ - // space is / = 0x2F - if (wp_char == ' ') - wp_char = 0x2F; - - if((wp_char < '.') || (wp_char > '9')) - wp_char = 0x2F; - wp_start = wp_large_table[wp_char - '.']; - wp_end = wp_large_table[1 + wp_char - '.']; -} - -void wordprocessor(void) -{ - wp_set_window(); - - // access to GRAM - wp_command = 0x22; - wp_write_command(); - _asm - bsf oled_rs - _endasm - - wp_txtptr = 0; - wp_char = wp_stringstore[wp_txtptr]; - - while(wp_char) - { - if(wp_font == 2) - wp_set_char_font_large(); - else if(wp_font == 1) - wp_set_char_font_medium(); - else - wp_set_char_font_small(); - - wp_black = 0; - - for(wp_i = wp_start; wp_i<wp_end;wp_i++) - { - if(wp_font == 2) - wp_data_16bit = wp_large_data[wp_i / 2]; - else if(wp_font == 1) - wp_data_16bit = wp_medium_data[wp_i / 2]; - else - wp_data_16bit = wp_small_data[wp_i / 2]; - if(wp_i & 1) - wp_temp_U8 = wp_data_16bit & 0xFF; - else - wp_temp_U8 = wp_data_16bit >> 8; - if((wp_temp_U8 & 128)) - { - wp_temp_U8 -= 127; - if(wp_invert) - { - while(wp_temp_U8 > 0) - { - wp_temp_U8--; - wp_write_color(); - } - } - else - { - _asm - movff wp_black,PORTD - _endasm - while(wp_temp_U8 > 0) - { - wp_temp_U8--; - _asm - bcf oled_rw - bsf oled_rw - bcf oled_rw - bsf oled_rw - _endasm - } - } - } - else - { - wp_temp_U8++; - if(wp_invert) - { - _asm - movff wp_black,PORTD - _endasm - while(wp_temp_U8 > 0) - { - wp_temp_U8--; - _asm - bcf oled_rw - bsf oled_rw - bcf oled_rw - bsf oled_rw - _endasm - } - } - else - { - while(wp_temp_U8 > 0) - { - wp_temp_U8--; - wp_write_color(); - } - } - } - } - wp_txtptr++; - wp_char = wp_stringstore[wp_txtptr]; - } - wp_command = 0x00; - wp_write_command(); - wp_top = 0; - wp_leftx2 = 0; - wp_font = 0; - wp_invert = 0; -} -
--- a/code_part1/OSTC_code_c_part2/p2_deco_main - 090915b.c Thu Aug 05 09:49:32 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3144 +0,0 @@ -/* - * OSTC - diving computer code - * =========================== - * PART 2 : C code - * - * p2_deco_main.c for OSTC Mk.2 - * Created on: 31.08.2009 - * Author: christian.w @ heinrichsweikamp.com - * - * #include <p2_tables.romdata> - * #include "ostc28.drx.txt" - * #include "ostc28.tbl.txt" - * #include "ostc48.tbl.txt" - * #include "ostc48.drx.txt" - * #include "ostc90.drx.txt" - * #include "ostc90.tbl.txt" - */ - -// Copyright (C) 2009 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/>. - - -// ***************************** -// ** I N T R O D U C T I O N ** -// ***************************** -// -// OSTC -// -// code: -// p2_deco_main_c_v101.c -// part2 of the OSTC code -// code with constant O2 partial pressure routines -// experimental -// -// summary: -// decompression routines -// and display routines -// for the OSTC experimental project -// written by Christian Weikamp -// last revision __________ -// comments added _________ -// -// additional files: -// #include <p2_tables.romdata> -// #include "ostc28.drx.txt" -// #include "ostc28.tbl.txt" -// #include "ostc48.tbl.txt" -// #include "ostc48.drx.txt" -// #include "ostc90.drx.txt" -// #include "ostc90.tbl.txt" -// assembler code (PART 1) for working OSTC experimental plattform -// -// history: -// 14/09/09 v201: first alpha candidate for Mk. 2 based on v108 for OSTC -// -// literature: -// B"uhlmann, Albert: Tauchmedizin; 4. Auflage; -// Schr"oder, Kai & Reith, Steffen; 2000; S"attigungsvorg"ange beim Tauchen, das Modell ZH-L16, Funktionsweise von Tauchcomputern; http://www.achim-und-kai.de/kai/tausim/saett_faq -// Morrison, Stuart; 2000; DIY DECOMPRESSION; http://www.lizardland.co.uk/DIYDeco.html -// Balthasar, Steffen; Dekompressionstheorie I: Neo Haldane Modelle; http://www.txfreak.de/dekompressionstheorie_1.pdf -// Baker, Erik C.; Clearing Up The Confusion About "Deep Stops" -// Baker, Erik C.; Understanding M-values; http://www.txfreak.de/understanding_m-values.pdf - - -// ********************* -// ** I N C L U D E S ** -// ********************* - #include <p18f4685.h> - #include <math.h> - -// ******************************** -// ** C O N F I G U R A T I O N ** -// ** for simulation without asm ** -// ******************************** - #pragma config OSC = IRCIO67 - #pragma config FCMEN = OFF - #pragma config IESO = OFF - #pragma config PWRT = ON - #pragma config BOREN = OFF - #pragma config WDT = OFF - #pragma config WDTPS = 128 - #pragma config MCLRE = ON - #pragma config LPT1OSC = OFF - #pragma config PBADEN = OFF - #pragma config DEBUG = OFF - #pragma config XINST = OFF - #pragma config LVP = OFF - #pragma config STVREN = OFF - -// **************************** -// ** D E F I N E S ** -// ** missing in p18f4685.h ** -// **************************** -#define INT0IF 1 -#define INT1IF 0 -#define TMR1IF 0 - - -# define DBG_c_gas 0b0000000000000001 -# define DBG_c_ppO2 0b0000000000000010 -# define DBG_RUN 0b0000000000000100 -# define DBG_RESTART 0b0000000000001000 - -# define DBG_CdeSAT 0b0000000000010000 -# define DBG_C_MODE 0b0000000000100000 -# define DBG_C_SURF 0b0000000001000000 -# define DBG_HEwoHE 0b0000000010000000 - -# define DBG_C_DPPO2 0b0000000100000000 -# define DBG_C_DGAS 0b0000001000000000 -# define DBG_C_DIST 0b0000010000000000 -# define DBG_C_LAST 0b0000100000000000 - -# define DBG_C_GF 0b0001000000000000 -# define DBG_ZH16ERR 0b0010000000000000 -# define DBG_PHIGH 0b0100000000000000 -# define DBG_PLOW 0b1000000000000000 - - -# define DBS_mode 0b0000000000000001 -# define DBS_ppO2 0b0000000000000010 -# define DBS_HE_sat 0b0000000000000100 -# define DBS_ppO2chg 0b0000000000001000 - -# define DBS_SAT2l 0b0000000000010000 -# define DBS_SAT2h 0b0000000000100000 -# define DBS_GFLOW2l 0b0000000001000000 -# define DBS_GFLOW2h 0b0000000010000000 - -# define DBS_GFHGH2l 0b0000000100000000 -# define DBS_GFHGH2h 0b0000001000000000 -# define DBS_GASO22l 0b0000010000000000 -# define DBS_GASO22h 0b0000100000000000 - -# define DBS_DIST2h 0b0001000000000000 -# define DBS_LAST2h 0b0010000000000000 -# define DBS_DECOO2l 0b0100000000000000 -# define DBS_DECOO2h 0b1000000000000000 - - -# define DBS2_PRES2h 0b0000000000000001 -# define DBS2_PRES2l 0b0000000000000010 -# define DBS2_SURF2l 0b0000000000000100 -# define DBS2_SURF2h 0b0000000000001000 - -# define DBS2_DESAT2l 0b0000000000010000 -# define DBS2_DESAT2h 0b0000000000100000 -# define DBS2_GFDneg 0b0000000001000000 -# define DBS2_ 0b000000000000000 - -# define DBS2_ 0b000000000000000 -# define DBS2_ 0b000000000000000 -# define DBS2_ 0b000000000000000 -# define DBS2_ 0b000000000000000 - -// NDL_at_20mtr - - - -// *********************** -// ** V A R I A B L E S ** -// *********************** -// prefixes etc: -// _O_ = output for use in the assembler code -// _I_ = input from the assembler code for the c code -// char_ and int_ = used to identify output and input size -// var = variable (from b"uhlmann) -// pres = pressure -// gtissue = guiding tissue, the one limiting the ascent -// e2secs = exp of the b"uhlmann formula precalculated for a 2 second step -// e1min = same for 1 minute step -// sim = used in simulating the ascent to the surface -// nullzeit = remaining ground/bottom time for "no deco" -// hauptroutine = main - -#define WP_FONT_SMALL_HEIGHT 24 -#define WP_FONT_MEDIUM_HEIGHT 32 -#define WP_FONT_LARGE_HEIGHT 58 - -#define oled_rw PORTA,2,0 -#define oled_rs PORTE,0,0 - -#define U8 unsigned char -#define U16 unsigned int - -// IO assembler -#pragma udata bank0a=0x060 -volatile unsigned char wp_stringstore[26]; -volatile U8 wp_color1; -volatile U8 wp_color2; -volatile U8 wp_top; -volatile U8 wp_leftx2; -volatile U8 wp_font; -volatile U8 wp_invert; -volatile U8 wp_temp_U8; -// internal C -#pragma udata bank0b=0x081 -volatile U8 wp_txtptr; -volatile unsigned char wp_char; -volatile U8 wp_command; -volatile U16 wp_data_16bit; -volatile U8 wp_data_8bit_one; -volatile U8 wp_data_8bit_two; -volatile U16 wp_start; -volatile U16 wp_end; -volatile U16 wp_i; -volatile U8 wp_black; -// some spare -volatile U8 wp_debug_U8; - -// asm only -#pragma udata bank0c=0x0D0 -#define LENGTH_kf_bank0 48 -volatile unsigned char keep_free_bank0[LENGTH_kf_bank0]; - - -#pragma udata bank1=0x100 -#define LENGTH_kf_bank1 256 -volatile unsigned char keep_free_bank1[LENGTH_kf_bank1]; // used by the assembler code - - #pragma udata bank2a=0x200 -// output: - static unsigned int int_O_tissue_for_debug[32]; - static unsigned int int_O_GF_spare____; // 0x240 - static unsigned int int_O_GF_step; // 0x242 - static unsigned int int_O_gtissue_limit; // 0x244 - static unsigned int int_O_gtissue_press; // 0x246 - static unsigned int int_O_limit_GF_low; // 0x248 - static unsigned int int_O_gtissue_press_at_GF_low; // 0x24A -// 0x24C + 0x24D noch unbenutzt - - #pragma udata bank2b=0x24E - static unsigned char char_O_GF_low_pointer; // 0x24E - static unsigned char char_O_actual_pointer; // 0x24F - #pragma udata bank2c=0x250 - static unsigned char char_O_deco_table[32]; // 0x250 - #pragma udata bank2d=0x270 - static unsigned char char_I_table_deco_done[32]; - #pragma udata bank2e=0x290 - static unsigned int int_O_calc_tissue_call_counter; // 0x290 -// internal: - unsigned char lock_GF_depth_list; - static float temp_limit; - static float GF_low; - static float GF_high; - static float GF_delta; - static float GF_temp; - static float GF_step; - static float GF_step2; - static float temp_pres_gtissue; - static float temp_pres_gtissue_diff; - static float temp_pres_gtissue_limit_GF_low; - static float temp_pres_gtissue_limit_GF_low_below_surface; - static unsigned int temp_depth_limit; - static unsigned char temp_decotime; - static unsigned char temp_gtissue_no; - static unsigned int temp_depth_last_deco; // new in v.101 - - static unsigned char temp_depth_GF_low_meter; - static unsigned char temp_depth_GF_low_number; - static unsigned char internal_deco_pointer; - static unsigned char internal_deco_table[32]; - static float temp_pres_deco_GF_low; - -static unsigned int debug_temp; - - -#pragma udata bank3a=0x300 -static char output[32]; - -#pragma udata bank3b=0x380 -volatile float pres_tissue_vault[32]; - -#pragma udata bank4a=0x400 -// internal: - unsigned char ci ; // don't move - used in _asm routines - if moved then modify movlb commands - unsigned char x; - unsigned int main_i; - unsigned int int_temp; - unsigned int int_temp_decostatus; - static float pres_respiration; - static float pres_surface; - static float temp1; - static float temp2; - static float temp3; - static float temp4; - static float temp_deco; - static float temp_atem; - static float temp2_atem; - static float temp_tissue; - static float temp_surface; - static float N2_ratio; - static float He_ratio; - static float temp_ratio; - static float var_a; - static float var2_a; - static float var_b; - static float var2_b; - static float var_t05nc; - static float var2_t05nc; - static float var_e2secs; - static float var2_e2secs; - static float var_e1min; - static float var2_e1min; - static float var_halftimes; - static float var2_halftimes; - static float pres_gtissue_limit; - static float temp_pres_gtissue_limit; - static float actual_ppO2; // new in v.102 - - #pragma udata bank4b=0x480 - static float pres_tissue[32]; - - #pragma udata bank5=0x500 -// don't move positions in this bank, the registers are addressed directly from assembler code -// input: - static unsigned int int_I_pres_respiration; // 0x500 - static unsigned int int_I_pres_surface; // 0x502 - static unsigned int int_I_temp; // 0x504 new in v101 - static unsigned char char_I_temp; // 0x506 new in v101 - static unsigned char char_I_actual_ppO2; // 0x507 - static unsigned int int_I_spare_3; - static unsigned int int_I_spare_4; - static unsigned int int_I_spare_5; - static unsigned int int_I_spare_6; - static unsigned char char_I_N2_ratio; // 0x510 - static unsigned char char_I_He_ratio; // 0x511 - static unsigned char char_I_saturation_multiplier; // for conservatism/safety values 1.0 (no conservatism) to 1.5 (50% faster saturation - static unsigned char char_I_desaturation_multiplier; // for conservatism/safety values 0.66 (50% slower desaturation) to 1.0 (no conservatism)// consveratism used in calc_tissue(), calc_tissue_step_1_min() and sim_tissue_1min() - static unsigned char char_I_GF_High_percentage; // 0x514 new in v.102 - static unsigned char char_I_GF_Low_percentage; // 0x515 new in v.102 - static unsigned char char_I_spare; // 0x516 - static unsigned char char_I_deco_distance; // 0x517 - static unsigned char char_I_const_ppO2; // 0x518 new in v.101 - static unsigned char char_I_deco_ppO2_change; // 0x519 new in v.101 - static unsigned char char_I_deco_ppO2; // 0x51A new in v.101 - static unsigned char char_I_deco_gas_change; // 0x51B new in v.101 - static unsigned char char_I_deco_N2_ratio; // 0x51C new in v.101 - static unsigned char char_I_deco_He_ratio; // 0x51D new in v.101 - static unsigned char char_I_depth_last_deco; // 0x51E new in v.101 unit: [m] - static unsigned char char_I_deco_model; // 0x51F new in v.102 ( 1 = MultiGraF, sonst Std. mit (de-)saturation_multiplier) -// output: - static unsigned int int_O_desaturation_time; // 0x520 - static unsigned char char_O_nullzeit; // 0x522 - static unsigned char char_O_deco_status; // 0x523 - static unsigned char char_O_array_decotime[7]; // 0x524 - static unsigned char char_O_array_decodepth[6]; // 0x52B - static unsigned char char_O_ascenttime; // 0x531 - static unsigned char char_O_gradient_factor; // 0x532 - static unsigned char char_O_tissue_saturation[32]; // 0x533 - static unsigned char char_O_array_gradient_weighted[16]; // 0x553 - static unsigned char char_O_gtissue_no; // 0x563 - static unsigned char char_O_diluent; // 0x564 new in v.101 - static unsigned char char_O_CNS_fraction; // 0x565 new in v.101 - static unsigned char char_O_relative_gradient_GF; // 0x566 new in v.102 - -// internal: - static float pres_tissue_limit[16]; - static float sim_pres_tissue_limit[16]; - static float pres_diluent; // new in v.101 - static float deco_diluent; // new in v.101 - static float const_ppO2; // new in v.101 - static float deco_ppO2_change; // new in v.101 - static float deco_ppO2; // new in v.101 - - #pragma udata bank6=0x600 -// internal: - static float sim_pres_tissue[32]; - static float sim_pres_tissue_backup[32]; - - //#pragma udata bank7=0x700 - //const unsigned char keep_free_bank7[256]; // used by the assembler code - - #pragma udata bank8=0x800 - static char md_pi_subst[256]; - - #pragma udata bank9a=0x900 -// output: - static char md_state[48]; // DONT MOVE !! // has to be at the beginning of bank 9 for the asm code!!! - #pragma udata bank9b=0x930 -// output: - static unsigned int int_O_DBS_bitfield; // 0x930 new in v.108 - static unsigned int int_O_DBS2_bitfield; // 0x932 new in v.108 - static unsigned int int_O_DBG_pre_bitfield; // 0x934 new in v.108 - static unsigned int int_O_DBG_post_bitfield; // 0x936 new in v.108 - static char char_O_NDL_at_20mtr; // 0x938 new in v.108 // 0xFF == undefined, max. 254 -// internal: - static char md_t; - static char md_buffer[16]; - static char md_cksum[16]; - static char md_i; - static char md_j; - static char md_temp; - static unsigned int md_pointer; - static float deco_N2_ratio; // new in v.101 - static float deco_He_ratio; // new in v.101 - static float calc_N2_ratio; // new in v.101 - static float calc_He_ratio; // new in v.101 - static float deco_gas_change; // new in v.101 - static float CNS_fraction; // new in v.101 - static float float_saturation_multiplier; // new in v.101 - static float float_desaturation_multiplier; // new in v.101 - static float float_deco_distance; // new in v.101 -// internal, dbg: - static unsigned char DBG_char_I_deco_model; // new in v.108 - static unsigned char DBG_char_I_depth_last_deco; // new in v.108 - static float DBG_pres_surface; // new in v.108 - static float DBG_GF_low; // new in v.108 - static float DBG_GF_high; // new in v.108 - static float DBG_const_ppO2; // new in v.108 - static float DBG_deco_ppO2_change; // new in v.108 - static float DBG_deco_ppO2; // new in v.108 - static float DBG_deco_N2_ratio; // new in v.108 - static float DBG_deco_He_ratio; // new in v.108 - static float DBG_deco_gas_change; // new in v.108 - static float DBG_float_saturation_multiplier; // new in v.108 - static float DBG_float_desaturation_multiplier; // new in v.108 - static float DBG_float_deco_distance; // new in v.108 - static float DBG_deco_N2_ratio; // new in v.108 - static float DBG_deco_He_ratio; // new in v.108 - static float DBG_N2_ratio; // new in v.108 - static float DBG_He_ratio; // new in v.108 - static char flag_in_divemode; // new in v.108 - static int int_dbg_i; // new in v.108 - unsigned int temp_DBS; - -// ************************* -// ** P R O T O T Y P E S ** -// ************************* -void main_calc_hauptroutine(void); -void main_calc_without_deco(void); -void main_clear_tissue(void); -void main_calc_percentage(void); -void main_calc_wo_deco_step_1_min(void); -void main_debug(void); -void main_gradient_array(void); -void main_hash(void); - -void calc_hauptroutine(void); -void calc_tissue(void); -void calc_nullzeit(void); -void backup_sim_pres_tissue(void); -void restore_sim_pres_tissue(void); - -void calc_without_deco(void); -void clear_tissue(void); -void calc_ascenttime(void); -void update_startvalues(void); -void clear_decoarray(void); -void update_decoarray(void); -void sim_tissue_1min(void); -void sim_tissue_10min(void); -void calc_gradient_factor(void); -void calc_gradient_array_only(void); -void calc_desaturation_time(void); -void calc_wo_deco_step_1_min(void); -void calc_tissue_step_1_min(void); -void hash(void); -void clear_CNS_fraction(void); -void calc_CNS_fraction(void); -void calc_CNS_decrease_15min(void); -void calc_percentage(void); -void main(void); -void calc_hauptroutine_data_input(void); -void calc_hauptroutine_update_tissues(void); -void calc_hauptroutine_calc_deco(void); -void calc_hauptroutine_calc_ascend_to_deco(void); -void calc_nextdecodepth_GF(void); -void copy_deco_table_GF(void); -void clear_internal_deco_table_GF(void); -void update_internal_deco_table_GF(void); -void push_tissues_to_vault(void); -void pull_tissues_from_vault(void); -void main_push_tissues_to_vault(void); -void main_pull_tissues_from_vault(void); -void wordprocessor(void); - -// ******************************* -// ** start ** -// ** necessary for compilation ** -// ******************************* -#pragma romdata der_code = 0x0000 -#pragma code der_start = 0x0000 -void der_start(void) -{ -_asm - goto main -_endasm -} - -// *********************************** -// ** main code for simulation / ** -// ** tests without assembler code ** -// ** is NOT a part of the OSTC ** -// *********************************** -#pragma code main = 0x9000 -void main(void) -{ - for(wp_temp_U8=0;wp_temp_U8<LENGTH_kf_bank0 - 1;wp_temp_U8++) - keep_free_bank0[wp_temp_U8] = 7; - keep_free_bank0[LENGTH_kf_bank0 - 1] = 7; - - for(wp_temp_U8=0;wp_temp_U8<LENGTH_kf_bank1 - 1;wp_temp_U8++) - keep_free_bank1[wp_temp_U8] = 7; - keep_free_bank1[LENGTH_kf_bank1 - 1] = 7; - -#if 1 -// new main to test DR-5 - -wp_top = 10; -wp_leftx2 = 10; -wp_color1 = 255; -wp_color2 = 255; -wp_font = 0; -wp_invert = 0; -wp_stringstore[0] = ' '; -wp_stringstore[1] = '!'; -wp_stringstore[2] = '"'; -wp_stringstore[3] = ':'; -wp_stringstore[4] = 0; -wordprocessor(); - -GF_low = 1.0; -GF_high = 1.0; - -GF_temp = GF_low * GF_high; - -clear_CNS_fraction(); -//char_I_const_ppO2 = 100; -//for (main_i=0;main_i<255;main_i++) -//{ -//calc_CNS_fraction(); -//} //for - - - - -int_I_pres_respiration = 1000;//980; -int_I_pres_surface = 1000;//980; -char_I_N2_ratio = 39; //38; -char_I_He_ratio = 40; //50; -char_I_deco_distance = 0; // 10 = 1 meter -char_I_depth_last_deco = 3; // values below 3 (meter) are ignored - -char_I_const_ppO2 = 0; -char_I_deco_ppO2_change = 0; // [dm] 10 = 1 meter -char_I_deco_ppO2 = 0; - -char_I_deco_gas_change = 0; // [m] 1 = 1 meter -char_I_deco_N2_ratio = 0; -char_I_deco_He_ratio = 0; - -//char_I_actual_ppO2; // 0x507 -char_I_GF_High_percentage = 100; // 0x514 new in v.102 -char_I_GF_Low_percentage = 100; // 0x515 new in v.102 - -char_I_saturation_multiplier = 110; -char_I_desaturation_multiplier = 90; - -char_I_deco_model = 0; - -main_clear_tissue(); - -int_I_pres_respiration = 1000 + int_I_pres_surface; -main_calc_wo_deco_step_1_min(); -int_I_pres_respiration = 3000 + int_I_pres_surface; -main_calc_wo_deco_step_1_min(); -int_I_pres_respiration = 5000 + int_I_pres_surface; -main_calc_wo_deco_step_1_min(); - -/* -int_I_pres_respiration = 6000 + int_I_pres_surface; -for (main_i=0;main_i<27;main_i++) - main_calc_wo_deco_step_1_min(); -*/ - -char_O_deco_status = 255; -while (char_O_deco_status) - main_calc_hauptroutine(); -_asm -nop -_endasm - -for (main_i=0;main_i<50;main_i++) -{ -main_calc_hauptroutine(); -} -int_I_pres_respiration = 10000; -for (main_i=0;main_i<1500;main_i++) -{ -main_calc_hauptroutine(); -} - -_asm -nop -_endasm - - -int_I_pres_respiration = 3000; -for (main_i=0;main_i<150;main_i++) -{ - calc_hauptroutine_data_input(); - calc_hauptroutine_update_tissues(); -} //for - - update_startvalues(); - clear_decoarray(); - clear_internal_deco_table_GF(); - calc_hauptroutine_calc_ascend_to_deco(); - if (char_O_deco_status > 15) // can't go up to first deco, too deep to calculate in the given time slot - { - char_O_deco_status = 2; -// char_O_lock_depth_list = 255; - } - else - { -// char_O_lock_depth_list = lock_GF_depth_list; - calc_hauptroutine_calc_deco(); - } -// build_debug_output(); - -_asm -nop -_endasm -while (char_O_deco_status == 1) -{ - char_O_deco_status = 0; -// char_O_lock_depth_list = 255; - calc_hauptroutine_calc_deco(); -// build_debug_output(); -_asm -nop -_endasm -}; -debug_temp = 60; // [mtr Aufstieg in 10 mtr/min (30steps'2sec/min] -int_I_pres_respiration = 9980; -for (main_i=0;main_i<debug_temp;main_i++) -{ -int_I_pres_respiration = int_I_pres_respiration - 33; - calc_hauptroutine_data_input(); - calc_hauptroutine_update_tissues(); -int_I_pres_respiration = int_I_pres_respiration - 33; - calc_hauptroutine_data_input(); - calc_hauptroutine_update_tissues(); -int_I_pres_respiration = int_I_pres_respiration - 34; - calc_hauptroutine_data_input(); - calc_hauptroutine_update_tissues(); -} //for -_asm -nop -_endasm - - update_startvalues(); - clear_decoarray(); - clear_internal_deco_table_GF(); - calc_hauptroutine_calc_ascend_to_deco(); - if (char_O_deco_status > 15) // can't go up to first deco, too deep to calculate in the given time slot - { - char_O_deco_status = 2; -// char_O_lock_depth_list = 255; - } - else - { -// char_O_lock_depth_list = lock_GF_depth_list; - calc_hauptroutine_calc_deco(); - } -// build_debug_output(); - -_asm -nop -_endasm -while (char_O_deco_status == 1) -{ - char_O_deco_status = 0; -// char_O_lock_depth_list = 255; - calc_hauptroutine_calc_deco(); -// build_debug_output(); -_asm -nop -_endasm -}; -_asm -nop -_endasm -debug_temp = 60; // [mtr Aufstieg in 10 mtr/min (30steps'2sec/min] -int_I_pres_respiration = 9980; -debug_temp = debug_temp * 3; -for (main_i=0;main_i<debug_temp;main_i++) -{ - calc_hauptroutine_data_input(); - calc_hauptroutine_update_tissues(); -} //for -_asm -nop -_endasm -#endif -// ----------------------- - -} // main - -// ****************************************************** -// ****************************************************** -// ** THE FOLLOWING CODE HAS TO BE COPPIED TO THE OSTC ** -// ****************************************************** -// ****************************************************** - -// *************** -// *************** -// ** THE FONTS ** -// *************** -// *************** -// all new for bigscreen - -// a bit is left (C4) -#pragma romdata font_data_small = 0x0A0C4 -rom const rom U16 wp_small_data[] = -{ -#include "ostc28.drx.txt" -}; - -#pragma romdata font_table_small = 0x0B548 -rom const rom U16 wp_small_table[] = -{ -#include "ostc28.tbl.txt" // length 0xEC -}; - -#pragma romdata font_table_medium = 0x0B632 -rom const rom U16 wp_medium_table[] = -{ -#include "ostc48.tbl.txt" // length 0x22 -}; - -#pragma romdata font_data_medium = 0x0B656 -rom const rom U16 wp_medium_data[] = -{ -#include "ostc48.drx.txt" // length 0x390 -}; - -#pragma romdata font_data_large = 0x0BA46 -rom const rom U16 wp_large_data[] = -{ -#include "ostc90.drx.txt" -}; - -#pragma romdata font_table_large = 0x0BFE6 -rom const rom U16 wp_large_table[] = -{ -#include "ostc90.tbl.txt" -}; - -// *********************** -// *********************** -// ** THE SUBROUTINES 2 ** -// *********************** -// *********************** -// all new in v.102 -// moved from 0x0D000 to 0x0C000 in v.108 - -#pragma code subroutines2 = 0x0C000 // can be adapted to fit the romdata tables ahead - -// ------------------------------- -// DBS - debug on start of dive // -// ------------------------------- -void create_dbs_set_dbg_and_ndl20mtr(void) -{ - int_O_DBS_bitfield = 0; - int_O_DBS2_bitfield = 0; - if(int_O_DBG_pre_bitfield & DBG_RUN) - int_O_DBG_pre_bitfield = DBG_RESTART; - else - int_O_DBG_pre_bitfield = DBG_RUN; - int_O_DBG_post_bitfield = 0; - char_O_NDL_at_20mtr = 255; - - DBG_N2_ratio = N2_ratio; - DBG_He_ratio = He_ratio; - DBG_char_I_deco_model = char_I_deco_model; - DBG_char_I_depth_last_deco = char_I_depth_last_deco; - DBG_pres_surface = pres_surface; - DBG_GF_low = GF_low; - DBG_GF_high = GF_high; - DBG_const_ppO2 = const_ppO2; - DBG_deco_ppO2_change = deco_ppO2_change; - DBG_deco_ppO2 = deco_ppO2; - DBG_deco_N2_ratio = deco_N2_ratio; - DBG_deco_He_ratio = deco_He_ratio; - DBG_deco_gas_change = deco_gas_change; - DBG_float_saturation_multiplier = float_saturation_multiplier; - DBG_float_desaturation_multiplier = float_desaturation_multiplier; - DBG_float_deco_distance = float_deco_distance; - - if(char_I_deco_model) - int_O_DBS_bitfield |= DBS_mode; - if(const_ppO2) - int_O_DBS_bitfield |= DBS_ppO2; - for(int_dbg_i = 16; int_dbg_i < 32; int_dbg_i++) - if(pres_tissue[int_dbg_i]) - int_O_DBS_bitfield |= DBS_HE_sat; - if(deco_ppO2_change) - int_O_DBS_bitfield |= DBS_ppO2chg; - if(float_saturation_multiplier < 0.99) - int_O_DBS_bitfield |= DBS_SAT2l; - if(float_saturation_multiplier > 1.3) - int_O_DBS_bitfield |= DBS_SAT2h; - if(GF_low < 0.19) - int_O_DBS_bitfield |= DBS_GFLOW2l; - if(GF_low > 1.01) - int_O_DBS_bitfield |= DBS_GFLOW2h; - if(GF_high < 0.6) - int_O_DBS_bitfield |= DBS_GFHGH2l; - if(GF_high > 1.01) - int_O_DBS_bitfield |= DBS_GFHGH2h; - if((N2_ratio + He_ratio) > 0.95) - int_O_DBS_bitfield |= DBS_GASO22l; - if((N2_ratio + He_ratio) < 0.05) - int_O_DBS_bitfield |= DBS_GASO22h; - if(float_deco_distance > 0.25) - int_O_DBS_bitfield |= DBS_DIST2h; - if(char_I_depth_last_deco > 8) - int_O_DBS_bitfield |= DBS_LAST2h; - if(DBG_deco_gas_change && ((deco_N2_ratio + deco_He_ratio) > 0.95)) - int_O_DBS_bitfield |= DBS_DECOO2l; - if(DBG_deco_gas_change && ((deco_N2_ratio + deco_He_ratio) < 0.05)) - int_O_DBS_bitfield |= DBS_DECOO2h; - if(pres_respiration > 3.0) - int_O_DBS2_bitfield |= DBS2_PRES2h; - if(pres_surface - pres_respiration > 0.2) - int_O_DBS2_bitfield |= DBS2_PRES2l; - if(pres_surface < 0.75) - int_O_DBS2_bitfield |= DBS2_SURF2l; - if(pres_surface > 1.11) - int_O_DBS2_bitfield |= DBS2_SURF2h; - if(float_desaturation_multiplier < 0.70) - int_O_DBS2_bitfield |= DBS2_DESAT2l; - if(float_desaturation_multiplier > 1.01) - int_O_DBS2_bitfield |= DBS2_DESAT2h; - if(GF_low > GF_high) - int_O_DBS2_bitfield |= DBS2_GFDneg; -} - -// ------------------------------- -// DBG - set DBG to end_of_dive // -// ------------------------------- -void set_dbg_end_of_dive(void) -{ - int_O_DBG_pre_bitfield &= (~DBG_RUN); - int_O_DBG_post_bitfield &= (~DBG_RUN); -} - -// ------------------------------- -// DBG - NDL at first 20 m. hit // -// ------------------------------- -void check_ndl(void) -{ - if((char_O_NDL_at_20mtr == -1) && (int_I_pres_respiration > 3000)) - { - char_O_NDL_at_20mtr = char_O_nullzeit; - if(char_O_NDL_at_20mtr == 255) - char_O_NDL_at_20mtr == 254; - } -} - -// ------------------------------- -// DBG - multi main during dive // -// ------------------------------- -void check_dbg(char is_post_check) -{ - temp_DBS = 0; - if( (DBG_N2_ratio != N2_ratio) || (DBG_He_ratio != He_ratio) ) - temp_DBS |= DBG_c_gas; - if(DBG_const_ppO2 != const_ppO2) - temp_DBS |= DBG_c_ppO2; - if((DBG_float_saturation_multiplier != float_saturation_multiplier) || (DBG_float_desaturation_multiplier != float_desaturation_multiplier)) - temp_DBS |= DBG_CdeSAT; - if(DBG_char_I_deco_model != char_I_deco_model) - temp_DBS |= DBG_C_MODE; - if(DBG_pres_surface != pres_surface) - temp_DBS |= DBG_C_SURF; - if((!DBS_HE_sat) && (!He_ratio)) - for(int_dbg_i = 16; int_dbg_i < 32; int_dbg_i++) - if(pres_tissue[int_dbg_i]) - temp_DBS |= DBG_HEwoHE; - if(DBG_deco_ppO2 != deco_ppO2) - temp_DBS |= DBG_C_DPPO2; - if((DBG_deco_gas_change != deco_gas_change) || (DBG_deco_N2_ratio != deco_N2_ratio) || (DBG_deco_He_ratio != deco_He_ratio)) - temp_DBS |= DBG_C_DGAS; - if(DBG_float_deco_distance != float_deco_distance) - temp_DBS |= DBG_C_DIST; - if(DBG_char_I_depth_last_deco != char_I_depth_last_deco) - temp_DBS |= DBG_C_LAST; - if((DBG_GF_low != GF_low) || (DBG_GF_high != GF_high)) - temp_DBS |= DBG_C_GF; - if(pres_respiration > 13.0) - temp_DBS |= DBG_PHIGH; - if(pres_surface - pres_respiration > 0.2) - temp_DBS |= DBG_PLOW; -/* - if() - temp_DBS |= ; - if() - temp_DBS |= ; - */ - if(is_post_check) - int_O_DBG_post_bitfield |= temp_DBS; - else - int_O_DBG_pre_bitfield |= temp_DBS; -} - -// ------------------------------- -// DBG - prior to calc. of dive // -// ------------------------------- -void check_pre_dbg(void) -{ - check_dbg(0); -} - -// ------------------------------- -// DBG - after decocalc of dive // -// ------------------------------- -void check_post_dbg(void) -{ - check_dbg(1); -} - - - -// ------------------------- -// calc_next_decodepth_GF // -// ------------------------- -// new in v.102 -void calc_nextdecodepth_GF(void) -{ -// INPUT, changing during dive: -// temp_pres_gtissue_limit_GF_low -// temp_pres_gtissue_limit_GF_low_below_surface -// temp_pres_gtissue -// temp_pres_gtissue_diff -// lock_GF_depth_list - -// INPUT, fixed during dive: -// pres_surface -// GF_delta -// GF_high -// GF_low -// temp_depth_last_deco -// float_deco_distance - -// OUTPUT -// GF_step -// temp_deco -// temp_depth_limt -// lock_GF_depth_list - -// USES -// temp1 -// temp2 -// int_temp - - char_I_table_deco_done[0] = 0; // safety if changed somewhere else. Needed for exit - if (char_I_deco_model == 1) - { - if (lock_GF_depth_list == 0) - { - temp2 = temp_pres_gtissue_limit_GF_low_below_surface / 0.29985; // = ... / 99.95 / 0.003; - int_temp = (int) (temp2 + 0.99); - if (int_temp > 31) - int_temp = 31; // deepest deco at 93 meter (31 deco stops) - if (int_temp < 0) - int_temp = 0; - temp_depth_GF_low_number = int_temp; - temp_depth_GF_low_meter = 3 * temp_depth_GF_low_number; - temp2 = (float)temp_depth_GF_low_meter * 0.09995; - temp_pres_deco_GF_low = temp2 + float_deco_distance + pres_surface; - if (temp_depth_GF_low_number == 0) - GF_step = 0; - else - GF_step = GF_delta / (float)temp_depth_GF_low_number; - if (GF_step < 0) - GF_step = 0; - if (GF_step > GF_delta) - GF_step = GF_delta; - int_O_GF_step = (int)(GF_step * 10000); - int_O_limit_GF_low = (int)(temp_pres_deco_GF_low * 1000); - int_O_gtissue_press_at_GF_low = (int)(temp_pres_gtissue * 1000); - char_O_GF_low_pointer = temp_depth_GF_low_number; - lock_GF_depth_list = 1; - internal_deco_pointer = 0; - } - if (internal_deco_pointer == 0) // new run - { - internal_deco_pointer = temp_depth_GF_low_number; - GF_temp = GF_high - ((float)internal_deco_pointer * GF_step); - int_temp = char_I_table_deco_done[internal_deco_pointer]; - output[8] = int_temp; - output[9] = 33; - } - else - { - int_temp = 1; - } - while (int_temp == 1) - { - int_temp = internal_deco_pointer - 1; - if (int_temp == 1) // new in v104 - { - temp2 = (float)(temp_depth_last_deco * int_temp) * 0.09995; - GF_step2 = GF_step/3.0 * ((float)(6 - temp_depth_last_deco)); - } - else - if (int_temp == 0) - { - temp2 = 0.0; - GF_step2 = GF_high - GF_temp; - } - else - { - temp2 = (float)(3 *int_temp) * 0.09995; - GF_step2 = GF_step; - } - temp2 = temp2 + pres_surface; // next deco stop to be tested - temp1 = ((GF_temp + GF_step2)* temp_pres_gtissue_diff) + temp_pres_gtissue; // upper limit (lowest pressure allowed) // changes GF_step2 in v104 - if (temp1 > temp2) // check if ascent to next deco stop is ok - { - int_temp = 0; // no - } - else - { - internal_deco_pointer = int_temp; - GF_temp = GF_temp + GF_step2; // changed in v104 - int_temp = char_I_table_deco_done[internal_deco_pointer]; // yes and check for ascent to even next stop if deco_done is set - } - } // while - if (internal_deco_pointer > 0) - { - temp2 = (float)(0.29985 * internal_deco_pointer); - temp_deco = temp2 + float_deco_distance + pres_surface; - if (internal_deco_pointer == 1) // new in v104 - temp_depth_limit = temp_depth_last_deco; - else - temp_depth_limit = 3 * internal_deco_pointer; - if (output[9] == 33) - { - output[9] = internal_deco_pointer; - output[10] = char_I_table_deco_done[internal_deco_pointer]; - output[12] = output[12] + 1; - if (output[12] == 100) - output[12] = 0; - } - } - else // if (char_I_deco_model == 1) - { - temp_deco = pres_surface; - temp_depth_limit = 0; - } - } - else - { - // calc_nextdecodepth - original - // optimized in v.101 - // depth_last_deco included in v.101 - - temp1 = temp_pres_gtissue_limit - pres_surface; - if (temp1 >= 0) - { - temp1 = temp1 / 0.29985; // = temp1 / 99.95 / 0.003; - temp_depth_limit = (int) (temp1 + 0.99); - temp_depth_limit = 3 * temp_depth_limit; // depth for deco [m] - if (temp_depth_limit == 0) - temp_deco = pres_surface; - else - { - if (temp_depth_limit < temp_depth_last_deco) - temp_depth_limit = temp_depth_last_deco; - temp1 = (float)temp_depth_limit * 0.09995; - temp_deco = temp1 + float_deco_distance + pres_surface; // depth for deco [bar] - } // if (temp_depth_limit == 0) - } // if (temp1 >= 0) - else - { - temp_deco = pres_surface; - temp_depth_limit = 0; - } // if (temp1 >= 0) - } // calc_nextdecodepth original -} // calc_nextdecodepth_GF - - -#if 0 -void build_debug_output(void) -{ -output[0] = 0; // not used in asm PLED output -output[1] = (int) (GF_low * 100); -output[2] = (int) (GF_high * 100); -output[3] = (int) (GF_step * 100); -output[4] = (int) temp_depth_GF_low_number; -output[5] = (int) temp_depth_GF_low_meter; -//output[6] -output[7] = (int) internal_deco_pointer; -//output[8] = char_I_table_deco_done[temp_depth_GF_low_number] -//output[9] = internal_deco_pointer @ new run -//output[10] = char_I_table_deco_done[internal_deco_pointer] @ new run -output [11] = (int) (temp_pres_deco_GF_low * 10); -} // build_debug_output -#endif - -// --------------------- -// copy_deco_table_GF // -// --------------------- -// new in v.102 -void copy_deco_table_GF(void) -{ - if (char_I_deco_model == 1) - { - int_temp = 32; - for (ci=0;ci<int_temp;ci++) - char_O_deco_table[ci] = internal_deco_table[ci]; - } -} // copy_deco_table_GF - - -// ------------------------------ -// clear_internal_deco_table_GF// -// ------------------------------ -// new in v.102 -void clear_internal_deco_table_GF(void) -{ - if (char_I_deco_model == 1) - { - for (ci=0;ci<32;ci++) // cycle through the 16 b"uhlmann tissues for Helium - { - internal_deco_table[ci] = 0; - } - } -} // clear_internal_deco_table_GF - - -// -------------------------------- -// update_internal_deco_table_GF // -// -------------------------------- -// new in v.102 -void update_internal_deco_table_GF(void) -{ - if ((char_I_deco_model == 1) && (internal_deco_table[internal_deco_pointer] < 255)) - internal_deco_table[internal_deco_pointer] = internal_deco_table[internal_deco_pointer] + 1; -} // update_internal_deco_table_GF - - -// --------------------- -// temp_tissue_safety // -// --------------------- -// outsourced in v.102 -void temp_tissue_safety(void) -{ - if (char_I_deco_model == 1) - { - } - else - { - if (temp_tissue < 0.0) - temp_tissue = temp_tissue * float_desaturation_multiplier; - else - temp_tissue = temp_tissue * float_saturation_multiplier; - } -} // temp_tissue_safety - - -// ********************** -// ********************** -// ** THE JUMP-IN CODE ** -// ** for the asm code ** -// ********************** -// ********************** -#pragma code main_calc_hauptroutine = 0x10000 -void main_calc_hauptroutine(void) -{ -calc_hauptroutine(); -int_O_desaturation_time = 65535; -} // divemode -#pragma code main_without_deco = 0x10020 -void main_calc_without_deco(void) -{ -calc_without_deco(); -calc_desaturation_time(); -} - -#pragma code main_clear_CNS_fraction = 0x10030 -void main_clear_CNS_fraction(void) -{ -clear_CNS_fraction(); -} - -#pragma code main_calc_CNS_decrease_15min = 0x10034 -void main_calc_CNS_decrease_15min(void) -{ -calc_CNS_decrease_15min(); -} - -#pragma code main_calc_percentage = 0x10038 -void main_calc_percentage (void) -{ -calc_percentage(); -} - -#pragma code main_clear_tissue = 0x10040 -void main_clear_tissue(void) -{ -clear_tissue(); -char_I_depth_last_deco = 0; // for compatibility with v.101pre_no_last_deco -} - -#pragma code main_calc_CNS_fraction = 0x10050 -void main_calc_CNS_fraction(void) -{ -calc_CNS_fraction(); -} - -#pragma code main_calc_desaturation_time = 0x10060 -void main_calc_desaturation_time(void) -{ -calc_desaturation_time(); -} - -#pragma code main_calc_wo_deco_step_1_min = 0x10080 -void main_calc_wo_deco_step_1_min(void) -{ -calc_wo_deco_step_1_min(); -char_O_deco_status = 3; // surface new in v.102 overwrites value of calc_wo_deco_step_1_min -calc_desaturation_time(); -} // surface mode - -#pragma code main_debug = 0x100A0 -void main_debug(void) -{ -//debug(); -} - -#pragma code main_DD2_write_incon42 = 0x100B0 -void main_DD2_write_incon42(void) -{ - return; -} - -#pragma code main_DD2_write_incon24 = 0x100B4 -void main_DD2_write_incon24(void) -{ - return; -} - -#pragma code main_wordprocessor = 0x100B8 -void main_wordprocessor(void) -{ - wordprocessor(); -} - -#pragma code main_gradient_array = 0x100C0 -void main_gradient_array(void) -{ -calc_gradient_array_only(); -} -#pragma code main_push_tissues = 0x100C4 -void main_push_tissues_to_vault(void) -{ - push_tissues_to_vault(); -} -#pragma code main_pull_tissues = 0x100C8 -void main_pull_tissues_from_vault(void) -{ - pull_tissues_from_vault(); -} - -#pragma code main_hash = 0x100E0 -void main_hash(void) -{ -hash(); -} - -// *********************** -// *********************** -// ** THE LOOKUP TABLES ** -// *********************** -// *********************** - -#pragma romdata tables = 0x10200 -#include <p2_tables.romdata> // new table for deco_main_v.101 (var_a modified) - -#pragma romdata tables2 = 0x10600 -rom const rom unsigned int md_pi[] = -{ - 0x292E, 0x43C9, 0xA2D8, 0x7C01, 0x3D36, 0x54A1, 0xECF0, 0x0613 - , 0x62A7, 0x05F3, 0xC0C7, 0x738C, 0x9893, 0x2BD9, 0xBC4C, 0x82CA - , 0x1E9B, 0x573C, 0xFDD4, 0xE016, 0x6742, 0x6F18, 0x8A17, 0xE512 - , 0xBE4E, 0xC4D6, 0xDA9E, 0xDE49, 0xA0FB, 0xF58E, 0xBB2F, 0xEE7A - , 0xA968, 0x7991, 0x15B2, 0x073F, 0x94C2, 0x1089, 0x0B22, 0x5F21 - , 0x807F, 0x5D9A, 0x5A90, 0x3227, 0x353E, 0xCCE7, 0xBFF7, 0x9703 - , 0xFF19, 0x30B3, 0x48A5, 0xB5D1, 0xD75E, 0x922A, 0xAC56, 0xAAC6 - , 0x4FB8, 0x38D2, 0x96A4, 0x7DB6, 0x76FC, 0x6BE2, 0x9C74, 0x04F1 - , 0x459D, 0x7059, 0x6471, 0x8720, 0x865B, 0xCF65, 0xE62D, 0xA802 - , 0x1B60, 0x25AD, 0xAEB0, 0xB9F6, 0x1C46, 0x6169, 0x3440, 0x7E0F - , 0x5547, 0xA323, 0xDD51, 0xAF3A, 0xC35C, 0xF9CE, 0xBAC5, 0xEA26 - , 0x2C53, 0x0D6E, 0x8528, 0x8409, 0xD3DF, 0xCDF4, 0x4181, 0x4D52 - , 0x6ADC, 0x37C8, 0x6CC1, 0xABFA, 0x24E1, 0x7B08, 0x0CBD, 0xB14A - , 0x7888, 0x958B, 0xE363, 0xE86D, 0xE9CB, 0xD5FE, 0x3B00, 0x1D39 - , 0xF2EF, 0xB70E, 0x6658, 0xD0E4, 0xA677, 0x72F8, 0xEB75, 0x4B0A - , 0x3144, 0x50B4, 0x8FED, 0x1F1A, 0xDB99, 0x8D33, 0x9F11, 0x8314 -}; - -// ********************* -// ********************* -// ** THE SUBROUTINES ** -// ********************* -// ********************* - -#pragma code subroutines = 0x10700 // can be adapted to fit the romdata tables ahead - - -// --------------- -// CLEAR tissue // -// --------------- -// optimized in v.101 (var_a) - -void clear_tissue(void) // preload tissues with standard pressure for the given ambient pressure -{ - - flag_in_divemode = 0; - int_O_DBS_bitfield = 0; - int_O_DBS2_bitfield = 0; - int_O_DBG_pre_bitfield = 0; - int_O_DBG_post_bitfield = 0; - char_O_NDL_at_20mtr = 255; - -_asm -lfsr 1, 0x300 // C math routines shall use this variable bank -movlw 0x01 -movwf TBLPTRU,0 -_endasm - -// N2_ratio = (float)char_I_N2_ratio; // the 0.0002 of 0.7902 are missing with standard air - N2_ratio = 0.7902; // N2_ratio / 100.0; - pres_respiration = (float)int_I_pres_respiration / 1000.0; -for (ci=0;ci<16;ci++) // cycle through the 16 b"uhlmann tissues -{ - pres_tissue[ci] = N2_ratio * (pres_respiration - 0.0627) ; -_asm -movlw 0x02 -movwf TBLPTRH,0 -movlb 4 // fuer ci -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addlw 0x80 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_a+1 -TBLRDPOSTINC -movff TABLAT,var_a -TBLRDPOSTINC -movff TABLAT,var_a+3 -TBLRD -movff TABLAT,var_a+2 -addlw 0x80 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_b+1 -TBLRDPOSTINC -movff TABLAT,var_b -TBLRDPOSTINC -movff TABLAT,var_b+3 -TBLRD -movff TABLAT,var_b+2 -_endasm - -pres_tissue_limit[ci] = (pres_tissue[ci] - var_a) * var_b ; -// now update the guiding tissue -if (pres_tissue_limit[ci] < 0) -pres_tissue_limit[ci] = 0; -} // for 0 to 16 - -for (ci=16;ci<32;ci++) // cycle through the 16 b"uhlmann tissues for Helium -{ - pres_tissue[ci] = 0.0; -} // for - - clear_decoarray(); - char_O_deco_status = 0; - char_O_nullzeit = 0; - char_O_ascenttime = 0; - char_O_gradient_factor = 0; - char_O_relative_gradient_GF = 0; -} // clear_tissue(void) - - -// -------------------- -// calc_without_deco // -// fixed N2_ratio ! // -// -------------------- -// optimized in v.101 (float_..saturation_multiplier) - -void calc_without_deco(void) -{ -_asm - lfsr 1, 0x300 -_endasm - N2_ratio = 0.7902; // FIXED RATIO !! sum as stated in b"uhlmann - pres_respiration = (float)int_I_pres_respiration / 1000.0; // assembler code uses different digit system - pres_surface = (float)int_I_pres_surface / 1000.0; - temp_atem = N2_ratio * (pres_respiration - 0.0627); // 0.0627 is the extra pressure in the body - temp2_atem = 0.0; - temp_surface = pres_surface; // the b"uhlmann formula using temp_surface does apply to the pressure without any inert ratio - float_desaturation_multiplier = char_I_desaturation_multiplier / 100.0; - float_saturation_multiplier = char_I_saturation_multiplier / 100.0; - - calc_tissue(); // update the pressure in the 16 tissues in accordance with the new ambient pressure - - clear_decoarray(); - char_O_deco_status = 0; - char_O_nullzeit = 0; - char_O_ascenttime = 0; - calc_gradient_factor(); - -} // calc_without_deco - - -// -------------------- -// calc_hauptroutine // -// -------------------- -// this is the major code in dive mode -// calculates: -// the tissues, -// the bottom time -// and simulates the ascend with all deco stops - -void calc_hauptroutine(void) -{ - calc_hauptroutine_data_input(); - - if(!flag_in_divemode) - { - flag_in_divemode = 1; - create_dbs_set_dbg_and_ndl20mtr(); - } - else - check_pre_dbg(); - - calc_hauptroutine_update_tissues(); - calc_gradient_factor(); - - - switch (char_O_deco_status) // toggle between calculation for nullzeit (bottom time), deco stops and more deco stops (continue) - { - case 0: - update_startvalues(); - calc_nullzeit(); - check_ndl(); - char_O_deco_status = 255; // calc deco next time - break; - case 1: - if (char_O_deco_status == 3) - break; - char_O_deco_status = 0; -// char_O_lock_depth_list = 255; - calc_hauptroutine_calc_deco(); -// build_debug_output(); - break; - case 3: // new dive - clear_decoarray(); - clear_internal_deco_table_GF(); - copy_deco_table_GF(); - internal_deco_pointer = 0; - lock_GF_depth_list = 0; - update_startvalues(); - calc_nextdecodepth_GF(); - char_O_deco_status = 0; - break; - default: - update_startvalues(); - clear_decoarray(); - clear_internal_deco_table_GF(); - output[6] = 1; - calc_hauptroutine_calc_ascend_to_deco(); - if (char_O_deco_status > 15) // can't go up to first deco, too deep to calculate in the given time slot - { - char_O_deco_status = 2; -// char_O_lock_depth_list = 255; - } - else - { -// char_O_lock_depth_list = lock_GF_depth_list; - calc_hauptroutine_calc_deco(); - } -// build_debug_output(); - break; - } - calc_ascenttime(); - check_post_dbg(); -} - -void calc_hauptroutine_data_input(void) -{ - pres_respiration = (float)int_I_pres_respiration / 1000.0; - pres_surface = (float)int_I_pres_surface / 1000.0; - - N2_ratio = (float)char_I_N2_ratio / 100.0;; // the 0.0002 of 0.7902 are missing with standard air - He_ratio = (float)char_I_He_ratio / 100.0;; - deco_N2_ratio = (float)char_I_deco_N2_ratio / 100.0; - deco_He_ratio = (float)char_I_deco_He_ratio / 100.0; - float_deco_distance = (float)char_I_deco_distance / 100.0; - if(char_I_deco_gas_change) - { - deco_gas_change = (float)char_I_deco_gas_change / 9.995 + pres_surface; - deco_gas_change = deco_gas_change + float_deco_distance; - } - else - deco_gas_change = 0; - const_ppO2 = (float)char_I_const_ppO2 / 100.0; - deco_ppO2_change = (float)char_I_deco_ppO2_change / 99.95 + pres_surface; - deco_ppO2_change = deco_ppO2_change + float_deco_distance; - deco_ppO2 = (float)char_I_deco_ppO2 / 100.0; - float_desaturation_multiplier = char_I_desaturation_multiplier / 100.0; - float_saturation_multiplier = char_I_saturation_multiplier / 100.0; - GF_low = (float)char_I_GF_Low_percentage / 100.0; - GF_high = (float)char_I_GF_High_percentage / 100.0; - GF_delta = GF_high - GF_low; - - temp2 = (pres_respiration - pres_surface) / 0.29985; - int_temp = (int)(temp2); - if (int_temp < 0) - int_temp = 0; - if (int_temp > 255) - int_temp = 255; - char_O_actual_pointer = int_temp; - - temp_depth_last_deco = (int)char_I_depth_last_deco; -} - -void calc_hauptroutine_update_tissues(void) -{ - int_O_calc_tissue_call_counter = int_O_calc_tissue_call_counter + 1; - if (char_I_const_ppO2 == 0) // new in v.101 - pres_diluent = pres_respiration; // new in v.101 - else // new in v.101 - pres_diluent = ((pres_respiration - const_ppO2)/(N2_ratio + He_ratio)); // new in v.101 - if (pres_diluent > pres_respiration) // new in v.101 - pres_diluent = pres_respiration; // new in v.101 - if (pres_diluent > 0.0627) // new in v.101 - { - temp_atem = N2_ratio * (pres_diluent - 0.0627); // changed in v.101 - temp2_atem = He_ratio * (pres_diluent - 0.0627); // changed in v.101 - char_O_diluent = (char)(pres_diluent/pres_respiration*100.0); - } - else // new in v.101 - { - temp_atem = 0.0; // new in v.101 - temp2_atem = 0.0; // new in v.101 - char_O_diluent = 0; - } - temp_surface = pres_surface; - calc_tissue(); - int_O_gtissue_limit = (int)(pres_tissue_limit[char_O_gtissue_no] * 1000); - int_O_gtissue_press = (int)((pres_tissue[char_O_gtissue_no] + pres_tissue[char_O_gtissue_no+16]) * 1000); - if (char_I_deco_model == 1) - { - temp1 = temp1 * GF_high; - } - else - { - temp1 = temp_surface; - } - if (pres_gtissue_limit > temp1 && char_O_deco_status == 0) // if guiding tissue can not be exposed to surface pressure immediately - { - char_O_nullzeit = 0; // deco necessary - char_O_deco_status = 255; // calculate deco skip nullzeit calculation - } -} // calc_hauptroutine_update_tissues -void calc_hauptroutine_calc_deco(void) -{ - do - { - int_temp_decostatus = 0; - calc_nextdecodepth_GF(); - if (temp_depth_limit > 0) - { - if (char_I_const_ppO2 == 0) // new in v.101 - { - deco_diluent = temp_deco; // new in v.101 - if (temp_deco > deco_gas_change) - { - calc_N2_ratio = N2_ratio; - calc_He_ratio = He_ratio; - } - else - { - calc_N2_ratio = deco_N2_ratio; - calc_He_ratio = deco_He_ratio; - } - } - else // new in v.101 - { - calc_N2_ratio = N2_ratio; - calc_He_ratio = He_ratio; - if (temp_deco > deco_ppO2_change) - { - deco_diluent = ((temp_deco - const_ppO2)/(N2_ratio + He_ratio)); // new in v.101 - } - else - { - deco_diluent = ((temp_deco - deco_ppO2)/(N2_ratio + He_ratio)); // new in v.101 - } - } - if (deco_diluent > temp_deco) // new in v.101 - deco_diluent = temp_deco; // new in v.101 - if (deco_diluent > 0.0627) // new in v.101 - { - temp_atem = calc_N2_ratio * (deco_diluent - 0.0627); // changed in v.101 - temp2_atem = calc_He_ratio * (deco_diluent - 0.0627); // changed in v.101 - } - else // new in v.101 - { - temp_atem = 0.0; // new in v.101 - temp2_atem = 0.0; // new in v.101 - } - sim_tissue_1min(); - update_internal_deco_table_GF(); - temp_decotime = 1; - update_decoarray(); - char_O_deco_status = char_O_deco_status + 1; - if (char_O_deco_status < 16) - int_temp_decostatus = 1; - } - else // if (temp_depth_limit > 0) - { - char_O_deco_status = 0; - } - } while (int_temp_decostatus == 1); - if (char_O_deco_status > 15) - { - char_O_deco_status = 1; - } - else - { - copy_deco_table_GF(); - char_O_deco_status = 0; - } -} - -void calc_hauptroutine_calc_ascend_to_deco(void) -{ - update_startvalues(); - char_O_deco_status = 0; - temp_deco = pres_respiration; - lock_GF_depth_list = 1; // new in v.102 - do // go up to first deco - { - int_temp_decostatus = 0; - temp_deco = temp_deco - 1.0; - if ( char_I_deco_model == 1) // new in v.102 , 4 = deep stops - temp_limit = temp_pres_gtissue_limit_GF_low; - else - temp_limit = temp_pres_gtissue_limit; - if ((temp_deco > temp_limit) && (temp_deco > pres_surface)) // changes in v.102 - { - lock_GF_depth_list = 0; // new in v.102, distance to first stop > 10 mtr. - output[6] = 0; - if (char_I_const_ppO2 == 0) // new in v.101 // calculate at half of the ascent - { - deco_diluent = temp_deco + 0.5; // new in v.101 - if (temp_deco + 0.5 > deco_gas_change) - { - calc_N2_ratio = N2_ratio; - calc_He_ratio = He_ratio; - } - else - { - calc_N2_ratio = deco_N2_ratio; - calc_He_ratio = deco_He_ratio; - } - } - else // new in v.101 - { - calc_N2_ratio = N2_ratio; - calc_He_ratio = He_ratio; - if (temp_deco + 0.5 > deco_ppO2_change) - deco_diluent = ((temp_deco + 0.5 - const_ppO2)/(N2_ratio + He_ratio)); // new in v.101 // calculate at half of the ascent - else - deco_diluent = ((temp_deco + 0.5 - deco_ppO2)/(N2_ratio + He_ratio)); // new in v.101 // calculate at half of the ascent - if (deco_diluent > (temp_deco +0.5)) // new in v.101 - deco_diluent = temp_deco + 0.5; // new in v.101 // calculate at half of the ascent - } - if (deco_diluent > 0.0627) // new in v.101 - { - temp_atem = calc_N2_ratio * (deco_diluent - 0.0627); // changed in v.101 - temp2_atem = calc_He_ratio * (deco_diluent - 0.0627); // changed in v.101 - } - else // new in v.101 - { - temp_atem = 0.0; // new in v.101 - temp2_atem = 0.0; // new in v.101 - } - sim_tissue_1min(); - char_O_deco_status = char_O_deco_status + 1; - if (char_O_deco_status < 16) // 16 is the limit of calculations for one time slot - int_temp_decostatus = 1; - } - } while (int_temp_decostatus == 1); -} // calc_hauptroutine_calc_ascend_to_deco - -// -------------- -// calc_tissue // -// -------------- -// optimized in v.101 - -void calc_tissue(void) -{ -_asm -lfsr 1, 0x300 -movlw 0x01 -movwf TBLPTRU,0 -_endasm - - char_O_gtissue_no = 255; - pres_gtissue_limit = 0.0; - -for (ci=0;ci<16;ci++) -{ -_asm -movlw 0x02 -movwf TBLPTRH,0 -movlb 4 // fuer ci -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_e2secs+1 // the order is confussing -TBLRDPOSTINC -movff TABLAT,var_e2secs // low byte first, high afterwards -TBLRDPOSTINC -movff TABLAT,var_e2secs+3 -TBLRD -movff TABLAT,var_e2secs+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_e2secs+1 -TBLRDPOSTINC -movff TABLAT,var2_e2secs -TBLRDPOSTINC -movff TABLAT,var2_e2secs+3 -TBLRD -movff TABLAT,var2_e2secs+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_a+1 -TBLRDPOSTINC -movff TABLAT,var_a -TBLRDPOSTINC -movff TABLAT,var_a+3 -TBLRD -movff TABLAT,var_a+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_a+1 -TBLRDPOSTINC -movff TABLAT,var2_a -TBLRDPOSTINC -movff TABLAT,var2_a+3 -TBLRD -movff TABLAT,var2_a+2 -addlw 0x40 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_b+1 -TBLRDPOSTINC -movff TABLAT,var_b -TBLRDPOSTINC -movff TABLAT,var_b+3 -TBLRD -movff TABLAT,var_b+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_b+1 -TBLRDPOSTINC -movff TABLAT,var2_b -TBLRDPOSTINC -movff TABLAT,var2_b+3 -TBLRD -movff TABLAT,var2_b+2 -_endasm - // the start values are the previous end values // write new values in temp - - if( (var_e2secs < 0.0000363) - || (var_e2secs > 0.00577) - || (var2_e2secs < 0.0000961) - || (var2_e2secs > 0.150) - || (var_a < 0.231) - || (var_a > 1.27) - || (var_b < 0.504) - || (var_b > 0.966) - || (var2_a < 0.510) - || (var2_a > 1.75) - || (var2_b < 0.423) - || (var2_b > 0.927) - ) - int_O_DBG_pre_bitfield |= DBG_ZH16ERR; - -// N2 - temp_tissue = (temp_atem - pres_tissue[ci]) * var_e2secs; - temp_tissue_safety(); - pres_tissue[ci] = pres_tissue[ci] + temp_tissue; - -// He - temp_tissue = (temp2_atem - pres_tissue[ci+16]) * var2_e2secs; - temp_tissue_safety(); - pres_tissue[ci+16] = pres_tissue[ci+16] + temp_tissue; - - temp_tissue = pres_tissue[ci] + pres_tissue[ci+16]; - - var_a = (var_a * pres_tissue[ci] + var2_a * pres_tissue[ci+16]) / temp_tissue; - var_b = (var_b * pres_tissue[ci] + var2_b * pres_tissue[ci+16]) / temp_tissue; - pres_tissue_limit[ci] = (temp_tissue - var_a) * var_b; - if (pres_tissue_limit[ci] < 0) - pres_tissue_limit[ci] = 0; - if (pres_tissue_limit[ci] > pres_gtissue_limit) - { - pres_gtissue_limit = pres_tissue_limit[ci]; - char_O_gtissue_no = ci; - }//if -} // for -}//calc_tissue(void) - -// ---------------- -// calc_nullzeit // -// ---------------- -// calculates the remaining bottom time - -// unchanged in v.101 - -void calc_nullzeit(void) -{ - char_O_nullzeit = 0; - int_temp = 1; - do - { - backup_sim_pres_tissue(); - sim_tissue_10min(); - char_O_nullzeit = char_O_nullzeit + 10; - int_temp = int_temp + 1; - if (char_I_deco_model == 1) - temp1 = GF_high * temp_pres_gtissue_diff + temp_pres_gtissue; - else - temp1 = temp_pres_gtissue_limit; - if (temp1 > temp_surface) // changed in v.102 , if guiding tissue can not be exposed to surface pressure immediately - int_temp = 255; - } while (int_temp < 17); - if (int_temp == 255) - { - restore_sim_pres_tissue(); - char_O_nullzeit = char_O_nullzeit - 10; - } //if int_temp == 255] - int_temp = 1; - if (char_O_nullzeit < 60) - { - do - { - sim_tissue_1min(); - char_O_nullzeit = char_O_nullzeit + 1; - int_temp = int_temp + 1; // new in v.102a - if (char_I_deco_model == 1) - temp1 = GF_high * temp_pres_gtissue_diff + temp_pres_gtissue; - else - temp1 = temp_pres_gtissue_limit; - if (temp1 > temp_surface) // changed in v.102 , if guiding tissue can not be exposed to surface pressure immediately - int_temp = 255; - } while (int_temp < 10); - if (int_temp == 255) - char_O_nullzeit = char_O_nullzeit - 1; - } // if char_O_nullzeit < 60 -} //calc_nullzeit - -// ------------------------- -// backup_sim_pres_tissue // -// ------------------------- -void backup_sim_pres_tissue(void) -{ - for (x = 0;x<16;x++) - { - sim_pres_tissue_backup[x] = sim_pres_tissue[x]; - sim_pres_tissue_backup[x+16] = sim_pres_tissue[x+16]; - } -} // backup_sim - -// -------------------------- -// restore_sim_pres_tissue // -// -------------------------- -void restore_sim_pres_tissue(void) -{ - for (x = 0;x<16;x++) - { - sim_pres_tissue[x] = sim_pres_tissue_backup[x]; - sim_pres_tissue[x+16] = sim_pres_tissue_backup[x+16]; - } -} // restore_sim - -// ------------------ -// calc_ascenttime // -// ------------------ - -void calc_ascenttime(void) -{ -if (pres_respiration > pres_surface) - { - switch (char_O_deco_status) - { - case 2: - char_O_ascenttime = 255; - break; - case 1: - break; - default: - temp1 = pres_respiration - pres_surface + 0.6; // + 0.6 hence 1 minute ascent time from a depth of 4 meter on - if (temp1 < 0) - temp1 = 0; - if (temp1 > 255) - temp1 = 255; - char_O_ascenttime = (char)temp1; - - for(ci=0;ci<7;ci++) - { - x = char_O_ascenttime + char_O_array_decotime[ci]; - if (x < char_O_ascenttime) - char_O_ascenttime = 255; - else - char_O_ascenttime = x; - } - } - } -else - char_O_ascenttime = 0; -} // calc_ascenttime() - - -// --------------------- -// update_startvalues // -// --------------------- -// updated in v.102 - -void update_startvalues(void) -{ - temp_pres_gtissue_limit = pres_gtissue_limit; - temp_pres_gtissue = pres_tissue[char_O_gtissue_no] + pres_tissue[char_O_gtissue_no+16]; - temp_pres_gtissue_diff = temp_pres_gtissue_limit - temp_pres_gtissue; // negative number - temp_pres_gtissue_limit_GF_low = GF_low * temp_pres_gtissue_diff + temp_pres_gtissue; - temp_pres_gtissue_limit_GF_low_below_surface = temp_pres_gtissue_limit_GF_low - pres_surface; - if (temp_pres_gtissue_limit_GF_low_below_surface < 0) - temp_pres_gtissue_limit_GF_low_below_surface = 0; - - temp_gtissue_no = char_O_gtissue_no; - for (x = 0;x<16;x++) - { - sim_pres_tissue[x] = pres_tissue[x]; - sim_pres_tissue[x+16] = pres_tissue[x+16]; - sim_pres_tissue_limit[x] = pres_tissue_limit[x]; - } -} // update_startvalues - - -// ------------------ -// sim_tissue_1min // -// ------------------ -// optimized in v.101 - -void sim_tissue_1min(void) -{ -temp_pres_gtissue_limit = 0.0; -temp_gtissue_no = 255; - -_asm -lfsr 1, 0x300 -movlw 0x01 -movwf TBLPTRU,0 -_endasm - - -for (ci=0;ci<16;ci++) -{ -_asm -movlw 0x02 -movwf TBLPTRH,0 -movlb 4 // fuer ci -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addlw 0x80 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_a+1 -TBLRDPOSTINC -movff TABLAT,var_a -TBLRDPOSTINC -movff TABLAT,var_a+3 -TBLRD -movff TABLAT,var_a+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_a+1 -TBLRDPOSTINC -movff TABLAT,var2_a -TBLRDPOSTINC -movff TABLAT,var2_a+3 -TBLRD -movff TABLAT,var2_a+2 -addlw 0x40 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_b+1 -TBLRDPOSTINC -movff TABLAT,var_b -TBLRDPOSTINC -movff TABLAT,var_b+3 -TBLRD -movff TABLAT,var_b+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_b+1 -TBLRDPOSTINC -movff TABLAT,var2_b -TBLRDPOSTINC -movff TABLAT,var2_b+3 -TBLRD -movff TABLAT,var2_b+2 -addlw 0xC0 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_e1min+1 -TBLRDPOSTINC -movff TABLAT,var_e1min -TBLRDPOSTINC -movff TABLAT,var_e1min+3 -TBLRD -movff TABLAT,var_e1min+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_e1min+1 -TBLRDPOSTINC -movff TABLAT,var2_e1min -TBLRDPOSTINC -movff TABLAT,var2_e1min+3 -TBLRD -movff TABLAT,var2_e1min+2 -_endasm -// N2 - temp_tissue = (temp_atem - sim_pres_tissue[ci]) * var_e1min; - temp_tissue_safety(); - sim_pres_tissue[ci] = sim_pres_tissue[ci] + temp_tissue; -// He - temp_tissue = (temp2_atem - sim_pres_tissue[ci+16]) * var2_e1min; - temp_tissue_safety(); - sim_pres_tissue[ci+16] = sim_pres_tissue[ci+16] + temp_tissue; -// pressure limit - temp_tissue = sim_pres_tissue[ci] + sim_pres_tissue[ci+16]; - var_a = (var_a * sim_pres_tissue[ci] + var2_a * sim_pres_tissue[ci+16]) / temp_tissue; - var_b = (var_b * sim_pres_tissue[ci] + var2_b * sim_pres_tissue[ci+16]) / temp_tissue; - sim_pres_tissue_limit[ci] = (temp_tissue - var_a) * var_b; - - if (sim_pres_tissue_limit[ci] < 0) - sim_pres_tissue_limit[ci] = 0; - if (sim_pres_tissue_limit[ci] > temp_pres_gtissue_limit) - { - temp_pres_gtissue = temp_tissue; - temp_pres_gtissue_limit = sim_pres_tissue_limit[ci]; - temp_gtissue_no = ci; - } -} // for - temp_pres_gtissue_diff = temp_pres_gtissue_limit - temp_pres_gtissue; - temp_pres_gtissue_limit_GF_low = GF_low * temp_pres_gtissue_diff + temp_pres_gtissue; - temp_pres_gtissue_limit_GF_low_below_surface = temp_pres_gtissue_limit_GF_low - pres_surface; - if (temp_pres_gtissue_limit_GF_low_below_surface < 0) - temp_pres_gtissue_limit_GF_low_below_surface = 0; -} //sim_tissue_1min() - -//-------------------- -// sim_tissue_10min // -//-------------------- - -// Attention!! uses var_e1min und var2_e1min to load 10min data !!! -// is identical to sim_tissue_1min routine except for the different load of those variables - -// optimized in v.101 - -void sim_tissue_10min(void) -{ -temp_pres_gtissue_limit = 0.0; -temp_gtissue_no = 255; - -_asm -lfsr 1, 0x300 -movlw 0x01 -movwf TBLPTRU,0 -_endasm - -for (ci=0;ci<16;ci++) -{ -_asm -movlw 0x02 -movwf TBLPTRH,0 -movlb 4 // fuer ci -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addlw 0x80 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_a+1 -TBLRDPOSTINC -movff TABLAT,var_a -TBLRDPOSTINC -movff TABLAT,var_a+3 -TBLRD -movff TABLAT,var_a+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_a+1 -TBLRDPOSTINC -movff TABLAT,var2_a -TBLRDPOSTINC -movff TABLAT,var2_a+3 -TBLRD -movff TABLAT,var2_a+2 -addlw 0x40 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_b+1 -TBLRDPOSTINC -movff TABLAT,var_b -TBLRDPOSTINC -movff TABLAT,var_b+3 -TBLRD -movff TABLAT,var_b+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_b+1 -TBLRDPOSTINC -movff TABLAT,var2_b -TBLRDPOSTINC -movff TABLAT,var2_b+3 -TBLRD -movff TABLAT,var2_b+2 -addlw 0xC0 // different to 1 min -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -incf TBLPTRH,1,0 // different to 1 min -TBLRDPOSTINC -movff TABLAT,var_e1min+1 -TBLRDPOSTINC -movff TABLAT,var_e1min -TBLRDPOSTINC -movff TABLAT,var_e1min+3 -TBLRD -movff TABLAT,var_e1min+2 -addlw 0x40 -movwf TBLPTRL,0 -//incf TBLPTRH,1,0 // different to 1 min -TBLRDPOSTINC -movff TABLAT,var2_e1min+1 -TBLRDPOSTINC -movff TABLAT,var2_e1min -TBLRDPOSTINC -movff TABLAT,var2_e1min+3 -TBLRD -movff TABLAT,var2_e1min+2 -_endasm -// N2 - temp_tissue = (temp_atem - sim_pres_tissue[ci]) * var_e1min; - temp_tissue_safety(); - sim_pres_tissue[ci] = sim_pres_tissue[ci] + temp_tissue; -// He - temp_tissue = (temp2_atem - sim_pres_tissue[ci+16]) * var2_e1min; - temp_tissue_safety(); - sim_pres_tissue[ci+16] = sim_pres_tissue[ci+16] + temp_tissue; -// pressure limit -temp_tissue = sim_pres_tissue[ci] + sim_pres_tissue[ci+16]; - var_a = (var_a * sim_pres_tissue[ci] + var2_a * sim_pres_tissue[ci+16]) / temp_tissue; - var_b = (var_b * sim_pres_tissue[ci] + var2_b * sim_pres_tissue[ci+16]) / temp_tissue; - -sim_pres_tissue_limit[ci] = (temp_tissue - var_a) * var_b; - if (sim_pres_tissue_limit[ci] < 0) - sim_pres_tissue_limit[ci] = 0; - if (sim_pres_tissue_limit[ci] > temp_pres_gtissue_limit) - { - temp_pres_gtissue = temp_tissue; - temp_pres_gtissue_limit = sim_pres_tissue_limit[ci]; - temp_gtissue_no = ci; - } -} // for - temp_pres_gtissue_diff = temp_pres_gtissue_limit - temp_pres_gtissue; // negative number - temp_pres_gtissue_limit_GF_low = GF_low * temp_pres_gtissue_diff + temp_pres_gtissue; - temp_pres_gtissue_limit_GF_low_below_surface = temp_pres_gtissue_limit_GF_low - pres_surface; - if (temp_pres_gtissue_limit_GF_low_below_surface < 0) - temp_pres_gtissue_limit_GF_low_below_surface = 0; -} //sim_tissue_10min() - - -// ------------------ -// clear_decoarray // -// ------------------ -// unchanged in v.101 - -void clear_decoarray(void) -{ -char_O_array_decodepth[0] = 0; -char_O_array_decodepth[1] = 0; -char_O_array_decodepth[2] = 0; -char_O_array_decodepth[3] = 0; -char_O_array_decodepth[4] = 0; -char_O_array_decodepth[5] = 0; -char_O_array_decotime[0] = 0; -char_O_array_decotime[1] = 0; -char_O_array_decotime[2] = 0; -char_O_array_decotime[3] = 0; -char_O_array_decotime[4] = 0; -char_O_array_decotime[5] = 0; -char_O_array_decotime[6] = 0; -} // clear_decoarray - - -// ------------------- -// update_decoarray // -// ------------------- -// unchanged in v.101 - -void update_decoarray() -{ - x = 0; - do - { - if (char_O_array_decodepth[x] == temp_depth_limit) - { - int_temp = char_O_array_decotime[x] + temp_decotime; - if (int_temp < 0) - int_temp = 0; - if (int_temp > 240) - int_temp = 240; - char_O_array_decotime[x] = int_temp; - x = 10; // exit - } // if - else - { - if (char_O_array_decodepth[x] == 0) - { - if (temp_depth_limit > 255) - char_O_array_decodepth[x] = 255; - else - char_O_array_decodepth[x] = (char)temp_depth_limit; - int_temp = char_O_array_decotime[x] + temp_decotime; - if (int_temp > 240) - char_O_array_decotime[x] = 240; - else - char_O_array_decotime[x] = (char)int_temp; - x = 10; // exit - } // if - else - x++; - } // else - } while (x<6); - if (x == 6) - { - int_temp = char_O_array_decotime[6] + temp_decotime; - if (int_temp > 220) - char_O_array_decotime[6] = 220; - else - char_O_array_decotime[6] = (char)int_temp; - } // if x == 6 -} // update_decoarray - - -// ----------------------- -// calc_gradient_factor // -// ----------------------- -// optimized in v.101 (var_a) -// new code in v.102 - -void calc_gradient_factor(void) -{ - // tissue > respiration (entsaettigungsvorgang) - // gradient ist wieviel prozent an limit mit basis tissue - // dh. 0% = respiration == tissue - // dh. 100% = respiration == limit - temp_tissue = pres_tissue[char_O_gtissue_no] + pres_tissue[char_O_gtissue_no+16]; - temp1 = temp_tissue - pres_respiration; - temp2 = temp_tissue - pres_tissue_limit[char_O_gtissue_no]; // changed in v.102 - temp2 = temp1/temp2; - temp2 = temp2 * 100; // displayed in percent - if (temp2 < 0) - temp2 = 0; - if (temp2 > 255) - temp2 = 255; - if (temp1 < 0) - char_O_gradient_factor = 0; - else - char_O_gradient_factor = (char)temp2; - - temp3 = temp2; - - if (char_I_deco_model == 1) // calculate relative gradient factor - { - temp1 = (float)temp_depth_GF_low_meter * 0.09995; - temp2 = pres_respiration - pres_surface; - if (temp2 <= 0) - temp1 = GF_high; - else - if (temp2 >= temp1) - temp1 = GF_low; - else - temp1 = GF_low + (temp1 - temp2)/temp1*GF_delta; - if (temp_depth_GF_low_meter == 0) - temp1 = GF_high; - temp2 = temp3 / temp1; // temp3 is already in percent - if (temp2 < 0) - temp2 = 0; - if (temp2 > 255) - temp2 = 255; - char_O_relative_gradient_GF = (char)temp2; - } // calc relative gradient factor - else - { - char_O_relative_gradient_GF = char_O_gradient_factor; - } -} // calc_gradient - -// --------------------------- -// calc_gradient_array_only // -// --------------------------- -// optimized in v.101 (var_a) -// new code in v.102 - -void calc_gradient_array_only() -{ - pres_respiration = (float)int_I_pres_respiration / 1000.0; // assembler code uses different digit system -for (ci=0;ci<16;ci++) -{ - temp_tissue = pres_tissue[ci] + pres_tissue[ci+16]; - temp1 = temp_tissue - pres_respiration; - temp2 = temp_tissue - pres_tissue_limit[ci]; - temp2 = temp1/temp2; - temp2 = temp2 * 200; // because of output in (Double-)percentage - if (temp2 < 0) - temp2 = 0; - if (temp2 > 255) - temp2 = 255; - if (temp1 < 0) - char_O_array_gradient_weighted[ci] = 0; - else - char_O_array_gradient_weighted[ci] = (char)temp2; -} // for -} // calc_gradient_array_only - - -// ------------------------- -// calc_desaturation_time // -// ------------------------- -// FIXED N2_ratio -// unchanged in v.101 - -void calc_desaturation_time(void) -{ -_asm -lfsr 1, 0x300 -movlw 0x01 -movwf TBLPTRU,0 -_endasm - N2_ratio = 0.7902; // FIXED sum as stated in b"uhlmann - pres_surface = (float)int_I_pres_surface / 1000.0; - temp_atem = N2_ratio * (pres_surface - 0.0627); - int_O_desaturation_time = 0; - float_desaturation_multiplier = char_I_desaturation_multiplier / 142.0; // new in v.101 (70,42%/100.=142) - -for (ci=0;ci<16;ci++) -{ -_asm -movlw 0x04 -movwf TBLPTRH,0 -movlb 4 // fuer ci -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addlw 0x80 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_halftimes+1 -TBLRDPOSTINC -movff TABLAT,var_halftimes -TBLRDPOSTINC -movff TABLAT,var_halftimes+3 -TBLRD -movff TABLAT,var_halftimes+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_halftimes+1 -TBLRDPOSTINC -movff TABLAT,var2_halftimes -TBLRDPOSTINC -movff TABLAT,var2_halftimes+3 -TBLRD -movff TABLAT,var2_halftimes+2 -_endasm - -// saturation_time (for flight) and N2_saturation in multiples of halftime -// version v.100: 1.1 = 10 percent distance to totally clean (totally clean is not possible, would take infinite time ) -// new in version v.101: 1.07 = 7 percent distance to totally clean (totally clean is not possible, would take infinite time ) -// changes in v.101: 1.05 = 5 percent dist to totally clean is new desaturation point for display and noFly calculations -// N2 - temp1 = 1.05 * temp_atem; - temp1 = temp1 - pres_tissue[ci]; - temp2 = temp_atem - pres_tissue[ci]; - if (temp2 >= 0.0) - { - temp1 = 0; - temp2 = 0; - } - else - temp1 = temp1 / temp2; - if (temp1 > 0.0) - { - temp1 = log(1.0 - temp1); - temp1 = temp1 / -0.6931; // temp1 is the multiples of half times necessary. - // 0.6931 is ln(2), because the math function log() calculates with a base of e not 2 as requested. - // minus because log is negative - temp2 = var_halftimes * temp1 / float_desaturation_multiplier; // time necessary (in minutes ) for complete desaturation (see comment about 10 percent) , new in v.101: float_desaturation_multiplier - } - else - { - temp1 = 0; - temp2 = 0; - } - -// He - temp3 = 0.1 - pres_tissue[ci+16]; -if (temp3 >= 0.0) - { - temp3 = 0; - temp4 = 0; - } - else - temp3 = -1.0 * temp3 / pres_tissue[ci+16]; - if (temp3 > 0.0) - { - temp3 = log(1.0 - temp3); - temp3 = temp3 / -0.6931; // temp1 is the multiples of half times necessary. - // 0.6931 is ln(2), because the math function log() calculates with a base of e not 2 as requested. - // minus because log is negative - temp4 = var2_halftimes * temp3 / float_desaturation_multiplier; // time necessary (in minutes ) for "complete" desaturation, new in v.101 float_desaturation_multiplier - } - else - { - temp3 = 0; - temp4 = 0; - } - -// saturation_time (for flight) - if (temp4 > temp2) - int_temp = (int)temp4; - else - int_temp = (int)temp2; - if(int_temp > int_O_desaturation_time) - int_O_desaturation_time = int_temp; - -// N2 saturation in multiples of halftime for display purposes - temp2 = temp1 * 20.0; // 0 = 1/8, 120 = 0, 249 = 8 - temp2 = temp2 + 80.0; // set center - if (temp2 < 0.0) - temp2 = 0.0; - if (temp2 > 255.0) - temp2 = 255.0; - char_O_tissue_saturation[ci] = (char)temp2; -// He saturation in multiples of halftime for display purposes - temp4 = temp3 * 20.0; // 0 = 1/8, 120 = 0, 249 = 8 - temp4 = temp4 + 80.0; // set center - if (temp4 < 0.0) - temp4 = 0.0; - if (temp4 > 255.0) - temp4 = 255.0; - char_O_tissue_saturation[ci+16] = (char)temp4; -} // for -} // calc_desaturation_time - - -// -------------------------- -// calc_wo_deco_step_1_min // -// -------------------------- -// FIXED N2 Ratio -// optimized in v.101 (...saturation_multiplier) -// desaturation slowed down to 70,42% - -void calc_wo_deco_step_1_min(void) -{ - if(flag_in_divemode) - { - flag_in_divemode = 0; - set_dbg_end_of_dive(); - } -_asm - lfsr 1, 0x300 -_endasm - N2_ratio = 0.7902; // FIXED, sum lt. buehlmann - pres_respiration = (float)int_I_pres_respiration / 1000.0; // assembler code uses different digit system - pres_surface = (float)int_I_pres_surface / 1000.0; - temp_atem = N2_ratio * (pres_respiration - 0.0627); // 0.0627 is the extra pressure in the body - temp2_atem = 0.0; - temp_surface = pres_surface; // the b"uhlmann formula using temp_surface does not use the N2_ratio - float_desaturation_multiplier = char_I_desaturation_multiplier / 142.0; // new in v.101 (70,42%/100.=142) - float_saturation_multiplier = char_I_saturation_multiplier / 100.0; - - calc_tissue_step_1_min(); // update the pressure in the 16 tissues in accordance with the new ambient pressure - clear_decoarray(); - char_O_deco_status = 0; - char_O_nullzeit = 0; - char_O_ascenttime = 0; - calc_gradient_factor(); - -} // calc_wo_deco_step_1_min(void) - - -// ------------------------- -// calc_tissue_step_1_min // -// ------------------------- -// optimized in v.101 - -void calc_tissue_step_1_min(void) -{ -_asm -lfsr 1, 0x300 -movlw 0x01 -movwf TBLPTRU,0 -_endasm - - char_O_gtissue_no = 255; - pres_gtissue_limit = 0.0; - -for (ci=0;ci<16;ci++) -{ -_asm -movlw 0x02 -movwf TBLPTRH,0 -movlb 4 // fuer ci -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addlw 0x80 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_a+1 -TBLRDPOSTINC -movff TABLAT,var_a -TBLRDPOSTINC -movff TABLAT,var_a+3 -TBLRD -movff TABLAT,var_a+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_a+1 -TBLRDPOSTINC -movff TABLAT,var2_a -TBLRDPOSTINC -movff TABLAT,var2_a+3 -TBLRD -movff TABLAT,var2_a+2 -addlw 0x40 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_b+1 -TBLRDPOSTINC -movff TABLAT,var_b -TBLRDPOSTINC -movff TABLAT,var_b+3 -TBLRD -movff TABLAT,var_b+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_b+1 -TBLRDPOSTINC -movff TABLAT,var2_b -TBLRDPOSTINC -movff TABLAT,var2_b+3 -TBLRD -movff TABLAT,var2_b+2 -addlw 0xC0 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_e1min+1 -TBLRDPOSTINC -movff TABLAT,var_e1min -TBLRDPOSTINC -movff TABLAT,var_e1min+3 -TBLRD -movff TABLAT,var_e1min+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_e1min+1 -TBLRDPOSTINC -movff TABLAT,var2_e1min -TBLRDPOSTINC -movff TABLAT,var2_e1min+3 -TBLRD -movff TABLAT,var2_e1min+2 -_endasm - -// N2 1 min - temp_tissue = (temp_atem - pres_tissue[ci]) * var_e1min; - temp_tissue_safety(); - pres_tissue[ci] = pres_tissue[ci] + temp_tissue; - -// He 1 min - temp_tissue = (temp2_atem - pres_tissue[ci+16]) * var2_e1min; - temp_tissue_safety(); - pres_tissue[ci+16] = pres_tissue[ci+16] + temp_tissue; - - temp_tissue = pres_tissue[ci] + pres_tissue[ci+16]; - var_a = (var_a * pres_tissue[ci] + var2_a * pres_tissue[ci+16]) / temp_tissue; - var_b = (var_b * pres_tissue[ci] + var2_b * pres_tissue[ci+16]) / temp_tissue; - pres_tissue_limit[ci] = (temp_tissue - var_a) * var_b; - if (pres_tissue_limit[ci] < 0) - pres_tissue_limit[ci] = 0; - if (pres_tissue_limit[ci] > pres_gtissue_limit) - { - pres_gtissue_limit = pres_tissue_limit[ci]; - char_O_gtissue_no = ci; - }//if - -// gradient factor array for graphical display -// display range is 0 to 250! in steps of 5 for 1 pixel -// the display is divided in 6 blocks -// -> double the gradient 100% = 200 -// tissue > respiration (entsaettigungsvorgang) -// gradient ist wieviel prozent an limit von tissue aus -// dh. 0% = respiration == tissue -// dh. 100% = respiration == limit -temp1 = temp_tissue - pres_respiration; -temp2 = temp_tissue - pres_tissue_limit[ci]; // changed in v.102 -temp2 = temp1/temp2; -temp2 = temp2 * 200; // because of output in (Double-)percentage -if (temp2 < 0) - temp2 = 0; -if (temp2 > 255) - temp2 = 255; -if (temp1 < 0) - char_O_array_gradient_weighted[ci] = 0; -else - char_O_array_gradient_weighted[ci] = (char)temp2; - -} // for -} // calc wo deco 1min - -#if 0 -// -------- -// debug // -// -------- -void debug(void) -{ -for (ci=0;ci<32;ci++) -{ - int_O_tissue_for_debug[ci] = (unsigned int)(pres_tissue[ci] *1000); -} -} // void debug(void) -#endif - -// ---------- -// md hash // -// ---------- -void hash(void) -{ -// init - for (md_i=0;md_i<16;md_i++) - { - md_state[md_i] = 0; - md_cksum[md_i] = 0; - } // for md_i 16 - -_asm - movlw 0x01 - movwf TBLPTRU,0 - movlw 0x06 - movwf TBLPTRH,0 - movlw 0x00 - movwf TBLPTRL,0 -_endasm - for (md_i=0;md_i<127;md_i++) - { -_asm - TBLRDPOSTINC - movff TABLAT,md_temp -_endasm - md_pi_subst[md_i] = md_temp; - } // for md_i 256 -_asm - TBLRDPOSTINC - movff TABLAT,md_temp -_endasm - md_pi_subst[127] = md_temp; - for (md_i=0;md_i<127;md_i++) - { -_asm - TBLRDPOSTINC - movff TABLAT,md_temp -_endasm - md_pi_subst[md_i+128] = md_temp; - } // for md_i 256 -_asm - TBLRD - movff TABLAT,md_temp -_endasm - md_pi_subst[255] = md_temp; - -_asm - movlw 0x00 - movwf TBLPTRU,0 - movlw 0x00 - movwf TBLPTRH,0 - movlw 0x00 - movwf TBLPTRL,0 -_endasm -// cycle buffers -for (md_pointer=0x0000;md_pointer<0x17f3;md_pointer++) -{ - md_t = 0; - for (md_i=0;md_i<16;md_i++) - { - if(md_pointer == 9) - md_temp = md_cksum[md_i]; - else - { -_asm - TBLRDPOSTINC - movff TABLAT,md_temp -_endasm - } // else - md_buffer[md_i] = md_temp; - md_state[md_i+16] = md_buffer[md_i]; - md_state[md_i+32] = (unsigned char)(md_buffer[md_i] ^ md_state[md_i]); - } // for md_i 16 - - for (md_i=0;md_i<18;md_i++) - { - for (md_j=0;md_j<48;md_j++) - { - md_state[md_j] = (unsigned char)(md_state[md_j] ^ md_pi_subst[md_t]); - md_t = md_state[md_j]; - } // for md_j 48 - md_t = (unsigned char)(md_t+1); - } // for md_i 18 - md_t = md_cksum[15]; - - for (md_i=0;md_i<16;md_i++) - { - md_cksum[md_i] = (unsigned char)(md_cksum[md_i] ^ md_pi_subst[(md_buffer[md_i] ^ md_t)]); - md_t = md_cksum[md_i]; - } // for md_i 16 -} // for md_pointer -} // void hash(void) - -// --------------------- -// clear_CNS_fraction // -// --------------------- -// new in v.101 - -void clear_CNS_fraction(void) -{ - CNS_fraction = 0.0; - char_O_CNS_fraction = 0; -} // void clear_CNS_fraction(void) - - -// -------------------- -// calc_CNS_fraction // -// -------------------- -// new in v.101 -// optimized in v.102 : with new variables char_I_actual_ppO2 and actual_ppO2 - -// Input: char_I_actual_ppO2 -// Output: char_O_CNS_fraction -// Uses and Updates: CNS_fraction -// Uses: acutal_ppO2 - -void calc_CNS_fraction(void) -{ - actual_ppO2 = (float)char_I_actual_ppO2 / 100.0; - - if (char_I_actual_ppO2 < 50) - CNS_fraction = CNS_fraction;// no changes - else if (char_I_actual_ppO2 < 60) - CNS_fraction = 1/(-54000.0 * actual_ppO2 + 54000.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 70) - CNS_fraction = 1/(-45000.0 * actual_ppO2 + 48600.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 80) - CNS_fraction = 1/(-36000.0 * actual_ppO2 + 42300.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 90) - CNS_fraction = 1/(-27000.0 * actual_ppO2 + 35100.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 110) - CNS_fraction = 1/(-18000.0 * actual_ppO2 + 27000.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 150) - CNS_fraction = 1/(-9000.0 * actual_ppO2 + 17100.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 160) - CNS_fraction = 1/(-22500.0 * actual_ppO2 + 37350.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 165) - CNS_fraction = 0.000755 + CNS_fraction; // Arieli et all.(2002): Modeling pulmonary and CNS O2 toxicity... Formula (A1) based on value for 1.55 and c=20 - else if (char_I_actual_ppO2 < 170) - CNS_fraction = 0.00102 + CNS_fraction; // example calculation: Sqrt((1.7/1.55)^20)*0.000404 - else if (char_I_actual_ppO2 < 175) - CNS_fraction = 0.00136 + CNS_fraction; - else if (char_I_actual_ppO2 < 180) - CNS_fraction = 0.00180 + CNS_fraction; - else if (char_I_actual_ppO2 < 185) - CNS_fraction = 0.00237 + CNS_fraction; - else if (char_I_actual_ppO2 < 190) - CNS_fraction = 0.00310 + CNS_fraction; - else if (char_I_actual_ppO2 < 195) - CNS_fraction = 0.00401 + CNS_fraction; - else if (char_I_actual_ppO2 < 200) - CNS_fraction = 0.00517 + CNS_fraction; - else if (char_I_actual_ppO2 < 230) - CNS_fraction = 0.0209 + CNS_fraction; - else - CNS_fraction = 0.0482 + CNS_fraction; // value for 2.5 - - if (CNS_fraction > 2.5) - CNS_fraction = 2.5; - if (CNS_fraction < 0.0) - CNS_fraction = 0.0; - char_O_CNS_fraction = (char)((CNS_fraction + 0.005)* 100.0); -} // void calc_CNS_fraction(void) - -// -------------------------- -// calc_CNS_decrease_15min // -// -------------------------- -// new in v.101 - -// calculates the half time of 90 minutes in 6 steps of 15 min - -// Output: char_O_CNS_fraction -// Uses and Updates: CNS_fraction - -void calc_CNS_decrease_15min(void) -{ - CNS_fraction = 0.890899 * CNS_fraction; - char_O_CNS_fraction = (char)((CNS_fraction + 0.005)* 100.0); -}// calc_CNS_decrease_15min(void) - - -// ------------------ -// calc_percentage // -// ------------------ -// new in v.101 - -// calculates int_I_temp * char_I_temp / 100 -// output is int_I_temp - -void calc_percentage(void) -{ - temp1 = (float)int_I_temp; - temp2 = (float)char_I_temp / 100.0; - temp3 = temp1 * temp2; - int_I_temp = (int)temp3; -} -void push_tissues_to_vault(void) -{ - for (ci=0;ci<32;ci++) - pres_tissue_vault[ci] = pres_tissue[ci]; -} -void pull_tissues_from_vault(void) -{ - for (ci=0;ci<32;ci++) - pres_tissue[ci] = pres_tissue_vault[ci]; -} - -void wp_write_command(void) -{ - _asm - bcf oled_rs - movff wp_command,PORTD - bcf oled_rw - bsf oled_rw - _endasm -} - -void wp_write_data(void) -{ - wp_data_8bit_one = wp_data_16bit >> 8; - wp_data_8bit_two = wp_data_16bit; -_asm - bsf oled_rs - movff wp_data_8bit_one,PORTD - bcf oled_rw - bsf oled_rw - movff wp_data_8bit_two,PORTD - bcf oled_rw - bsf oled_rw -_endasm -} - -void wp_write_black(void) -{ -_asm - movff wp_black,PORTD - bcf oled_rw - bsf oled_rw - bcf oled_rw - bsf oled_rw -_endasm -} - -void wp_write_color(void) -{ -_asm - movff wp_color1,PORTD - bcf oled_rw - bsf oled_rw - movff wp_color2,PORTD - bcf oled_rw - bsf oled_rw -_endasm -} - -void wp_set_window(void) -{ - // x axis start ( 0 - 319) - wp_command = 0x35; - wp_write_command(); - wp_data_16bit = ((U16)wp_leftx2) << 1; - wp_write_data(); - // x axis end ( 0 - 319) - wp_command = 0x36; - wp_write_command(); - wp_data_16bit = 319; - wp_write_data(); - // y axis start + end ( 0 - 239 ) - wp_command = 0x37; - wp_write_command(); - // the bottom part - wp_data_16bit = wp_top; - if(wp_font == 2) - wp_data_16bit += WP_FONT_LARGE_HEIGHT; - else if(wp_font == 1) - wp_data_16bit += WP_FONT_MEDIUM_HEIGHT; - else - wp_data_16bit += WP_FONT_SMALL_HEIGHT; - wp_data_16bit--; - if(wp_data_16bit > 239) - wp_data_16bit = 239; - // the top part - wp_data_16bit |= ((U16)wp_top) << 8; - // all together in one 16bit transfer - wp_write_data(); - - // start - wp_command = 0x20; - wp_write_command(); - wp_data_16bit = wp_top; - wp_write_data(); - - wp_command = 0x21; - wp_write_command(); - wp_data_16bit = ((U16)wp_leftx2) << 1; - wp_write_data(); -} - -void wp_set_char_font_small(void) -{ - if (wp_char == ' ') - wp_char = '¶'; - - if((wp_char < '!') || (wp_char > '¶')) // font has 34 chars after ~ // ¾ + 4 chars limit to end of battery at the moment - wp_char = '¤'; // 0x82; // ¤ - - if (wp_char > 0x7E) // skip space between ~ and ¡ - wp_char -= 34; - - wp_start = wp_small_table[wp_char - '!']; - wp_end = wp_small_table[1 + wp_char - '!']; -} - -void wp_set_char_font_medium(void) -{ - // space is 3E - if (wp_char == 0x27) // 0x27 == ' - wp_char = 0x3B; - if (wp_char == '"') - wp_char = 0x3C; - if (wp_char == 'm') - wp_char = 0x3D; - if (wp_char == ' ') - wp_char = 0x3E; - - if((wp_char < '.') || (wp_char > 0x3E)) - wp_char = 0x3E; - wp_start = wp_medium_table[wp_char - '.']; - wp_end = wp_medium_table[1 + wp_char - '.']; -} - -void wp_set_char_font_large(void) -{ - // space is / = 0x2F - if (wp_char == ' ') - wp_char = 0x2F; - - if((wp_char < '.') || (wp_char > '9')) - wp_char = 0x2F; - wp_start = wp_large_table[wp_char - '.']; - wp_end = wp_large_table[1 + wp_char - '.']; -} - -void wordprocessor(void) -{ - wp_set_window(); - - // access to GRAM - wp_command = 0x22; - wp_write_command(); - _asm - bsf oled_rs - _endasm - - wp_txtptr = 0; - wp_char = wp_stringstore[wp_txtptr]; - - while(wp_char) - { - if(wp_font == 2) - wp_set_char_font_large(); - else if(wp_font == 1) - wp_set_char_font_medium(); - else - wp_set_char_font_small(); - - wp_black = 0; - - for(wp_i = wp_start; wp_i<wp_end;wp_i++) - { - if(wp_font == 2) - wp_data_16bit = wp_large_data[wp_i / 2]; - else if(wp_font == 1) - wp_data_16bit = wp_medium_data[wp_i / 2]; - else - wp_data_16bit = wp_small_data[wp_i / 2]; - if(wp_i & 1) - wp_temp_U8 = wp_data_16bit & 0xFF; - else - wp_temp_U8 = wp_data_16bit >> 8; - if((wp_temp_U8 & 128)) - { - wp_temp_U8 -= 127; - if(wp_invert) - { - while(wp_temp_U8 > 0) - { - wp_temp_U8--; - wp_write_color(); - } - } - else - { - _asm - movff wp_black,PORTD - _endasm - while(wp_temp_U8 > 0) - { - wp_temp_U8--; - _asm - bcf oled_rw - bsf oled_rw - bcf oled_rw - bsf oled_rw - _endasm - } - } - } - else - { - wp_temp_U8++; - if(wp_invert) - { - _asm - movff wp_black,PORTD - _endasm - while(wp_temp_U8 > 0) - { - wp_temp_U8--; - _asm - bcf oled_rw - bsf oled_rw - bcf oled_rw - bsf oled_rw - _endasm - } - } - else - { - while(wp_temp_U8 > 0) - { - wp_temp_U8--; - wp_write_color(); - } - } - } - } - wp_txtptr++; - wp_char = wp_stringstore[wp_txtptr]; - } - wp_command = 0x00; - wp_write_command(); -}
--- a/code_part1/OSTC_code_c_part2/p2_deco_main - 090915b.err Thu Aug 05 09:49:32 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -Error[1027] Q:\Data\OSTC2\code\OSTC_code_c_part2\p2_deco_main - 090915b.c 1295 : unable to locate 'p2_tables.romdata'
--- a/code_part1/OSTC_code_c_part2/p2_deco_main - 090915b.i Thu Aug 05 09:49:32 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11459 +0,0 @@ -#line 1 "p2_deco_main - 090915b.c" -#line 1 "p2_deco_main - 090915b.c" - -#line 17 "p2_deco_main - 090915b.c" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -#line 1 "C:/MCC18/h/p18f4685.h" - -#line 5 "C:/MCC18/h/p18f4685.h" - - - -#line 9 "C:/MCC18/h/p18f4685.h" - -extern volatile far unsigned char RXF6SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXF6SIDHbits; -extern volatile far unsigned char RXF6SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDEN:1; - }; -} RXF6SIDLbits; -extern volatile far unsigned char RXF6EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXF6EIDHbits; -extern volatile far unsigned char RXF6EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXF6EIDLbits; -extern volatile far unsigned char RXF7SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXF7SIDHbits; -extern volatile far unsigned char RXF7SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDEN:1; - }; -} RXF7SIDLbits; -extern volatile far unsigned char RXF7EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXF7EIDHbits; -extern volatile far unsigned char RXF7EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXF7EIDLbits; -extern volatile far unsigned char RXF8SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXF8SIDHbits; -extern volatile far unsigned char RXF8SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDEN:1; - }; -} RXF8SIDLbits; -extern volatile far unsigned char RXF8EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXF8EIDHbits; -extern volatile far unsigned char RXF8EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXF8EIDLbits; -extern volatile far unsigned char RXF9SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXF9SIDHbits; -extern volatile far unsigned char RXF9SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDEN:1; - }; -} RXF9SIDLbits; -extern volatile far unsigned char RXF9EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXF9EIDHbits; -extern volatile far unsigned char RXF9EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXF9EIDLbits; -extern volatile far unsigned char RXF10SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXF10SIDHbits; -extern volatile far unsigned char RXF10SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDEN:1; - }; -} RXF10SIDLbits; -extern volatile far unsigned char RXF10EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXF10EIDHbits; -extern volatile far unsigned char RXF10EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXF10EIDLbits; -extern volatile far unsigned char RXF11SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXF11SIDHbits; -extern volatile far unsigned char RXF11SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDEN:1; - }; -} RXF11SIDLbits; -extern volatile far unsigned char RXF11EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXF11EIDHbits; -extern volatile far unsigned char RXF11EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXF11EIDLbits; -extern volatile far unsigned char RXF12SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXF12SIDHbits; -extern volatile far unsigned char RXF12SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDEN:1; - }; -} RXF12SIDLbits; -extern volatile far unsigned char RXF12EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXF12EIDHbits; -extern volatile far unsigned char RXF12EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXF12EIDLbits; -extern volatile far unsigned char RXF13SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXF13SIDHbits; -extern volatile far unsigned char RXF13SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDEN:1; - }; -} RXF13SIDLbits; -extern volatile far unsigned char RXF13EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXF13EIDHbits; -extern volatile far unsigned char RXF13EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXF13EIDLbits; -extern volatile far unsigned char RXF14SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXF14SIDHbits; -extern volatile far unsigned char RXF14SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDEN:1; - }; -} RXF14SIDLbits; -extern volatile far unsigned char RXF14EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXF14EIDHbits; -extern volatile far unsigned char RXF14EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXF14EIDLbits; -extern volatile far unsigned char RXF15SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXF15SIDHbits; -extern volatile far unsigned char RXF15SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDEN:1; - }; -} RXF15SIDLbits; -extern volatile far unsigned char RXF15EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXF15EIDHbits; -extern volatile far unsigned char RXF15EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXF15EIDLbits; -extern volatile far unsigned char RXFCON0; -extern volatile far struct { - unsigned RXF0EN:1; - unsigned RXF1EN:1; - unsigned RXF2EN:1; - unsigned RXF3EN:1; - unsigned RXF4EN:1; - unsigned RXF5EN:1; - unsigned RXF6EN:1; - unsigned RXF7EN:1; -} RXFCON0bits; -extern volatile far unsigned char RXFCON1; -extern volatile far struct { - unsigned RXF8EN:1; - unsigned RXF9EN:1; - unsigned RXF10EN:1; - unsigned RXF11EN:1; - unsigned RXF12EN:1; - unsigned RXF13EN:1; - unsigned RXF14EN:1; - unsigned RXF15EN:1; -} RXFCON1bits; -extern volatile far unsigned char SDFLC; -extern volatile far union { - struct { - unsigned DFLC0:1; - unsigned DFLC1:1; - unsigned DFLC2:1; - unsigned DFLC3:1; - unsigned DFLC4:1; - }; - struct { - unsigned FLC0:1; - unsigned FLC1:1; - unsigned FLC2:1; - unsigned FLC3:1; - unsigned FLC4:1; - }; -} SDFLCbits; -extern volatile far unsigned char RXFBCON0; -extern volatile far struct { - unsigned F0BP_0:1; - unsigned F0BP_1:1; - unsigned F0BP_2:1; - unsigned F0BP_3:1; - unsigned F1BP_0:1; - unsigned F1BP_1:1; - unsigned F1BP_2:1; - unsigned F1BP_3:1; -} RXFBCON0bits; -extern volatile far unsigned char RXFBCON1; -extern volatile far struct { - unsigned F2BP_0:1; - unsigned F2BP_1:1; - unsigned F2BP_2:1; - unsigned F2BP_3:1; - unsigned F3BP_0:1; - unsigned F3BP_1:1; - unsigned F3BP_2:1; - unsigned F3BP_3:1; -} RXFBCON1bits; -extern volatile far unsigned char RXFBCON2; -extern volatile far struct { - unsigned F4BP_0:1; - unsigned F4BP_1:1; - unsigned F4BP_2:1; - unsigned F4BP_3:1; - unsigned F5BP_0:1; - unsigned F5BP_1:1; - unsigned F5BP_2:1; - unsigned F5BP_3:1; -} RXFBCON2bits; -extern volatile far unsigned char RXFBCON3; -extern volatile far struct { - unsigned F6BP_0:1; - unsigned F6BP_1:1; - unsigned F6BP_2:1; - unsigned F6BP_3:1; - unsigned F7BP_0:1; - unsigned F7BP_1:1; - unsigned F7BP_2:1; - unsigned F7BP_3:1; -} RXFBCON3bits; -extern volatile far unsigned char RXFBCON4; -extern volatile far struct { - unsigned F8BP_0:1; - unsigned F8BP_1:1; - unsigned F8BP_2:1; - unsigned F8BP_3:1; - unsigned F9BP_0:1; - unsigned F9BP_1:1; - unsigned F9BP_2:1; - unsigned F9BP_3:1; -} RXFBCON4bits; -extern volatile far unsigned char RXFBCON5; -extern volatile far struct { - unsigned F10BP_0:1; - unsigned F10BP_1:1; - unsigned F10BP_2:1; - unsigned F10BP_3:1; - unsigned F11BP_0:1; - unsigned F11BP_1:1; - unsigned F11BP_2:1; - unsigned F11BP_3:1; -} RXFBCON5bits; -extern volatile far unsigned char RXFBCON6; -extern volatile far struct { - unsigned F12BP_0:1; - unsigned F12BP_1:1; - unsigned F12BP_2:1; - unsigned F12BP_3:1; - unsigned F13BP_0:1; - unsigned F13BP_1:1; - unsigned F13BP_2:1; - unsigned F13BP_3:1; -} RXFBCON6bits; -extern volatile far unsigned char RXFBCON7; -extern volatile far struct { - unsigned F14BP_0:1; - unsigned F14BP_1:1; - unsigned F14BP_2:1; - unsigned F14BP_3:1; - unsigned F15BP_0:1; - unsigned F15BP_1:1; - unsigned F15BP_2:1; - unsigned F15BP_3:1; -} RXFBCON7bits; -extern volatile far unsigned char MSEL0; -extern volatile far struct { - unsigned FIL0_0:1; - unsigned FIL0_1:1; - unsigned FIL1_0:1; - unsigned FIL1_1:1; - unsigned FIL2_0:1; - unsigned FIL2_1:1; - unsigned FIL3_0:1; - unsigned FIL3_1:1; -} MSEL0bits; -extern volatile far unsigned char MSEL1; -extern volatile far struct { - unsigned FIL4_0:1; - unsigned FIL4_1:1; - unsigned FIL5_0:1; - unsigned FIL5_1:1; - unsigned FIL6_0:1; - unsigned FIL6_1:1; - unsigned FIL7_0:1; - unsigned FIL7_1:1; -} MSEL1bits; -extern volatile far unsigned char MSEL2; -extern volatile far struct { - unsigned FIL8_0:1; - unsigned FIL8_1:1; - unsigned FIL9_0:1; - unsigned FIL9_1:1; - unsigned FIL10_0:1; - unsigned FIL10_1:1; - unsigned FIL11_0:1; - unsigned FIL11_1:1; -} MSEL2bits; -extern volatile far unsigned char MSEL3; -extern volatile far struct { - unsigned FIL12_0:1; - unsigned FIL12_1:1; - unsigned FIL13_0:1; - unsigned FIL13_1:1; - unsigned FIL14_0:1; - unsigned FIL14_1:1; - unsigned FIL15_0:1; - unsigned FIL15_1:1; -} MSEL3bits; -extern volatile far unsigned char BSEL0; -extern volatile far struct { - unsigned :2; - unsigned B0TXEN:1; - unsigned B1TXEN:1; - unsigned B2TXEN:1; - unsigned B3TXEN:1; - unsigned B4TXEN:1; - unsigned B5TXEN:1; -} BSEL0bits; -extern volatile far unsigned char BIE0; -extern volatile far struct { - unsigned RXB0IE:1; - unsigned RXB1IE:1; - unsigned B0IE:1; - unsigned B1IE:1; - unsigned B2IE:1; - unsigned B3IE:1; - unsigned B4IE:1; - unsigned B5IE:1; -} BIE0bits; -extern volatile far unsigned char TXBIE; -extern volatile far struct { - unsigned :2; - unsigned TXB0IE:1; - unsigned TXB1IE:1; - unsigned TXB2IE:1; -} TXBIEbits; -extern volatile far unsigned char B0CON; -extern volatile far union { - struct { - unsigned FILHIT0:1; - unsigned FILHIT1:1; - unsigned FILHIT2:1; - unsigned FILHIT3:1; - unsigned FILHIT4:1; - unsigned RTRRO:1; - unsigned RXM1:1; - unsigned RXFUL:1; - }; - struct { - unsigned TXPRI0:1; - unsigned TXPRI1:1; - unsigned RTREN:1; - unsigned TXREQ:1; - unsigned TXERR:1; - unsigned TXLARB:1; - unsigned TXABT:1; - unsigned TXBIF:1; - }; - struct { - unsigned :5; - unsigned RXRTRRO:1; - }; -} B0CONbits; -extern volatile far unsigned char B0SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} B0SIDHbits; -extern volatile far unsigned char B0SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXID:1; - unsigned SRR:1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDE:1; - }; -} B0SIDLbits; -extern volatile far unsigned char B0EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} B0EIDHbits; -extern volatile far unsigned char B0EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} B0EIDLbits; -extern volatile far unsigned char B0DLC; -extern volatile far union { - struct { - unsigned DLC0:1; - unsigned DLC1:1; - unsigned DLC2:1; - unsigned DLC3:1; - unsigned RESRB0:1; - unsigned RESRB1:1; - unsigned RXRTR:1; - }; - struct { - unsigned :6; - unsigned TXRTR:1; - }; - struct { - unsigned :4; - unsigned RB0:1; - unsigned RB1:1; - }; -} B0DLCbits; -extern volatile far unsigned char B0D0; -extern volatile far struct { - unsigned B0D00:1; - unsigned B0D01:1; - unsigned B0D02:1; - unsigned B0D03:1; - unsigned B0D04:1; - unsigned B0D05:1; - unsigned B0D06:1; - unsigned B0D07:1; -} B0D0bits; -extern volatile far unsigned char B0D1; -extern volatile far struct { - unsigned B0D10:1; - unsigned B0D11:1; - unsigned B0D12:1; - unsigned B0D13:1; - unsigned B0D14:1; - unsigned B0D15:1; - unsigned B0D16:1; - unsigned B0D17:1; -} B0D1bits; -extern volatile far unsigned char B0D2; -extern volatile far struct { - unsigned B0D20:1; - unsigned B0D21:1; - unsigned B0D22:1; - unsigned B0D23:1; - unsigned B0D24:1; - unsigned B0D25:1; - unsigned B0D26:1; - unsigned B0D27:1; -} B0D2bits; -extern volatile far unsigned char B0D3; -extern volatile far struct { - unsigned B0D30:1; - unsigned B0D31:1; - unsigned B0D32:1; - unsigned B0D33:1; - unsigned B0D34:1; - unsigned B0D35:1; - unsigned B0D36:1; - unsigned B0D37:1; -} B0D3bits; -extern volatile far unsigned char B0D4; -extern volatile far struct { - unsigned B0D40:1; - unsigned B0D41:1; - unsigned B0D42:1; - unsigned B0D43:1; - unsigned B0D44:1; - unsigned B0D45:1; - unsigned B0D46:1; - unsigned B0D47:1; -} B0D4bits; -extern volatile far unsigned char B0D5; -extern volatile far struct { - unsigned B0D50:1; - unsigned B0D51:1; - unsigned B0D52:1; - unsigned B0D53:1; - unsigned B0D54:1; - unsigned B0D55:1; - unsigned B0D56:1; - unsigned B0D57:1; -} B0D5bits; -extern volatile far unsigned char B0D6; -extern volatile far struct { - unsigned B0D60:1; - unsigned B0D61:1; - unsigned B0D62:1; - unsigned B0D63:1; - unsigned B0D64:1; - unsigned B0D65:1; - unsigned B0D66:1; - unsigned B0D67:1; -} B0D6bits; -extern volatile far unsigned char B0D7; -extern volatile far struct { - unsigned B0D70:1; - unsigned B0D71:1; - unsigned B0D72:1; - unsigned B0D73:1; - unsigned B0D74:1; - unsigned B0D75:1; - unsigned B0D76:1; - unsigned B0D77:1; -} B0D7bits; -extern volatile far unsigned char CANSTAT_RO9; -extern volatile far struct { - unsigned ICODE0:1; - unsigned ICODE1:1; - unsigned ICODE2:1; - unsigned ICODE3:1; - unsigned ICODE4:1; - unsigned OPMODE:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANSTAT_RO9bits; -extern volatile far unsigned char CANCON_RO9; -extern volatile far struct { - unsigned :1; - unsigned WIN0:1; - unsigned WIN1:1; - unsigned WIN2:1; - unsigned ABAT:1; - unsigned REQOP0:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANCON_RO9bits; -extern volatile far unsigned char B1CON; -extern volatile far union { - struct { - unsigned FILHIT0:1; - unsigned FILHIT1:1; - unsigned FILHIT2:1; - unsigned FILHIT3:1; - unsigned FILHIT4:1; - unsigned RTRRO:1; - unsigned RXM1:1; - unsigned RXFUL:1; - }; - struct { - unsigned TXPRI0:1; - unsigned TXPRI1:1; - unsigned RTREN:1; - unsigned TXREQ:1; - unsigned TXERR:1; - unsigned TXLARB:1; - unsigned TXABT:1; - unsigned TXBIF:1; - }; - struct { - unsigned :5; - unsigned RXRTRRO:1; - }; -} B1CONbits; -extern volatile far unsigned char B1SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} B1SIDHbits; -extern volatile far unsigned char B1SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXID:1; - unsigned SRR:1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDE:1; - }; -} B1SIDLbits; -extern volatile far unsigned char B1EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} B1EIDHbits; -extern volatile far unsigned char B1EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} B1EIDLbits; -extern volatile far unsigned char B1DLC; -extern volatile far union { - struct { - unsigned DLC0:1; - unsigned DLC1:1; - unsigned DLC2:1; - unsigned DLC3:1; - unsigned RESRB0:1; - unsigned RESRB1:1; - unsigned RXRTR:1; - }; - struct { - unsigned :4; - unsigned RB0:1; - unsigned RB1:1; - }; - struct { - unsigned :6; - unsigned TXRTR:1; - }; -} B1DLCbits; -extern volatile far unsigned char B1D0; -extern volatile far struct { - unsigned B1D00:1; - unsigned B1D01:1; - unsigned B1D02:1; - unsigned B1D03:1; - unsigned B1D04:1; - unsigned B1D05:1; - unsigned B1D06:1; - unsigned B1D07:1; -} B1D0bits; -extern volatile far unsigned char B1D1; -extern volatile far struct { - unsigned B1D10:1; - unsigned B1D11:1; - unsigned B1D12:1; - unsigned B1D13:1; - unsigned B1D14:1; - unsigned B1D15:1; - unsigned B1D16:1; - unsigned B1D17:1; -} B1D1bits; -extern volatile far unsigned char B1D2; -extern volatile far struct { - unsigned B1D20:1; - unsigned B1D21:1; - unsigned B1D22:1; - unsigned B1D23:1; - unsigned B1D24:1; - unsigned B1D25:1; - unsigned B1D26:1; - unsigned B1D27:1; -} B1D2bits; -extern volatile far unsigned char B1D3; -extern volatile far struct { - unsigned B1D30:1; - unsigned B1D31:1; - unsigned B1D32:1; - unsigned B1D33:1; - unsigned B1D34:1; - unsigned B1D35:1; - unsigned B1D36:1; - unsigned B1D37:1; -} B1D3bits; -extern volatile far unsigned char B1D4; -extern volatile far struct { - unsigned B1D40:1; - unsigned B1D41:1; - unsigned B1D42:1; - unsigned B1D43:1; - unsigned B1D44:1; - unsigned B1D45:1; - unsigned B1D46:1; - unsigned B1D47:1; -} B1D4bits; -extern volatile far unsigned char B1D5; -extern volatile far struct { - unsigned B1D50:1; - unsigned B1D51:1; - unsigned B1D52:1; - unsigned B1D53:1; - unsigned B1D54:1; - unsigned B1D55:1; - unsigned B1D56:1; - unsigned B1D57:1; -} B1D5bits; -extern volatile far unsigned char B1D6; -extern volatile far struct { - unsigned B1D60:1; - unsigned B1D61:1; - unsigned B1D62:1; - unsigned B1D63:1; - unsigned B1D64:1; - unsigned B1D65:1; - unsigned B1D66:1; - unsigned B1D67:1; -} B1D6bits; -extern volatile far unsigned char B1D7; -extern volatile far struct { - unsigned B1D70:1; - unsigned B1D71:1; - unsigned B1D72:1; - unsigned B1D73:1; - unsigned B1D74:1; - unsigned B1D75:1; - unsigned B1D76:1; - unsigned B1D77:1; -} B1D7bits; -extern volatile far unsigned char CANSTAT_RO8; -extern volatile far struct { - unsigned ICODE0:1; - unsigned ICODE1:1; - unsigned ICODE2:1; - unsigned ICODE3:1; - unsigned ICODE4:1; - unsigned OPMODE:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANSTAT_RO8bits; -extern volatile far unsigned char CANCON_RO8; -extern volatile far struct { - unsigned :1; - unsigned WIN0:1; - unsigned WIN1:1; - unsigned WIN2:1; - unsigned ABAT:1; - unsigned REQOP0:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANCON_RO8bits; -extern volatile far unsigned char B2CON; -extern volatile far union { - struct { - unsigned FILHIT0:1; - unsigned FILHIT1:1; - unsigned FILHIT2:1; - unsigned FILHIT3:1; - unsigned FILHIT4:1; - unsigned RTRRO:1; - unsigned RXM1:1; - unsigned RXFUL:1; - }; - struct { - unsigned TXPRI0:1; - unsigned TXPRI1:1; - unsigned RTREN:1; - unsigned TXREQ:1; - unsigned TXERR:1; - unsigned TXLARB:1; - unsigned TXABT:1; - unsigned TXBIF:1; - }; - struct { - unsigned :5; - unsigned RXRTRRO:1; - }; -} B2CONbits; -extern volatile far unsigned char B2SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} B2SIDHbits; -extern volatile far unsigned char B2SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXID:1; - unsigned SRR:1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDE:1; - }; -} B2SIDLbits; -extern volatile far unsigned char B2EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} B2EIDHbits; -extern volatile far unsigned char B2EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} B2EIDLbits; -extern volatile far unsigned char B2DLC; -extern volatile far union { - struct { - unsigned DLC0:1; - unsigned DLC1:1; - unsigned DLC2:1; - unsigned DLC3:1; - unsigned RESRB0:1; - unsigned RESRB1:1; - unsigned RXRTR:1; - }; - struct { - unsigned :6; - unsigned TXRTR:1; - }; - struct { - unsigned :4; - unsigned RB0:1; - unsigned RB1:1; - }; -} B2DLCbits; -extern volatile far unsigned char B2D0; -extern volatile far struct { - unsigned B2D00:1; - unsigned B2D01:1; - unsigned B2D02:1; - unsigned B2D03:1; - unsigned B2D04:1; - unsigned B2D05:1; - unsigned B2D06:1; - unsigned B2D07:1; -} B2D0bits; -extern volatile far unsigned char B2D1; -extern volatile far struct { - unsigned B2D10:1; - unsigned B2D11:1; - unsigned B2D12:1; - unsigned B2D13:1; - unsigned B2D14:1; - unsigned B2D15:1; - unsigned B2D16:1; - unsigned B2D17:1; -} B2D1bits; -extern volatile far unsigned char B2D2; -extern volatile far struct { - unsigned B2D20:1; - unsigned B2D21:1; - unsigned B2D22:1; - unsigned B2D23:1; - unsigned B2D24:1; - unsigned B2D25:1; - unsigned B2D26:1; - unsigned B2D27:1; -} B2D2bits; -extern volatile far unsigned char B2D3; -extern volatile far struct { - unsigned B2D30:1; - unsigned B2D31:1; - unsigned B2D32:1; - unsigned B2D33:1; - unsigned B2D34:1; - unsigned B2D35:1; - unsigned B2D36:1; - unsigned B2D37:1; -} B2D3bits; -extern volatile far unsigned char B2D4; -extern volatile far struct { - unsigned B2D40:1; - unsigned B2D41:1; - unsigned B2D42:1; - unsigned B2D43:1; - unsigned B2D44:1; - unsigned B2D45:1; - unsigned B2D46:1; - unsigned B2D47:1; -} B2D4bits; -extern volatile far unsigned char B2D5; -extern volatile far struct { - unsigned B2D50:1; - unsigned B2D51:1; - unsigned B2D52:1; - unsigned B2D53:1; - unsigned B2D54:1; - unsigned B2D55:1; - unsigned B2D56:1; - unsigned B2D57:1; -} B2D5bits; -extern volatile far unsigned char B2D6; -extern volatile far struct { - unsigned B2D60:1; - unsigned B2D61:1; - unsigned B2D62:1; - unsigned B2D63:1; - unsigned B2D64:1; - unsigned B2D65:1; - unsigned B2D66:1; - unsigned B2D67:1; -} B2D6bits; -extern volatile far unsigned char B2D7; -extern volatile far struct { - unsigned B2D70:1; - unsigned B2D71:1; - unsigned B2D72:1; - unsigned B2D73:1; - unsigned B2D74:1; - unsigned B2D75:1; - unsigned B2D76:1; - unsigned B2D77:1; -} B2D7bits; -extern volatile far unsigned char CANSTAT_RO7; -extern volatile far struct { - unsigned ICODE0:1; - unsigned ICODE1:1; - unsigned ICODE2:1; - unsigned ICODE3:1; - unsigned ICODE4:1; - unsigned OPMODE:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANSTAT_RO7bits; -extern volatile far unsigned char CANCON_RO7; -extern volatile far struct { - unsigned :1; - unsigned WIN0:1; - unsigned WIN1:1; - unsigned WIN2:1; - unsigned ABAT:1; - unsigned REQOP0:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANCON_RO7bits; -extern volatile far unsigned char B3CON; -extern volatile far union { - struct { - unsigned FILHIT0:1; - unsigned FILHIT1:1; - unsigned FILHIT2:1; - unsigned FILHIT3:1; - unsigned FILHIT4:1; - unsigned RTRRO:1; - unsigned RXM1:1; - unsigned RXFUL:1; - }; - struct { - unsigned TXPRI0:1; - unsigned TXPRI1:1; - unsigned RTREN:1; - unsigned TXREQ:1; - unsigned TXERR:1; - unsigned TXLARB:1; - unsigned TXABT:1; - unsigned TXBIF:1; - }; - struct { - unsigned :5; - unsigned RXRTRRO:1; - }; -} B3CONbits; -extern volatile far unsigned char B3SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} B3SIDHbits; -extern volatile far unsigned char B3SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXID:1; - unsigned SRR:1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDE:1; - }; -} B3SIDLbits; -extern volatile far unsigned char B3EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} B3EIDHbits; -extern volatile far unsigned char B3EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} B3EIDLbits; -extern volatile far unsigned char B3DLC; -extern volatile far union { - struct { - unsigned DLC0:1; - unsigned DLC1:1; - unsigned DLC2:1; - unsigned DLC3:1; - unsigned RESRB0:1; - unsigned RESRB1:1; - unsigned RXRTR:1; - }; - struct { - unsigned :6; - unsigned TXRTR:1; - }; - struct { - unsigned :4; - unsigned RB0:1; - unsigned RB1:1; - }; -} B3DLCbits; -extern volatile far unsigned char B3D0; -extern volatile far struct { - unsigned B3D00:1; - unsigned B3D01:1; - unsigned B3D02:1; - unsigned B3D03:1; - unsigned B3D04:1; - unsigned B3D05:1; - unsigned B3D06:1; - unsigned B3D07:1; -} B3D0bits; -extern volatile far unsigned char B3D1; -extern volatile far struct { - unsigned B3D10:1; - unsigned B3D11:1; - unsigned B3D12:1; - unsigned B3D13:1; - unsigned B3D14:1; - unsigned B3D15:1; - unsigned B3D16:1; - unsigned B3D17:1; -} B3D1bits; -extern volatile far unsigned char B3D2; -extern volatile far struct { - unsigned B3D20:1; - unsigned B3D21:1; - unsigned B3D22:1; - unsigned B3D23:1; - unsigned B3D24:1; - unsigned B3D25:1; - unsigned B3D26:1; - unsigned B3D27:1; -} B3D2bits; -extern volatile far unsigned char B3D3; -extern volatile far struct { - unsigned B3D30:1; - unsigned B3D31:1; - unsigned B3D32:1; - unsigned B3D33:1; - unsigned B3D34:1; - unsigned B3D35:1; - unsigned B3D36:1; - unsigned B3D37:1; -} B3D3bits; -extern volatile far unsigned char B3D4; -extern volatile far struct { - unsigned B3D40:1; - unsigned B3D41:1; - unsigned B3D42:1; - unsigned B3D43:1; - unsigned B3D44:1; - unsigned B3D45:1; - unsigned B3D46:1; - unsigned B3D47:1; -} B3D4bits; -extern volatile far unsigned char B3D5; -extern volatile far struct { - unsigned B3D50:1; - unsigned B3D51:1; - unsigned B3D52:1; - unsigned B3D53:1; - unsigned B3D54:1; - unsigned B3D55:1; - unsigned B3D56:1; - unsigned B3D57:1; -} B3D5bits; -extern volatile far unsigned char B3D6; -extern volatile far struct { - unsigned B3D60:1; - unsigned B3D61:1; - unsigned B3D62:1; - unsigned B3D63:1; - unsigned B3D64:1; - unsigned B3D65:1; - unsigned B3D66:1; - unsigned B3D67:1; -} B3D6bits; -extern volatile far unsigned char B3D7; -extern volatile far struct { - unsigned B3D70:1; - unsigned B3D71:1; - unsigned B3D72:1; - unsigned B3D73:1; - unsigned B3D74:1; - unsigned B3D75:1; - unsigned B3D76:1; - unsigned B3D77:1; -} B3D7bits; -extern volatile far unsigned char CANSTAT_RO6; -extern volatile far struct { - unsigned ICODE0:1; - unsigned ICODE1:1; - unsigned ICODE2:1; - unsigned ICODE3:1; - unsigned ICODE4:1; - unsigned OPMODE:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANSTAT_RO6bits; -extern volatile far unsigned char CANCON_RO6; -extern volatile far struct { - unsigned :1; - unsigned WIN0:1; - unsigned WIN1:1; - unsigned WIN2:1; - unsigned ABAT:1; - unsigned REQOP0:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANCON_RO6bits; -extern volatile far unsigned char B4CON; -extern volatile far union { - struct { - unsigned FILHIT0:1; - unsigned FILHIT1:1; - unsigned FILHIT2:1; - unsigned FILHIT3:1; - unsigned FILHIT4:1; - unsigned RTRRO:1; - unsigned RXM1:1; - unsigned RXFUL:1; - }; - struct { - unsigned TXPRI0:1; - unsigned TXPRI1:1; - unsigned RTREN:1; - unsigned TXREQ:1; - unsigned TXERR:1; - unsigned TXLARB:1; - unsigned TXABT:1; - unsigned TXBIF:1; - }; - struct { - unsigned :5; - unsigned RXRTRRO:1; - }; -} B4CONbits; -extern volatile far unsigned char B4SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} B4SIDHbits; -extern volatile far unsigned char B4SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXID:1; - unsigned SRR:1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDE:1; - }; -} B4SIDLbits; -extern volatile far unsigned char B4EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} B4EIDHbits; -extern volatile far unsigned char B4EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} B4EIDLbits; -extern volatile far unsigned char B4DLC; -extern volatile far union { - struct { - unsigned DLC0:1; - unsigned DLC1:1; - unsigned DLC2:1; - unsigned DLC3:1; - unsigned RESRB0:1; - unsigned RESRB1:1; - unsigned RXRTR:1; - }; - struct { - unsigned :6; - unsigned TXRTR:1; - }; - struct { - unsigned :4; - unsigned RB0:1; - unsigned RB1:1; - }; -} B4DLCbits; -extern volatile far unsigned char B4D0; -extern volatile far struct { - unsigned B4D00:1; - unsigned B4D01:1; - unsigned B4D02:1; - unsigned B4D03:1; - unsigned B4D04:1; - unsigned B4D05:1; - unsigned B4D06:1; - unsigned B4D07:1; -} B4D0bits; -extern volatile far unsigned char B4D1; -extern volatile far struct { - unsigned B4D10:1; - unsigned B4D11:1; - unsigned B4D12:1; - unsigned B4D13:1; - unsigned B4D14:1; - unsigned B4D15:1; - unsigned B4D16:1; - unsigned B4D17:1; -} B4D1bits; -extern volatile far unsigned char B4D2; -extern volatile far struct { - unsigned B4D20:1; - unsigned B4D21:1; - unsigned B4D22:1; - unsigned B4D23:1; - unsigned B4D24:1; - unsigned B4D25:1; - unsigned B4D26:1; - unsigned B4D27:1; -} B4D2bits; -extern volatile far unsigned char B4D3; -extern volatile far struct { - unsigned B4D30:1; - unsigned B4D31:1; - unsigned B4D32:1; - unsigned B4D33:1; - unsigned B4D34:1; - unsigned B4D35:1; - unsigned B4D36:1; - unsigned B4D37:1; -} B4D3bits; -extern volatile far unsigned char B4D4; -extern volatile far struct { - unsigned B4D40:1; - unsigned B4D41:1; - unsigned B4D42:1; - unsigned B4D43:1; - unsigned B4D44:1; - unsigned B4D45:1; - unsigned B4D46:1; - unsigned B4D47:1; -} B4D4bits; -extern volatile far unsigned char B4D5; -extern volatile far struct { - unsigned B4D50:1; - unsigned B4D51:1; - unsigned B4D52:1; - unsigned B4D53:1; - unsigned B4D54:1; - unsigned B4D55:1; - unsigned B4D56:1; - unsigned B4D57:1; -} B4D5bits; -extern volatile far unsigned char B4D6; -extern volatile far struct { - unsigned B4D60:1; - unsigned B4D61:1; - unsigned B4D62:1; - unsigned B4D63:1; - unsigned B4D64:1; - unsigned B4D65:1; - unsigned B4D66:1; - unsigned B4D67:1; -} B4D6bits; -extern volatile far unsigned char B4D7; -extern volatile far union { - struct { - unsigned B4D70:1; - unsigned B4D71:1; - unsigned B4D72:1; - unsigned B4D73:1; - unsigned B4D74:1; - unsigned B4D75:1; - unsigned B4D76:1; - unsigned B46D77:1; - }; - struct { - unsigned :7; - unsigned B4D77:1; - }; -} B4D7bits; -extern volatile far unsigned char CANSTAT_RO5; -extern volatile far struct { - unsigned ICODE0:1; - unsigned ICODE1:1; - unsigned ICODE2:1; - unsigned ICODE3:1; - unsigned ICODE4:1; - unsigned OPMODE:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANSTAT_RO5bits; -extern volatile far unsigned char CANCON_RO5; -extern volatile far struct { - unsigned :1; - unsigned WIN0:1; - unsigned WIN1:1; - unsigned WIN2:1; - unsigned ABAT:1; - unsigned REQOP0:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANCON_RO5bits; -extern volatile far unsigned char B5CON; -extern volatile far union { - struct { - unsigned FILHIT0:1; - unsigned FILHIT1:1; - unsigned FILHIT2:1; - unsigned FILHIT3:1; - unsigned FILHIT4:1; - unsigned RTRRO:1; - unsigned RXM1:1; - unsigned RXFUL:1; - }; - struct { - unsigned TXPRI0:1; - unsigned TXPRI1:1; - unsigned RTREN:1; - unsigned TXREQ:1; - unsigned TXERR:1; - unsigned TXLARB:1; - unsigned TXABT:1; - unsigned TXBIF:1; - }; - struct { - unsigned :5; - unsigned RXRTRRO:1; - }; -} B5CONbits; -extern volatile far unsigned char B5SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} B5SIDHbits; -extern volatile far unsigned char B5SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXID:1; - unsigned SRR:1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDEN:1; - }; -} B5SIDLbits; -extern volatile far unsigned char B5EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} B5EIDHbits; -extern volatile far unsigned char B5EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} B5EIDLbits; -extern volatile far unsigned char B5DLC; -extern volatile far union { - struct { - unsigned DLC0:1; - unsigned DLC1:1; - unsigned DLC2:1; - unsigned DLC3:1; - unsigned RESRB0:1; - unsigned RESRB1:1; - unsigned RXRTR:1; - }; - struct { - unsigned :4; - unsigned RB0:1; - unsigned RB1:1; - }; -} B5DLCbits; -extern volatile far unsigned char B5D0; -extern volatile far union { - struct { - unsigned B5D00:1; - unsigned B5D01:1; - unsigned B5D02:1; - unsigned B5D03:1; - unsigned B5D04:1; - unsigned B5D05:1; - unsigned B5D06:1; - unsigned B57D07:1; - }; - struct { - unsigned :7; - unsigned B5D07:1; - }; -} B5D0bits; -extern volatile far unsigned char B5D1; -extern volatile far struct { - unsigned B5D10:1; - unsigned B5D11:1; - unsigned B5D12:1; - unsigned B5D13:1; - unsigned B5D14:1; - unsigned B5D15:1; - unsigned B5D16:1; - unsigned B5D17:1; -} B5D1bits; -extern volatile far unsigned char B5D2; -extern volatile far union { - struct { - unsigned B5D20:1; - unsigned B5D21:1; - unsigned B5D22:1; - unsigned B57D23:1; - unsigned B5D24:1; - unsigned B5D25:1; - unsigned B5D26:1; - unsigned B5D27:1; - }; - struct { - unsigned :3; - unsigned B5D23:1; - }; -} B5D2bits; -extern volatile far unsigned char B5D3; -extern volatile far struct { - unsigned B5D30:1; - unsigned B5D31:1; - unsigned B5D32:1; - unsigned B5D33:1; - unsigned B5D34:1; - unsigned B5D35:1; - unsigned B5D36:1; - unsigned B5D37:1; -} B5D3bits; -extern volatile far unsigned char B5D4; -extern volatile far struct { - unsigned B5D40:1; - unsigned B5D41:1; - unsigned B5D42:1; - unsigned B5D43:1; - unsigned B5D44:1; - unsigned B5D45:1; - unsigned B5D46:1; - unsigned B5D47:1; -} B5D4bits; -extern volatile far unsigned char B5D5; -extern volatile far struct { - unsigned B5D50:1; - unsigned B5D51:1; - unsigned B5D52:1; - unsigned B5D53:1; - unsigned B5D54:1; - unsigned B5D55:1; - unsigned B5D56:1; - unsigned B5D57:1; -} B5D5bits; -extern volatile far unsigned char B5D6; -extern volatile far struct { - unsigned B5D60:1; - unsigned B5D61:1; - unsigned B5D62:1; - unsigned B5D63:1; - unsigned B5D64:1; - unsigned B5D65:1; - unsigned B5D66:1; - unsigned B5D67:1; -} B5D6bits; -extern volatile far unsigned char B5D7; -extern volatile far struct { - unsigned B5D70:1; - unsigned B5D71:1; - unsigned B5D72:1; - unsigned B5D73:1; - unsigned B5D74:1; - unsigned B5D75:1; - unsigned B5D76:1; - unsigned B5D77:1; -} B5D7bits; -extern volatile far unsigned char CANSTAT_RO4; -extern volatile far struct { - unsigned ICODE0:1; - unsigned ICODE1:1; - unsigned ICODE2:1; - unsigned ICODE3:1; - unsigned ICODE4:1; - unsigned OPMODE:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANSTAT_RO4bits; -extern volatile far unsigned char CANCON_RO4; -extern volatile far struct { - unsigned :1; - unsigned WIN0:1; - unsigned WIN1:1; - unsigned WIN2:1; - unsigned ABAT:1; - unsigned REQOP0:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANCON_RO4bits; -extern volatile far unsigned char RXF0SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXF0SIDHbits; -extern volatile far unsigned char RXF0SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDEN:1; - }; -} RXF0SIDLbits; -extern volatile far unsigned char RXF0EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXF0EIDHbits; -extern volatile far unsigned char RXF0EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXF0EIDLbits; -extern volatile far unsigned char RXF1SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXF1SIDHbits; -extern volatile far unsigned char RXF1SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDEN:1; - }; -} RXF1SIDLbits; -extern volatile far unsigned char RXF1EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXF1EIDHbits; -extern volatile far unsigned char RXF1EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXF1EIDLbits; -extern volatile far unsigned char RXF2SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXF2SIDHbits; -extern volatile far unsigned char RXF2SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDEN:1; - }; -} RXF2SIDLbits; -extern volatile far unsigned char RXF2EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXF2EIDHbits; -extern volatile far unsigned char RXF2EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXF2EIDLbits; -extern volatile far unsigned char RXF3SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXF3SIDHbits; -extern volatile far unsigned char RXF3SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDEN:1; - }; -} RXF3SIDLbits; -extern volatile far unsigned char RXF3EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXF3EIDHbits; -extern volatile far unsigned char RXF3EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXF3EIDLbits; -extern volatile far unsigned char RXF4SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXF4SIDHbits; -extern volatile far unsigned char RXF4SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDEN:1; - }; -} RXF4SIDLbits; -extern volatile far unsigned char RXF4EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXF4EIDHbits; -extern volatile far unsigned char RXF4EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXF4EIDLbits; -extern volatile far unsigned char RXF5SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXF5SIDHbits; -extern volatile far unsigned char RXF5SIDL; -extern volatile far union { - struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; - }; - struct { - unsigned :3; - unsigned EXIDEN:1; - }; -} RXF5SIDLbits; -extern volatile far unsigned char RXF5EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXF5EIDHbits; -extern volatile far unsigned char RXF5EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXF5EIDLbits; -extern volatile far unsigned char RXM0SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXM0SIDHbits; -extern volatile far unsigned char RXM0SIDL; -extern volatile far struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDEN:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; -} RXM0SIDLbits; -extern volatile far unsigned char RXM0EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXM0EIDHbits; -extern volatile far unsigned char RXM0EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXM0EIDLbits; -extern volatile far unsigned char RXM1SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXM1SIDHbits; -extern volatile far unsigned char RXM1SIDL; -extern volatile far struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDEN:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; -} RXM1SIDLbits; -extern volatile far unsigned char RXM1EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXM1EIDHbits; -extern volatile far unsigned char RXM1EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXM1EIDLbits; -extern volatile far unsigned char TXB2CON; -extern volatile far union { - struct { - unsigned TXPRI0:1; - unsigned TXPRI1:1; - unsigned :1; - unsigned TXREQ:1; - unsigned TXERR:1; - unsigned TXLARB:1; - unsigned TXABT:1; - unsigned TXBIFBXB2CON:1; - }; - struct { - unsigned :7; - unsigned TXBIF:1; - }; -} TXB2CONbits; -extern volatile far unsigned char TXB2SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} TXB2SIDHbits; -extern volatile far unsigned char TXB2SIDL; -extern volatile far struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; -} TXB2SIDLbits; -extern volatile far unsigned char TXB2EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} TXB2EIDHbits; -extern volatile far unsigned char TXB2EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} TXB2EIDLbits; -extern volatile far unsigned char TXB2DLC; -extern volatile far struct { - unsigned DLC0:1; - unsigned DLC1:1; - unsigned DLC2:1; - unsigned DLC3:1; - unsigned :2; - unsigned TXRTR:1; -} TXB2DLCbits; -extern volatile far unsigned char TXB2D0; -extern volatile far struct { - unsigned TXB2D00:1; - unsigned TXB2D01:1; - unsigned TXB2D02:1; - unsigned TXB2D03:1; - unsigned TXB2D04:1; - unsigned TXB2D05:1; - unsigned TXB2D06:1; - unsigned TXB2D07:1; -} TXB2D0bits; -extern volatile far unsigned char TXB2D1; -extern volatile far struct { - unsigned TXB2D10:1; - unsigned TXB2D11:1; - unsigned TXB2D12:1; - unsigned TXB2D13:1; - unsigned TXB2D14:1; - unsigned TXB2D15:1; - unsigned TXB2D16:1; - unsigned TXB2D17:1; -} TXB2D1bits; -extern volatile far unsigned char TXB2D2; -extern volatile far struct { - unsigned TXB2D20:1; - unsigned TXB2D21:1; - unsigned TXB2D22:1; - unsigned TXB2D23:1; - unsigned TXB2D24:1; - unsigned TXB2D25:1; - unsigned TXB2D26:1; - unsigned TXB2D27:1; -} TXB2D2bits; -extern volatile far unsigned char TXB2D3; -extern volatile far struct { - unsigned TXB2D30:1; - unsigned TXB2D31:1; - unsigned TXB2D32:1; - unsigned TXB2D33:1; - unsigned TXB2D34:1; - unsigned TXB2D35:1; - unsigned TXB2D36:1; - unsigned TXB2D37:1; -} TXB2D3bits; -extern volatile far unsigned char TXB2D4; -extern volatile far struct { - unsigned TXB2D40:1; - unsigned TXB2D41:1; - unsigned TXB2D42:1; - unsigned TXB2D43:1; - unsigned TXB2D44:1; - unsigned TXB2D45:1; - unsigned TXB2D46:1; - unsigned TXB2D47:1; -} TXB2D4bits; -extern volatile far unsigned char TXB2D5; -extern volatile far struct { - unsigned TXB2D50:1; - unsigned TXB2D51:1; - unsigned TXB2D52:1; - unsigned TXB2D53:1; - unsigned TXB2D54:1; - unsigned TXB2D55:1; - unsigned TXB2D56:1; - unsigned TXB2D57:1; -} TXB2D5bits; -extern volatile far unsigned char TXB2D6; -extern volatile far struct { - unsigned TXB2D60:1; - unsigned TXB2D61:1; - unsigned TXB2D62:1; - unsigned TXB2D63:1; - unsigned TXB2D64:1; - unsigned TXB2D65:1; - unsigned TXB2D66:1; - unsigned TXB2D67:1; -} TXB2D6bits; -extern volatile far unsigned char TXB2D7; -extern volatile far struct { - unsigned TXB2D70:1; - unsigned TXB2D71:1; - unsigned TXB2D72:1; - unsigned TXB2D73:1; - unsigned TXB2D74:1; - unsigned TXB2D75:1; - unsigned TXB2D76:1; - unsigned TXB2D77:1; -} TXB2D7bits; -extern volatile far unsigned char CANSTAT_RO3; -extern volatile far struct { - unsigned ICODE0:1; - unsigned ICODE1:1; - unsigned ICODE2:1; - unsigned ICODE3:1; - unsigned ICODE4:1; - unsigned OPMODE:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANSTAT_RO3bits; -extern volatile far unsigned char CANCON_RO3; -extern volatile far struct { - unsigned :1; - unsigned WIN0:1; - unsigned WIN1:1; - unsigned WIN2:1; - unsigned ABAT:1; - unsigned REQOP0:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANCON_RO3bits; -extern volatile far unsigned char TXB1CON; -extern volatile far union { - struct { - unsigned TXPRI0:1; - unsigned TXPRI1:1; - unsigned :1; - unsigned TXREQ:1; - unsigned TXERR:1; - unsigned TXLARB:1; - unsigned TXABT:1; - unsigned TXBIFTXB1CON:1; - }; - struct { - unsigned :7; - unsigned TXBIF:1; - }; -} TXB1CONbits; -extern volatile far unsigned char TXB1SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} TXB1SIDHbits; -extern volatile far unsigned char TXB1SIDL; -extern volatile far struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; -} TXB1SIDLbits; -extern volatile far unsigned char TXB1EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} TXB1EIDHbits; -extern volatile far unsigned char TXB1EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} TXB1EIDLbits; -extern volatile far unsigned char TXB1DLC; -extern volatile far struct { - unsigned DLC0:1; - unsigned DLC1:1; - unsigned DLC2:1; - unsigned DLC3:1; - unsigned :2; - unsigned TXRTR:1; -} TXB1DLCbits; -extern volatile far unsigned char TXB1D0; -extern volatile far struct { - unsigned TXB1D00:1; - unsigned TXB1D01:1; - unsigned TXB1D02:1; - unsigned TXB1D03:1; - unsigned TXB1D04:1; - unsigned TXB1D05:1; - unsigned TXB1D06:1; - unsigned TXB1D07:1; -} TXB1D0bits; -extern volatile far unsigned char TXB1D1; -extern volatile far struct { - unsigned TXB1D10:1; - unsigned TXB1D11:1; - unsigned TXB1D12:1; - unsigned TXB1D13:1; - unsigned TXB1D14:1; - unsigned TXB1D15:1; - unsigned TXB1D16:1; - unsigned TXB1D17:1; -} TXB1D1bits; -extern volatile far unsigned char TXB1D2; -extern volatile far struct { - unsigned TXB1D20:1; - unsigned TXB1D21:1; - unsigned TXB1D22:1; - unsigned TXB1D23:1; - unsigned TXB1D24:1; - unsigned TXB1D25:1; - unsigned TXB1D26:1; - unsigned TXB1D27:1; -} TXB1D2bits; -extern volatile far unsigned char TXB1D3; -extern volatile far struct { - unsigned TXB1D30:1; - unsigned TXB1D31:1; - unsigned TXB1D32:1; - unsigned TXB1D33:1; - unsigned TXB1D34:1; - unsigned TXB1D35:1; - unsigned TXB1D36:1; - unsigned TXB1D37:1; -} TXB1D3bits; -extern volatile far unsigned char TXB1D4; -extern volatile far struct { - unsigned TXB1D40:1; - unsigned TXB1D41:1; - unsigned TXB1D42:1; - unsigned TXB1D43:1; - unsigned TXB1D44:1; - unsigned TXB1D45:1; - unsigned TXB1D46:1; - unsigned TXB1D47:1; -} TXB1D4bits; -extern volatile far unsigned char TXB1D5; -extern volatile far struct { - unsigned TXB1D50:1; - unsigned TXB1D51:1; - unsigned TXB1D52:1; - unsigned TXB1D53:1; - unsigned TXB1D54:1; - unsigned TXB1D55:1; - unsigned TXB1D56:1; - unsigned TXB1D57:1; -} TXB1D5bits; -extern volatile far unsigned char TXB1D6; -extern volatile far struct { - unsigned TXB1D60:1; - unsigned TXB1D61:1; - unsigned TXB1D62:1; - unsigned TXB1D63:1; - unsigned TXB1D64:1; - unsigned TXB1D65:1; - unsigned TXB1D66:1; - unsigned TXB1D67:1; -} TXB1D6bits; -extern volatile far unsigned char TXB1D7; -extern volatile far struct { - unsigned TXB1D70:1; - unsigned TXB1D71:1; - unsigned TXB1D72:1; - unsigned TXB1D73:1; - unsigned TXB1D74:1; - unsigned TXB1D75:1; - unsigned TXB1D76:1; - unsigned TXB1D77:1; -} TXB1D7bits; -extern volatile far unsigned char CANSTAT_RO2; -extern volatile far struct { - unsigned ICODE0:1; - unsigned ICODE1:1; - unsigned ICODE2:1; - unsigned ICODE3:1; - unsigned ICODE4:1; - unsigned OPMODE:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANSTAT_RO2bits; -extern volatile far unsigned char CANCON_RO2; -extern volatile far struct { - unsigned :1; - unsigned WIN0:1; - unsigned WIN1:1; - unsigned WIN2:1; - unsigned ABAT:1; - unsigned REQOP0:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANCON_RO2bits; -extern volatile far unsigned char TXB0CON; -extern volatile far union { - struct { - unsigned TXPRI0:1; - unsigned TXPRI1:1; - unsigned :1; - unsigned TXREQ:1; - unsigned TXERR:1; - unsigned TXLARB:1; - unsigned TXABT:1; - }; - struct { - unsigned :7; - unsigned TXBIF:1; - }; -} TXB0CONbits; -extern volatile far unsigned char TXB0SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} TXB0SIDHbits; -extern volatile far unsigned char TXB0SIDL; -extern volatile far struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXIDE:1; - unsigned :1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; -} TXB0SIDLbits; -extern volatile far unsigned char TXB0EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} TXB0EIDHbits; -extern volatile far unsigned char TXB0EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} TXB0EIDLbits; -extern volatile far unsigned char TXB0DLC; -extern volatile far struct { - unsigned DLC0:1; - unsigned DLC1:1; - unsigned DLC2:1; - unsigned DLC3:1; - unsigned :2; - unsigned TXRTR:1; -} TXB0DLCbits; -extern volatile far unsigned char TXB0D0; -extern volatile far struct { - unsigned TXB0D00:1; - unsigned TXB0D01:1; - unsigned TXB0D02:1; - unsigned TXB0D03:1; - unsigned TXB0D04:1; - unsigned TXB0D05:1; - unsigned TXB0D06:1; - unsigned TXB0D07:1; -} TXB0D0bits; -extern volatile far unsigned char TXB0D1; -extern volatile far struct { - unsigned TXB0D10:1; - unsigned TXB0D11:1; - unsigned TXB0D12:1; - unsigned TXB0D13:1; - unsigned TXB0D14:1; - unsigned TXB0D15:1; - unsigned TXB0D16:1; - unsigned TXB0D17:1; -} TXB0D1bits; -extern volatile far unsigned char TXB0D2; -extern volatile far struct { - unsigned TXB0D20:1; - unsigned TXB0D21:1; - unsigned TXB0D22:1; - unsigned TXB0D23:1; - unsigned TXB0D24:1; - unsigned TXB0D25:1; - unsigned TXB0D26:1; - unsigned TXB0D27:1; -} TXB0D2bits; -extern volatile far unsigned char TXB0D3; -extern volatile far struct { - unsigned TXB0D30:1; - unsigned TXB0D31:1; - unsigned TXB0D32:1; - unsigned TXB0D33:1; - unsigned TXB0D34:1; - unsigned TXB0D35:1; - unsigned TXB0D36:1; - unsigned TXB0D37:1; -} TXB0D3bits; -extern volatile far unsigned char TXB0D4; -extern volatile far struct { - unsigned TXB0D40:1; - unsigned TXB0D41:1; - unsigned TXB0D42:1; - unsigned TXB0D43:1; - unsigned TXB0D44:1; - unsigned TXB0D45:1; - unsigned TXB0D46:1; - unsigned TXB0D47:1; -} TXB0D4bits; -extern volatile far unsigned char TXB0D5; -extern volatile far struct { - unsigned TXB0D50:1; - unsigned TXB0D51:1; - unsigned TXB0D52:1; - unsigned TXB0D53:1; - unsigned TXB0D54:1; - unsigned TXB0D55:1; - unsigned TXB0D56:1; - unsigned TXB0D57:1; -} TXB0D5bits; -extern volatile far unsigned char TXB0D6; -extern volatile far struct { - unsigned TXB0D60:1; - unsigned TXB0D61:1; - unsigned TXB0D62:1; - unsigned TXB0D63:1; - unsigned TXB0D64:1; - unsigned TXB0D65:1; - unsigned TXB0D66:1; - unsigned TXB0D67:1; -} TXB0D6bits; -extern volatile far unsigned char TXB0D7; -extern volatile far struct { - unsigned TXB0D70:1; - unsigned TXB0D71:1; - unsigned TXB0D72:1; - unsigned TXB0D73:1; - unsigned TXB0D74:1; - unsigned TXB0D75:1; - unsigned TXB0D76:1; - unsigned TXB0D77:1; -} TXB0D7bits; -extern volatile far unsigned char CANSTAT_RO1; -extern volatile far struct { - unsigned ICODE0:1; - unsigned ICODE1:1; - unsigned ICODE2:1; - unsigned ICODE3:1; - unsigned ICODE4:1; - unsigned OPMODE:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANSTAT_RO1bits; -extern volatile far unsigned char CANCON_RO1; -extern volatile far struct { - unsigned :1; - unsigned WIN0:1; - unsigned WIN1:1; - unsigned WIN2:1; - unsigned ABAT:1; - unsigned REQOP0:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANCON_RO1bits; -extern volatile far unsigned char RXB1CON; -extern volatile far union { - struct { - unsigned FILHIT0:1; - unsigned FILHIT1:1; - unsigned FILHIT2:1; - unsigned RXRTRRO:1; - unsigned :1; - unsigned RXM0:1; - unsigned RXM1:1; - unsigned RXFUL:1; - }; - struct { - unsigned :3; - unsigned FILHIT3:1; - unsigned FILHIT4:1; - unsigned RTRRO:1; - }; -} RXB1CONbits; -extern volatile far unsigned char RXB1SIDH; -extern volatile far struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXB1SIDHbits; -extern volatile far unsigned char RXB1SIDL; -extern volatile far struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXID:1; - unsigned SRR:1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; -} RXB1SIDLbits; -extern volatile far unsigned char RXB1EIDH; -extern volatile far struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXB1EIDHbits; -extern volatile far unsigned char RXB1EIDL; -extern volatile far struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXB1EIDLbits; -extern volatile far unsigned char RXB1DLC; -extern volatile far union { - struct { - unsigned DLC0:1; - unsigned DLC1:1; - unsigned DLC2:1; - unsigned DLC3:1; - unsigned RESRB0:1; - unsigned RESRB1:1; - unsigned RXRTR:1; - }; - struct { - unsigned :4; - unsigned RB0:1; - unsigned RB1:1; - }; -} RXB1DLCbits; -extern volatile far unsigned char RXB1D0; -extern volatile far struct { - unsigned RXB1D00:1; - unsigned RXB1D01:1; - unsigned RXB1D02:1; - unsigned RXB1D03:1; - unsigned RXB1D04:1; - unsigned RXB1D05:1; - unsigned RXB1D06:1; - unsigned RXB1D07:1; -} RXB1D0bits; -extern volatile far unsigned char RXB1D1; -extern volatile far struct { - unsigned RXB1D10:1; - unsigned RXB1D11:1; - unsigned RXB1D12:1; - unsigned RXB1D13:1; - unsigned RXB1D14:1; - unsigned RXB1D15:1; - unsigned RXB1D16:1; - unsigned RXB1D17:1; -} RXB1D1bits; -extern volatile far unsigned char RXB1D2; -extern volatile far struct { - unsigned RXB1D20:1; - unsigned RXB1D21:1; - unsigned RXB1D22:1; - unsigned RXB1D23:1; - unsigned RXB1D24:1; - unsigned RXB1D25:1; - unsigned RXB1D26:1; - unsigned RXB1D27:1; -} RXB1D2bits; -extern volatile far unsigned char RXB1D3; -extern volatile far struct { - unsigned RXB1D30:1; - unsigned RXB1D31:1; - unsigned RXB1D32:1; - unsigned RXB1D33:1; - unsigned RXB1D34:1; - unsigned RXB1D35:1; - unsigned RXB1D36:1; - unsigned RXB1D37:1; -} RXB1D3bits; -extern volatile far unsigned char RXB1D4; -extern volatile far struct { - unsigned RXB1D40:1; - unsigned RXB1D41:1; - unsigned RXB1D42:1; - unsigned RXB1D43:1; - unsigned RXB1D44:1; - unsigned RXB1D45:1; - unsigned RXB1D46:1; - unsigned RXB1D47:1; -} RXB1D4bits; -extern volatile far unsigned char RXB1D5; -extern volatile far struct { - unsigned RXB1D50:1; - unsigned RXB1D51:1; - unsigned RXB1D52:1; - unsigned RXB1D53:1; - unsigned RXB1D54:1; - unsigned RXB1D55:1; - unsigned RXB1D56:1; - unsigned RXB1D57:1; -} RXB1D5bits; -extern volatile far unsigned char RXB1D6; -extern volatile far struct { - unsigned RXB1D60:1; - unsigned RXB1D61:1; - unsigned RXB1D62:1; - unsigned RXB1D63:1; - unsigned RXB1D64:1; - unsigned RXB1D65:1; - unsigned RXB1D66:1; - unsigned RXB1D67:1; -} RXB1D6bits; -extern volatile far unsigned char RXB1D7; -extern volatile far struct { - unsigned RXB1D70:1; - unsigned RXB1D71:1; - unsigned RXB1D72:1; - unsigned RXB1D73:1; - unsigned RXB1D74:1; - unsigned RXB1D75:1; - unsigned RXB1D76:1; - unsigned RXB1D77:1; -} RXB1D7bits; -extern volatile far unsigned char CANSTAT_RO0; -extern volatile far struct { - unsigned ICODE0:1; - unsigned ICODE1:1; - unsigned ICODE2:1; - unsigned ICODE3:1; - unsigned ICODE4:1; - unsigned OPMODE:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANSTAT_RO0bits; -extern volatile far unsigned char CANCON_RO0; -extern volatile far struct { - unsigned :1; - unsigned WIN0:1; - unsigned WIN1:1; - unsigned WIN2:1; - unsigned ABAT:1; - unsigned REQOP0:1; - unsigned REQOP1:1; - unsigned REQOP2:1; -} CANCON_RO0bits; -extern volatile near unsigned char RXB0CON; -extern volatile near union { - struct { - unsigned FILHIT0:1; - unsigned JTOFF:1; - unsigned RXB0DBEN:1; - unsigned RXRTRRO:1; - unsigned :1; - unsigned RXM0:1; - unsigned RXM1:1; - unsigned RXFUL:1; - }; - struct { - unsigned :1; - unsigned FILHIT1:1; - unsigned FILHIT2:1; - unsigned FILHIT3:1; - unsigned FILHIT4:1; - unsigned RTRRO:1; - }; - struct { - unsigned :2; - unsigned RXBODBEN:1; - }; -} RXB0CONbits; -extern volatile near unsigned char RXB0SIDH; -extern volatile near struct { - unsigned SID3:1; - unsigned SID4:1; - unsigned SID5:1; - unsigned SID6:1; - unsigned SID7:1; - unsigned SID8:1; - unsigned SID9:1; - unsigned SID10:1; -} RXB0SIDHbits; -extern volatile near unsigned char RXB0SIDL; -extern volatile near struct { - unsigned EID16:1; - unsigned EID17:1; - unsigned :1; - unsigned EXID:1; - unsigned SRR:1; - unsigned SID0:1; - unsigned SID1:1; - unsigned SID2:1; -} RXB0SIDLbits; -extern volatile near unsigned char RXB0EIDH; -extern volatile near struct { - unsigned EID8:1; - unsigned EID9:1; - unsigned EID10:1; - unsigned EID11:1; - unsigned EID12:1; - unsigned EID13:1; - unsigned EID14:1; - unsigned EID15:1; -} RXB0EIDHbits; -extern volatile near unsigned char RXB0EIDL; -extern volatile near struct { - unsigned EID0:1; - unsigned EID1:1; - unsigned EID2:1; - unsigned EID3:1; - unsigned EID4:1; - unsigned EID5:1; - unsigned EID6:1; - unsigned EID7:1; -} RXB0EIDLbits; -extern volatile near unsigned char RXB0DLC; -extern volatile near union { - struct { - unsigned DLC0:1; - unsigned DLC1:1; - unsigned DLC2:1; - unsigned DLC3:1; - unsigned RESRB0:1; - unsigned RESRB1:1; - unsigned RXRTR:1; - }; - struct { - unsigned :4; - unsigned RB0:1; - unsigned RB1:1; - }; -} RXB0DLCbits; -extern volatile near unsigned char RXB0D0; -extern volatile near struct { - unsigned RXB0D00:1; - unsigned RXB0D01:1; - unsigned RXB0D02:1; - unsigned RXB0D03:1; - unsigned RXB0D04:1; - unsigned RXB0D05:1; - unsigned RXB0D06:1; - unsigned RXB0D07:1; -} RXB0D0bits; -extern volatile near unsigned char RXB0D1; -extern volatile near struct { - unsigned RXB0D10:1; - unsigned RXB0D11:1; - unsigned RXB0D12:1; - unsigned RXB0D13:1; - unsigned RXB0D14:1; - unsigned RXB0D15:1; - unsigned RXB0D16:1; - unsigned RXB0D17:1; -} RXB0D1bits; -extern volatile near unsigned char RXB0D2; -extern volatile near struct { - unsigned RXB0D20:1; - unsigned RXB0D21:1; - unsigned RXB0D22:1; - unsigned RXB0D23:1; - unsigned RXB0D24:1; - unsigned RXB0D25:1; - unsigned RXB0D26:1; - unsigned RXB0D27:1; -} RXB0D2bits; -extern volatile near unsigned char RXB0D3; -extern volatile near struct { - unsigned RXB0D30:1; - unsigned RXB0D31:1; - unsigned RXB0D32:1; - unsigned RXB0D33:1; - unsigned RXB0D34:1; - unsigned RXB0D35:1; - unsigned RXB0D36:1; - unsigned RXB0D37:1; -} RXB0D3bits; -extern volatile near unsigned char RXB0D4; -extern volatile near struct { - unsigned RXB0D40:1; - unsigned RXB0D41:1; - unsigned RXB0D42:1; - unsigned RXB0D43:1; - unsigned RXB0D44:1; - unsigned RXB0D45:1; - unsigned RXB0D46:1; - unsigned RXB0D47:1; -} RXB0D4bits; -extern volatile near unsigned char RXB0D5; -extern volatile near struct { - unsigned RXB0D50:1; - unsigned RXB0D51:1; - unsigned RXB0D52:1; - unsigned RXB0D53:1; - unsigned RXB0D54:1; - unsigned RXB0D55:1; - unsigned RXB0D56:1; - unsigned RXB0D57:1; -} RXB0D5bits; -extern volatile near unsigned char RXB0D6; -extern volatile near struct { - unsigned RXB0D60:1; - unsigned RXB0D61:1; - unsigned RXB0D62:1; - unsigned RXB0D63:1; - unsigned RXB0D64:1; - unsigned RXB0D65:1; - unsigned RXB0D66:1; - unsigned RXB0D67:1; -} RXB0D6bits; -extern volatile near unsigned char RXB0D7; -extern volatile near struct { - unsigned RXB0D70:1; - unsigned RXB0D71:1; - unsigned RXB0D72:1; - unsigned RXB0D73:1; - unsigned RXB0D74:1; - unsigned RXB0D75:1; - unsigned RXB0D76:1; - unsigned RXB0D77:1; -} RXB0D7bits; -extern volatile near unsigned char CANSTAT; -extern volatile near union { - struct { - unsigned :1; - unsigned ICODE1:1; - unsigned ICODE2:1; - unsigned ICODE3:1; - unsigned :1; - unsigned OPMODE0:1; - unsigned OPMODE1:1; - unsigned OPMODE2:1; - }; - struct { - unsigned EICODE0:1; - unsigned EICODE1:1; - unsigned EICODE2:1; - unsigned EICODE3:1; - unsigned EICODE4:1; - }; -} CANSTATbits; -extern volatile near unsigned char CANCON; -extern volatile near union { - struct { - unsigned :1; - unsigned WIN0:1; - unsigned WIN1:1; - unsigned WIN2:1; - unsigned ABAT:1; - unsigned REQOP0:1; - unsigned REQOP1:1; - unsigned REQOP2:1; - }; - struct { - unsigned FP0:1; - unsigned FP1:1; - unsigned FP2:1; - unsigned FP3:1; - }; -} CANCONbits; -extern volatile near unsigned char BRGCON1; -extern volatile near struct { - unsigned BRP0:1; - unsigned BRP1:1; - unsigned BRP2:1; - unsigned BRP3:1; - unsigned BRP4:1; - unsigned BRP5:1; - unsigned SJW0:1; - unsigned SJW1:1; -} BRGCON1bits; -extern volatile near unsigned char BRGCON2; -extern volatile near union { - struct { - unsigned PRSEG0:1; - unsigned PRSEG1:1; - unsigned PRSEG2:1; - unsigned SEG1PH0:1; - unsigned SEG1PH1:1; - unsigned SEG1PH2:1; - unsigned SAM:1; - unsigned SEG2PHTS:1; - }; - struct { - unsigned :7; - unsigned SEG2PHT:1; - }; -} BRGCON2bits; -extern volatile near unsigned char BRGCON3; -extern volatile near struct { - unsigned SEG2PH0:1; - unsigned SEG2PH1:1; - unsigned SEG2PH2:1; - unsigned :3; - unsigned WAKFIL:1; - unsigned WAKDIS:1; -} BRGCON3bits; -extern volatile near unsigned char CIOCON; -extern volatile near struct { - unsigned :4; - unsigned CANCAP:1; - unsigned ENDRHI:1; -} CIOCONbits; -extern volatile near unsigned char COMSTAT; -extern volatile near union { - struct { - unsigned EWARN:1; - unsigned RXWARN:1; - unsigned TXWARN:1; - unsigned RXBP:1; - unsigned TXBP:1; - unsigned TXBO:1; - unsigned RXB1OVFL:1; - unsigned RXB0OVFL:1; - }; - struct { - unsigned :6; - unsigned RXBnOVFL:1; - }; - struct { - unsigned :7; - unsigned FIFOEMPTY:1; - }; -} COMSTATbits; -extern volatile near unsigned char RXERRCNT; -extern volatile near struct { - unsigned REC0:1; - unsigned REC1:1; - unsigned REC2:1; - unsigned REC3:1; - unsigned REC4:1; - unsigned REC5:1; - unsigned REC6:1; - unsigned REC7:1; -} RXERRCNTbits; -extern volatile near unsigned char TXERRCNT; -extern volatile near struct { - unsigned TEC0:1; - unsigned TEC1:1; - unsigned TEC2:1; - unsigned TEC3:1; - unsigned TEC4:1; - unsigned TEC5:1; - unsigned TEC6:1; - unsigned TEC7:1; -} TXERRCNTbits; -extern volatile near unsigned char ECANCON; -extern volatile near union { - struct { - unsigned EWIN0:1; - unsigned EWIN1:1; - unsigned EWIN2:1; - unsigned EWIN3:1; - unsigned EWIN4:1; - unsigned FIFOWM:1; - unsigned MDSEL0:1; - unsigned MDSEL1:1; - }; - struct { - unsigned :5; - unsigned F:1; - }; -} ECANCONbits; -extern volatile near unsigned char PORTA; -extern volatile near union { - struct { - unsigned RA0:1; - unsigned RA1:1; - unsigned RA2:1; - unsigned RA3:1; - unsigned RA4:1; - unsigned RA5:1; - unsigned RA6:1; - unsigned RA7:1; - }; - struct { - unsigned AN0:1; - unsigned AN1:1; - unsigned AN2:1; - unsigned AN3:1; - unsigned T0CKI:1; - unsigned AN4:1; - unsigned OSC2:1; - unsigned OSC1:1; - }; - struct { - unsigned CVREF:1; - unsigned :1; - unsigned VREFM:1; - unsigned VREFP:1; - unsigned :1; - unsigned LVDIN:1; - unsigned CLKO:1; - unsigned CLKI:1; - }; - struct { - unsigned :5; - unsigned SS:1; - }; - struct { - unsigned :5; - unsigned NOT_SS:1; - }; - struct { - unsigned :5; - unsigned HLVDIN:1; - }; -} PORTAbits; -extern volatile near unsigned char PORTB; -extern volatile near union { - struct { - unsigned RB0:1; - unsigned RB1:1; - unsigned RB2:1; - unsigned RB3:1; - unsigned RB4:1; - unsigned RB5:1; - unsigned RB6:1; - unsigned RB7:1; - }; - struct { - unsigned INT0:1; - unsigned INT1:1; - unsigned INT2:1; - unsigned CANRX:1; - unsigned KBI0:1; - unsigned KBI1:1; - unsigned KBI2:1; - unsigned KBI3:1; - }; - struct { - unsigned AN10:1; - }; - struct { - unsigned FLT0:1; - unsigned AN8:1; - unsigned CANTX:1; - unsigned :1; - unsigned AN9:1; - unsigned PGM:1; - unsigned PGC:1; - unsigned PGD:1; - }; -} PORTBbits; -extern volatile near unsigned char PORTC; -extern volatile near union { - struct { - unsigned RC0:1; - unsigned RC1:1; - unsigned RC2:1; - unsigned RC3:1; - unsigned RC4:1; - unsigned RC5:1; - unsigned RC6:1; - unsigned RC7:1; - }; - struct { - unsigned T1OSO:1; - unsigned T1OSI:1; - unsigned CCP1:1; - unsigned SCK:1; - unsigned SDI:1; - unsigned SDO:1; - unsigned TX:1; - unsigned RX:1; - }; - struct { - unsigned T13CKI:1; - unsigned :2; - unsigned SCL:1; - unsigned SDA:1; - unsigned :1; - unsigned CK:1; - unsigned DT:1; - }; -} PORTCbits; -extern volatile near unsigned char PORTD; -extern volatile near union { - struct { - unsigned RD0:1; - unsigned RD1:1; - unsigned RD2:1; - unsigned RD3:1; - unsigned RD4:1; - unsigned RD5:1; - unsigned RD6:1; - unsigned RD7:1; - }; - struct { - unsigned PSP0:1; - unsigned PSP1:1; - unsigned PSP2:1; - unsigned PSP3:1; - unsigned PSP4:1; - unsigned PSP5:1; - unsigned PSP6:1; - unsigned PSP7:1; - }; - struct { - unsigned C1INB:1; - unsigned C1INA:1; - unsigned C2INB:1; - unsigned C2INA:1; - unsigned P1A:1; - unsigned P1B:1; - unsigned P1C:1; - unsigned P1D:1; - }; - struct { - unsigned :4; - unsigned ECCP1:1; - }; -} PORTDbits; -extern volatile near unsigned char PORTE; -extern volatile near union { - struct { - unsigned RE0:1; - unsigned RE1:1; - unsigned RE2:1; - unsigned RE3:1; - }; - struct { - unsigned AN5:1; - unsigned AN6:1; - unsigned AN7:1; - }; - struct { - unsigned NOT_RD:1; - unsigned NOT_WR:1; - unsigned NOT_CS:1; - }; - struct { - unsigned RD:1; - unsigned WR:1; - unsigned CS:1; - }; -} PORTEbits; -extern volatile near unsigned char LATA; -extern volatile near struct { - unsigned LATA0:1; - unsigned LATA1:1; - unsigned LATA2:1; - unsigned LATA3:1; - unsigned LATA4:1; - unsigned LATA5:1; - unsigned LATA6:1; - unsigned LATA7:1; -} LATAbits; -extern volatile near unsigned char LATB; -extern volatile near struct { - unsigned LATB0:1; - unsigned LATB1:1; - unsigned LATB2:1; - unsigned LATB3:1; - unsigned LATB4:1; - unsigned LATB5:1; - unsigned LATB6:1; - unsigned LATB7:1; -} LATBbits; -extern volatile near unsigned char LATC; -extern volatile near struct { - unsigned LATC0:1; - unsigned LATC1:1; - unsigned LATC2:1; - unsigned LATC3:1; - unsigned LATC4:1; - unsigned LATC5:1; - unsigned LATC6:1; - unsigned LATC7:1; -} LATCbits; -extern volatile near unsigned char LATD; -extern volatile near struct { - unsigned LATD0:1; - unsigned LATD1:1; - unsigned LATD2:1; - unsigned LATD3:1; - unsigned LATD4:1; - unsigned LATD5:1; - unsigned LATD6:1; - unsigned LATD7:1; -} LATDbits; -extern volatile near unsigned char LATE; -extern volatile near struct { - unsigned LATE0:1; - unsigned LATE1:1; - unsigned LATE2:1; -} LATEbits; -extern volatile near unsigned char DDRA; -extern volatile near struct { - unsigned RA0:1; - unsigned RA1:1; - unsigned RA2:1; - unsigned RA3:1; - unsigned RA4:1; - unsigned RA5:1; - unsigned RA6:1; -} DDRAbits; -extern volatile near unsigned char TRISA; -extern volatile near struct { - unsigned TRISA0:1; - unsigned TRISA1:1; - unsigned TRISA2:1; - unsigned TRISA3:1; - unsigned TRISA4:1; - unsigned TRISA5:1; - unsigned TRISA6:1; - unsigned TRISA7:1; -} TRISAbits; -extern volatile near unsigned char DDRB; -extern volatile near struct { - unsigned RB0:1; - unsigned RB1:1; - unsigned RB2:1; - unsigned RB3:1; - unsigned RB4:1; - unsigned RB5:1; - unsigned RB6:1; - unsigned RB7:1; -} DDRBbits; -extern volatile near unsigned char TRISB; -extern volatile near struct { - unsigned TRISB0:1; - unsigned TRISB1:1; - unsigned TRISB2:1; - unsigned TRISB3:1; - unsigned TRISB4:1; - unsigned TRISB5:1; - unsigned TRISB6:1; - unsigned TRISB7:1; -} TRISBbits; -extern volatile near unsigned char DDRC; -extern volatile near struct { - unsigned RC0:1; - unsigned RC1:1; - unsigned RC2:1; - unsigned RC3:1; - unsigned RC4:1; - unsigned RC5:1; - unsigned RC6:1; - unsigned RC7:1; -} DDRCbits; -extern volatile near unsigned char TRISC; -extern volatile near struct { - unsigned TRISC0:1; - unsigned TRISC1:1; - unsigned TRISC2:1; - unsigned TRISC3:1; - unsigned TRISC4:1; - unsigned TRISC5:1; - unsigned TRISC6:1; - unsigned TRISC7:1; -} TRISCbits; -extern volatile near unsigned char DDRD; -extern volatile near struct { - unsigned RD0:1; - unsigned RD1:1; - unsigned RD2:1; - unsigned RD3:1; - unsigned RD4:1; - unsigned RD5:1; - unsigned RD6:1; - unsigned RD7:1; -} DDRDbits; -extern volatile near unsigned char TRISD; -extern volatile near struct { - unsigned TRISD0:1; - unsigned TRISD1:1; - unsigned TRISD2:1; - unsigned TRISD3:1; - unsigned TRISD4:1; - unsigned TRISD5:1; - unsigned TRISD6:1; - unsigned TRISD7:1; -} TRISDbits; -extern volatile near unsigned char DDRE; -extern volatile near struct { - unsigned RE0:1; - unsigned RE1:1; - unsigned RE2:1; - unsigned :1; - unsigned PSPMODE:1; - unsigned IBOV:1; - unsigned OBF:1; - unsigned IBF:1; -} DDREbits; -extern volatile near unsigned char TRISE; -extern volatile near struct { - unsigned TRISE0:1; - unsigned TRISE1:1; - unsigned TRISE2:1; - unsigned :1; - unsigned PSPMODE:1; - unsigned IBOV:1; - unsigned OBF:1; - unsigned IBF:1; -} TRISEbits; -extern volatile near unsigned char OSCTUNE; -extern volatile near union { - struct { - unsigned TUN0:1; - unsigned TUN1:1; - unsigned TUN2:1; - unsigned TUN3:1; - unsigned TUN4:1; - unsigned :1; - unsigned PLLEN:1; - unsigned INTSCR:1; - }; - struct { - unsigned :7; - unsigned INTSRC:1; - }; -} OSCTUNEbits; -extern volatile near unsigned char PIE1; -extern volatile near struct { - unsigned TMR1IE:1; - unsigned TMR2IE:1; - unsigned CCP1IE:1; - unsigned SSPIE:1; - unsigned TXIE:1; - unsigned RCIE:1; - unsigned ADIE:1; - unsigned PSPIE:1; -} PIE1bits; -extern volatile near unsigned char PIR1; -extern volatile near struct { - unsigned TMR1IF:1; - unsigned TMR2IF:1; - unsigned CCP1IF:1; - unsigned SSPIF:1; - unsigned TXIF:1; - unsigned RCIF:1; - unsigned ADIF:1; - unsigned PSPIF:1; -} PIR1bits; -extern volatile near unsigned char IPR1; -extern volatile near union { - struct { - unsigned TMR1IP:1; - unsigned TMR2IP:1; - unsigned CCP1IP:1; - unsigned SSPIP:1; - unsigned TXBIP:1; - unsigned RCIP:1; - unsigned ADIP:1; - unsigned PSPIP:1; - }; - struct { - unsigned :4; - unsigned TXIP:1; - }; -} IPR1bits; -extern volatile near unsigned char PIE2; -extern volatile near union { - struct { - unsigned ECCP1IE:1; - unsigned TMR3IE:1; - unsigned LVDIE:1; - unsigned BCLIE:1; - unsigned EEIE:1; - unsigned :1; - unsigned CMIE:1; - unsigned OSCFIE:1; - }; - struct { - unsigned :2; - unsigned HLVDIE:1; - }; -} PIE2bits; -extern volatile near unsigned char PIR2; -extern volatile near union { - struct { - unsigned ECCP1IF:1; - unsigned TMR3IF:1; - unsigned LVDIF:1; - unsigned BCLIF:1; - unsigned EEIF:1; - unsigned :1; - unsigned CMIF:1; - unsigned OSCFIF:1; - }; - struct { - unsigned :2; - unsigned HLVDIF:1; - }; -} PIR2bits; -extern volatile near unsigned char IPR2; -extern volatile near union { - struct { - unsigned ECCP1IP:1; - unsigned TMR3IP:1; - unsigned LVDIP:1; - unsigned BCLIP:1; - unsigned EEIP:1; - unsigned :1; - unsigned CMIP:1; - unsigned OSCFIP:1; - }; - struct { - unsigned :2; - unsigned HLVDIP:1; - }; -} IPR2bits; -extern volatile near unsigned char PIE3; -extern volatile near union { - struct { - unsigned RXB0IE:1; - unsigned RXB1IE:1; - unsigned TXB0IE:1; - unsigned TXB1IE:1; - unsigned TXB2IE:1; - unsigned ERRIE:1; - unsigned WAKIE:1; - unsigned IRXIE:1; - }; - struct { - unsigned FIFOWMIE:1; - unsigned RXBnIE:1; - unsigned :2; - unsigned TXBnIE:1; - }; - struct { - unsigned FIFOMWIE:1; - }; -} PIE3bits; -extern volatile near unsigned char PIR3; -extern volatile near union { - struct { - unsigned RXB0IF:1; - unsigned RXB1IF:1; - unsigned TXB0IF:1; - unsigned TXB1IF:1; - unsigned TXB2IF:1; - unsigned ERRIF:1; - unsigned WAKIF:1; - unsigned IRXIF:1; - }; - struct { - unsigned FIFOWMIF:1; - unsigned RXBnIF:1; - unsigned :2; - unsigned TXBnIF:1; - }; -} PIR3bits; -extern volatile near unsigned char IPR3; -extern volatile near union { - struct { - unsigned RXB0IP:1; - unsigned RXB1IP:1; - unsigned TXB0IP:1; - unsigned TXB1IP:1; - unsigned TXB2IP:1; - unsigned ERRIP:1; - unsigned WAKIP:1; - unsigned IRXIP:1; - }; - struct { - unsigned FIFOWMIP:1; - unsigned RXBnIP:1; - unsigned :2; - unsigned TXBnIP:1; - }; -} IPR3bits; -extern volatile near unsigned char EECON1; -extern volatile near struct { - unsigned RD:1; - unsigned WR:1; - unsigned WREN:1; - unsigned WRERR:1; - unsigned FREE:1; - unsigned :1; - unsigned CFGS:1; - unsigned EEPGD:1; -} EECON1bits; -extern volatile near unsigned char EECON2; -extern volatile near unsigned char EEDATA; -extern volatile near unsigned char EEADR; -extern volatile near unsigned char EEADRH; -extern volatile near unsigned char RCSTA; -extern volatile near union { - struct { - unsigned RX9D:1; - unsigned OERR:1; - unsigned FERR:1; - unsigned ADEN:1; - unsigned CREN:1; - unsigned SREN:1; - unsigned RX9:1; - unsigned SPEN:1; - }; - struct { - unsigned :3; - unsigned ADDEN:1; - }; -} RCSTAbits; -extern volatile near unsigned char TXSTA; -extern volatile near struct { - unsigned TX9D:1; - unsigned TRMT:1; - unsigned BRGH:1; - unsigned SENDB:1; - unsigned SYNC:1; - unsigned TXEN:1; - unsigned TX9:1; - unsigned CSRC:1; -} TXSTAbits; -extern volatile near unsigned char TXREG; -extern volatile near unsigned char RCREG; -extern volatile near unsigned char SPBRG; -extern volatile near unsigned char SPBRGH; -extern volatile near unsigned char T3CON; -extern volatile near union { - struct { - unsigned TMR3ON:1; - unsigned TMR3CS:1; - unsigned T3SYNC:1; - unsigned T3CCP1:1; - unsigned T3CKPS0:1; - unsigned T3CKPS1:1; - unsigned T3CCP2:1; - unsigned RD16:1; - }; - struct { - unsigned :2; - unsigned T3NSYNC:1; - }; - struct { - unsigned :6; - unsigned T3ECCP1:1; - }; - struct { - unsigned :2; - unsigned NOT_T3SYNC:1; - }; -} T3CONbits; -extern volatile near unsigned char TMR3L; -extern volatile near unsigned char TMR3H; -extern volatile near unsigned char CMCON; -extern volatile near struct { - unsigned CM0:1; - unsigned CM1:1; - unsigned CM2:1; - unsigned CIS:1; - unsigned C1INV:1; - unsigned C2INV:1; - unsigned C1OUT:1; - unsigned C2OUT:1; -} CMCONbits; -extern volatile near unsigned char CVRCON; -extern volatile near union { - struct { - unsigned CVR0:1; - unsigned CVR1:1; - unsigned CVR2:1; - unsigned CVR3:1; - unsigned CVREF:1; - unsigned CVRR:1; - unsigned CVROE:1; - unsigned CVREN:1; - }; - struct { - unsigned :4; - unsigned CVRSS:1; - }; -} CVRCONbits; -extern volatile near unsigned char ECCP1AS; -extern volatile near struct { - unsigned PSSBD0:1; - unsigned PSSBD1:1; - unsigned PSSAC0:1; - unsigned PSSAC1:1; - unsigned ECCPAS0:1; - unsigned ECCPAS1:1; - unsigned ECCPAS2:1; - unsigned ECCPASE:1; -} ECCP1ASbits; -extern volatile near unsigned char ECCP1DEL; -extern volatile near struct { - unsigned PDC0:1; - unsigned PDC1:1; - unsigned PDC2:1; - unsigned PDC3:1; - unsigned PDC4:1; - unsigned PDC5:1; - unsigned PDC6:1; - unsigned PRSEN:1; -} ECCP1DELbits; -extern volatile near unsigned char BAUDCON; -extern volatile near struct { - unsigned ABDEN:1; - unsigned WUE:1; - unsigned :1; - unsigned BRG16:1; - unsigned SCKP:1; - unsigned :1; - unsigned RCIDL:1; - unsigned ABDOVF:1; -} BAUDCONbits; -extern volatile near unsigned char ECCP1CON; -extern volatile near struct { - unsigned ECCP1M0:1; - unsigned ECCP1M1:1; - unsigned ECCP1M2:1; - unsigned ECCP1M3:1; - unsigned EDC1B0:1; - unsigned EDC1B1:1; - unsigned EPWM1M0:1; - unsigned EPWM1M1:1; -} ECCP1CONbits; -extern volatile near unsigned ECCPR1; -extern volatile near unsigned char ECCPR1L; -extern volatile near unsigned char ECCPR1H; -extern volatile near unsigned char CCP1CON; -extern volatile near struct { - unsigned CCP1M0:1; - unsigned CCP1M1:1; - unsigned CCP1M2:1; - unsigned CCP1M3:1; - unsigned DC1B0:1; - unsigned DC1B1:1; -} CCP1CONbits; -extern volatile near unsigned CCPR1; -extern volatile near unsigned char CCPR1L; -extern volatile near unsigned char CCPR1H; -extern volatile near unsigned char ADCON2; -extern volatile near struct { - unsigned ADCS0:1; - unsigned ADCS1:1; - unsigned ADCS2:1; - unsigned ACQT0:1; - unsigned ACQT1:1; - unsigned ACQT2:1; - unsigned :1; - unsigned ADFM:1; -} ADCON2bits; -extern volatile near unsigned char ADCON1; -extern volatile near struct { - unsigned PCFG0:1; - unsigned PCFG1:1; - unsigned PCFG2:1; - unsigned PCFG3:1; - unsigned VCFG0:1; - unsigned VCFG1:1; -} ADCON1bits; -extern volatile near unsigned char ADCON0; -extern volatile near union { - struct { - unsigned ADON:1; - unsigned GO_DONE:1; - unsigned CHS0:1; - unsigned CHS1:1; - unsigned CHS2:1; - unsigned CHS3:1; - }; - struct { - unsigned :1; - unsigned DONE:1; - }; - struct { - unsigned :1; - unsigned GO:1; - }; - struct { - unsigned :1; - unsigned NOT_DONE:1; - }; -} ADCON0bits; -extern volatile near unsigned ADRES; -extern volatile near unsigned char ADRESL; -extern volatile near unsigned char ADRESH; -extern volatile near unsigned char SSPCON2; -extern volatile near struct { - unsigned SEN:1; - unsigned RSEN:1; - unsigned PEN:1; - unsigned RCEN:1; - unsigned ACKEN:1; - unsigned ACKDT:1; - unsigned ACKSTAT:1; - unsigned GCEN:1; -} SSPCON2bits; -extern volatile near unsigned char SSPCON1; -extern volatile near struct { - unsigned SSPM0:1; - unsigned SSPM1:1; - unsigned SSPM2:1; - unsigned SSPM3:1; - unsigned CKP:1; - unsigned SSPEN:1; - unsigned SSPOV:1; - unsigned WCOL:1; -} SSPCON1bits; -extern volatile near unsigned char SSPSTAT; -extern volatile near union { - struct { - unsigned BF:1; - unsigned UA:1; - unsigned R_W:1; - unsigned S:1; - unsigned P:1; - unsigned D_A:1; - unsigned CKE:1; - unsigned SMP:1; - }; - struct { - unsigned :2; - unsigned I2C_READ:1; - unsigned I2C_START:1; - unsigned I2C_STOP:1; - unsigned I2C_DAT:1; - }; - struct { - unsigned :2; - unsigned NOT_W:1; - unsigned :2; - unsigned NOT_A:1; - }; - struct { - unsigned :2; - unsigned NOT_WRITE:1; - unsigned :2; - unsigned NOT_ADDRESS:1; - }; - struct { - unsigned :2; - unsigned READ_WRITE:1; - unsigned :2; - unsigned DATA_ADDRESS:1; - }; - struct { - unsigned :2; - unsigned R:1; - unsigned :2; - unsigned D:1; - }; -} SSPSTATbits; -extern volatile near unsigned char SSPADD; -extern volatile near unsigned char SSPBUF; -extern volatile near unsigned char T2CON; -extern volatile near struct { - unsigned T2CKPS0:1; - unsigned T2CKPS1:1; - unsigned TMR2ON:1; - unsigned T2OUTPS0:1; - unsigned T2OUTPS1:1; - unsigned T2OUTPS2:1; - unsigned T2OUTPS3:1; -} T2CONbits; -extern volatile near unsigned char PR2; -extern volatile near unsigned char TMR2; -extern volatile near unsigned char T1CON; -extern volatile near union { - struct { - unsigned TMR1ON:1; - unsigned TMR1CS:1; - unsigned T1SYNC:1; - unsigned T1OSCEN:1; - unsigned T1CKPS0:1; - unsigned T1CKPS1:1; - unsigned T1RUN:1; - unsigned RD16:1; - }; - struct { - unsigned :2; - unsigned T1INSYNC:1; - }; - struct { - unsigned :2; - unsigned NOT_T1SYNC:1; - }; -} T1CONbits; -extern volatile near unsigned char TMR1L; -extern volatile near unsigned char TMR1H; -extern volatile near unsigned char RCON; -extern volatile near union { - struct { - unsigned NOT_BOR:1; - unsigned NOT_POR:1; - unsigned NOT_PD:1; - unsigned NOT_TO:1; - unsigned NOT_RI:1; - unsigned :1; - unsigned SBOREN:1; - unsigned IPEN:1; - }; - struct { - unsigned BOR:1; - unsigned POR:1; - unsigned PD:1; - unsigned TO:1; - unsigned RI:1; - }; -} RCONbits; -extern volatile near unsigned char WDTCON; -extern volatile near union { - struct { - unsigned SWDTEN:1; - }; - struct { - unsigned SWDTE:1; - }; -} WDTCONbits; -extern volatile near unsigned char HLVDCON; -extern volatile near union { - struct { - unsigned LVDL0:1; - unsigned LVDL1:1; - unsigned LVDL2:1; - unsigned LVDL3:1; - unsigned LVDEN:1; - unsigned IRVST:1; - }; - struct { - unsigned LVV0:1; - unsigned LVV1:1; - unsigned LVV2:1; - unsigned LVV3:1; - unsigned :1; - unsigned BGST:1; - }; - struct { - unsigned HLVDL0:1; - unsigned HLVDL1:1; - unsigned HLVDL2:1; - unsigned HLVDL3:1; - unsigned HLVDEN:1; - unsigned :2; - unsigned VDIRMAG:1; - }; - struct { - unsigned :5; - unsigned IVRST:1; - }; -} HLVDCONbits; -extern volatile near unsigned char LVDCON; -extern volatile near union { - struct { - unsigned LVDL0:1; - unsigned LVDL1:1; - unsigned LVDL2:1; - unsigned LVDL3:1; - unsigned LVDEN:1; - unsigned IRVST:1; - }; - struct { - unsigned LVV0:1; - unsigned LVV1:1; - unsigned LVV2:1; - unsigned LVV3:1; - unsigned :1; - unsigned BGST:1; - }; - struct { - unsigned HLVDL0:1; - unsigned HLVDL1:1; - unsigned HLVDL2:1; - unsigned HLVDL3:1; - unsigned HLVDEN:1; - unsigned :2; - unsigned VDIRMAG:1; - }; - struct { - unsigned :5; - unsigned IVRST:1; - }; -} LVDCONbits; -extern volatile near unsigned char OSCCON; -extern volatile near struct { - unsigned SCS0:1; - unsigned SCS1:1; - unsigned IOFS:1; - unsigned OSTS:1; - unsigned IRCF0:1; - unsigned IRCF1:1; - unsigned IRCF2:1; - unsigned IDLEN:1; -} OSCCONbits; -extern volatile near unsigned char T0CON; -extern volatile near union { - struct { - unsigned T0PS0:1; - unsigned T0PS1:1; - unsigned T0PS2:1; - unsigned PSA:1; - unsigned T0SE:1; - unsigned T0CS:1; - unsigned T08BIT:1; - unsigned TMR0ON:1; - }; - struct { - unsigned :3; - unsigned T0PS3:1; - }; -} T0CONbits; -extern volatile near unsigned char TMR0L; -extern volatile near unsigned char TMR0H; -extern near unsigned char STATUS; -extern near struct { - unsigned C:1; - unsigned DC:1; - unsigned Z:1; - unsigned OV:1; - unsigned N:1; -} STATUSbits; -extern near unsigned FSR2; -extern near unsigned char FSR2L; -extern near unsigned char FSR2H; -extern volatile near unsigned char PLUSW2; -extern volatile near unsigned char PREINC2; -extern volatile near unsigned char POSTDEC2; -extern volatile near unsigned char POSTINC2; -extern near unsigned char INDF2; -extern near unsigned char BSR; -extern near unsigned FSR1; -extern near unsigned char FSR1L; -extern near unsigned char FSR1H; -extern volatile near unsigned char PLUSW1; -extern volatile near unsigned char PREINC1; -extern volatile near unsigned char POSTDEC1; -extern volatile near unsigned char POSTINC1; -extern near unsigned char INDF1; -extern near unsigned char WREG; -extern near unsigned FSR0; -extern near unsigned char FSR0L; -extern near unsigned char FSR0H; -extern volatile near unsigned char PLUSW0; -extern volatile near unsigned char PREINC0; -extern volatile near unsigned char POSTDEC0; -extern volatile near unsigned char POSTINC0; -extern near unsigned char INDF0; -extern volatile near unsigned char INTCON3; -extern volatile near union { - struct { - unsigned INT1IF:1; - unsigned INT2IF:1; - unsigned :1; - unsigned INT1IE:1; - unsigned INT2IE:1; - unsigned :1; - unsigned INT1IP:1; - unsigned INT2IP:1; - }; - struct { - unsigned INT1F:1; - unsigned INT2F:1; - unsigned :1; - unsigned INT1E:1; - unsigned INT2E:1; - unsigned :1; - unsigned INT1P:1; - unsigned INT2P:1; - }; -} INTCON3bits; -extern volatile near unsigned char INTCON2; -extern volatile near union { - struct { - unsigned RBIP:1; - unsigned :1; - unsigned TMR0IP:1; - unsigned :1; - unsigned INTEDG2:1; - unsigned INTEDG1:1; - unsigned INTEDG0:1; - unsigned NOT_RBPU:1; - }; - struct { - unsigned :2; - unsigned T0IP:1; - unsigned :4; - unsigned RBPU:1; - }; -} INTCON2bits; -extern volatile near unsigned char INTCON; -extern volatile near union { - struct { - unsigned RBIF:1; - unsigned INT0IF:1; - unsigned TMR0IF:1; - unsigned RBIE:1; - unsigned INT0IE:1; - unsigned TMR0IE:1; - unsigned PEIE:1; - unsigned GIE:1; - }; - struct { - unsigned :1; - unsigned INT0F:1; - unsigned T0IF:1; - unsigned :1; - unsigned INT0E:1; - unsigned T0IE:1; - unsigned GIEL:1; - unsigned GIEH:1; - }; -} INTCONbits; -extern near unsigned PROD; -extern near unsigned char PRODL; -extern near unsigned char PRODH; -extern volatile near unsigned char TABLAT; -extern volatile near unsigned short long TBLPTR; -extern volatile near unsigned char TBLPTRL; -extern volatile near unsigned char TBLPTRH; -extern volatile near unsigned char TBLPTRU; -extern volatile near unsigned short long PC; -extern volatile near unsigned char PCL; -extern volatile near unsigned char PCLATH; -extern volatile near unsigned char PCLATU; -extern volatile near unsigned char STKPTR; -extern volatile near union { - struct { - unsigned STKPTR0:1; - unsigned STKPTR1:1; - unsigned STKPTR2:1; - unsigned STKPTR3:1; - unsigned STKPTR4:1; - unsigned :1; - unsigned STKUNF:1; - unsigned STKOVF:1; - }; - struct { - unsigned SP0:1; - unsigned SP1:1; - unsigned SP2:1; - unsigned SP3:1; - unsigned SP4:1; - unsigned :2; - unsigned STKFUL:1; - }; -} STKPTRbits; -extern near unsigned short long TOS; -extern near unsigned char TOSL; -extern near unsigned char TOSH; -extern near unsigned char TOSU; - -#pragma varlocate 13 RXF6SIDH -#pragma varlocate 13 RXF6SIDHbits -#pragma varlocate 13 RXF6SIDL -#pragma varlocate 13 RXF6SIDLbits -#pragma varlocate 13 RXF6EIDH -#pragma varlocate 13 RXF6EIDHbits -#pragma varlocate 13 RXF6EIDL -#pragma varlocate 13 RXF6EIDLbits -#pragma varlocate 13 RXF7SIDH -#pragma varlocate 13 RXF7SIDHbits -#pragma varlocate 13 RXF7SIDL -#pragma varlocate 13 RXF7SIDLbits -#pragma varlocate 13 RXF7EIDH -#pragma varlocate 13 RXF7EIDHbits -#pragma varlocate 13 RXF7EIDL -#pragma varlocate 13 RXF7EIDLbits -#pragma varlocate 13 RXF8SIDH -#pragma varlocate 13 RXF8SIDHbits -#pragma varlocate 13 RXF8SIDL -#pragma varlocate 13 RXF8SIDLbits -#pragma varlocate 13 RXF8EIDH -#pragma varlocate 13 RXF8EIDHbits -#pragma varlocate 13 RXF8EIDL -#pragma varlocate 13 RXF8EIDLbits -#pragma varlocate 13 RXF9SIDH -#pragma varlocate 13 RXF9SIDHbits -#pragma varlocate 13 RXF9SIDL -#pragma varlocate 13 RXF9SIDLbits -#pragma varlocate 13 RXF9EIDH -#pragma varlocate 13 RXF9EIDHbits -#pragma varlocate 13 RXF9EIDL -#pragma varlocate 13 RXF9EIDLbits -#pragma varlocate 13 RXF10SIDH -#pragma varlocate 13 RXF10SIDHbits -#pragma varlocate 13 RXF10SIDL -#pragma varlocate 13 RXF10SIDLbits -#pragma varlocate 13 RXF10EIDH -#pragma varlocate 13 RXF10EIDHbits -#pragma varlocate 13 RXF10EIDL -#pragma varlocate 13 RXF10EIDLbits -#pragma varlocate 13 RXF11SIDH -#pragma varlocate 13 RXF11SIDHbits -#pragma varlocate 13 RXF11SIDL -#pragma varlocate 13 RXF11SIDLbits -#pragma varlocate 13 RXF11EIDH -#pragma varlocate 13 RXF11EIDHbits -#pragma varlocate 13 RXF11EIDL -#pragma varlocate 13 RXF11EIDLbits -#pragma varlocate 13 RXF12SIDH -#pragma varlocate 13 RXF12SIDHbits -#pragma varlocate 13 RXF12SIDL -#pragma varlocate 13 RXF12SIDLbits -#pragma varlocate 13 RXF12EIDH -#pragma varlocate 13 RXF12EIDHbits -#pragma varlocate 13 RXF12EIDL -#pragma varlocate 13 RXF12EIDLbits -#pragma varlocate 13 RXF13SIDH -#pragma varlocate 13 RXF13SIDHbits -#pragma varlocate 13 RXF13SIDL -#pragma varlocate 13 RXF13SIDLbits -#pragma varlocate 13 RXF13EIDH -#pragma varlocate 13 RXF13EIDHbits -#pragma varlocate 13 RXF13EIDL -#pragma varlocate 13 RXF13EIDLbits -#pragma varlocate 13 RXF14SIDH -#pragma varlocate 13 RXF14SIDHbits -#pragma varlocate 13 RXF14SIDL -#pragma varlocate 13 RXF14SIDLbits -#pragma varlocate 13 RXF14EIDH -#pragma varlocate 13 RXF14EIDHbits -#pragma varlocate 13 RXF14EIDL -#pragma varlocate 13 RXF14EIDLbits -#pragma varlocate 13 RXF15SIDH -#pragma varlocate 13 RXF15SIDHbits -#pragma varlocate 13 RXF15SIDL -#pragma varlocate 13 RXF15SIDLbits -#pragma varlocate 13 RXF15EIDH -#pragma varlocate 13 RXF15EIDHbits -#pragma varlocate 13 RXF15EIDL -#pragma varlocate 13 RXF15EIDLbits -#pragma varlocate 13 RXFCON0 -#pragma varlocate 13 RXFCON0bits -#pragma varlocate 13 RXFCON1 -#pragma varlocate 13 RXFCON1bits -#pragma varlocate 13 SDFLC -#pragma varlocate 13 SDFLCbits -#pragma varlocate 13 RXFBCON0 -#pragma varlocate 13 RXFBCON0bits -#pragma varlocate 13 RXFBCON1 -#pragma varlocate 13 RXFBCON1bits -#pragma varlocate 13 RXFBCON2 -#pragma varlocate 13 RXFBCON2bits -#pragma varlocate 13 RXFBCON3 -#pragma varlocate 13 RXFBCON3bits -#pragma varlocate 13 RXFBCON4 -#pragma varlocate 13 RXFBCON4bits -#pragma varlocate 13 RXFBCON5 -#pragma varlocate 13 RXFBCON5bits -#pragma varlocate 13 RXFBCON6 -#pragma varlocate 13 RXFBCON6bits -#pragma varlocate 13 RXFBCON7 -#pragma varlocate 13 RXFBCON7bits -#pragma varlocate 13 MSEL0 -#pragma varlocate 13 MSEL0bits -#pragma varlocate 13 MSEL1 -#pragma varlocate 13 MSEL1bits -#pragma varlocate 13 MSEL2 -#pragma varlocate 13 MSEL2bits -#pragma varlocate 13 MSEL3 -#pragma varlocate 13 MSEL3bits -#pragma varlocate 13 BSEL0 -#pragma varlocate 13 BSEL0bits -#pragma varlocate 13 BIE0 -#pragma varlocate 13 BIE0bits -#pragma varlocate 13 TXBIE -#pragma varlocate 13 TXBIEbits -#pragma varlocate 14 B0CON -#pragma varlocate 14 B0CONbits -#pragma varlocate 14 B0SIDH -#pragma varlocate 14 B0SIDHbits -#pragma varlocate 14 B0SIDL -#pragma varlocate 14 B0SIDLbits -#pragma varlocate 14 B0EIDH -#pragma varlocate 14 B0EIDHbits -#pragma varlocate 14 B0EIDL -#pragma varlocate 14 B0EIDLbits -#pragma varlocate 14 B0DLC -#pragma varlocate 14 B0DLCbits -#pragma varlocate 14 B0D0 -#pragma varlocate 14 B0D0bits -#pragma varlocate 14 B0D1 -#pragma varlocate 14 B0D1bits -#pragma varlocate 14 B0D2 -#pragma varlocate 14 B0D2bits -#pragma varlocate 14 B0D3 -#pragma varlocate 14 B0D3bits -#pragma varlocate 14 B0D4 -#pragma varlocate 14 B0D4bits -#pragma varlocate 14 B0D5 -#pragma varlocate 14 B0D5bits -#pragma varlocate 14 B0D6 -#pragma varlocate 14 B0D6bits -#pragma varlocate 14 B0D7 -#pragma varlocate 14 B0D7bits -#pragma varlocate 14 CANSTAT_RO9 -#pragma varlocate 14 CANSTAT_RO9bits -#pragma varlocate 14 CANCON_RO9 -#pragma varlocate 14 CANCON_RO9bits -#pragma varlocate 14 B1CON -#pragma varlocate 14 B1CONbits -#pragma varlocate 14 B1SIDH -#pragma varlocate 14 B1SIDHbits -#pragma varlocate 14 B1SIDL -#pragma varlocate 14 B1SIDLbits -#pragma varlocate 14 B1EIDH -#pragma varlocate 14 B1EIDHbits -#pragma varlocate 14 B1EIDL -#pragma varlocate 14 B1EIDLbits -#pragma varlocate 14 B1DLC -#pragma varlocate 14 B1DLCbits -#pragma varlocate 14 B1D0 -#pragma varlocate 14 B1D0bits -#pragma varlocate 14 B1D1 -#pragma varlocate 14 B1D1bits -#pragma varlocate 14 B1D2 -#pragma varlocate 14 B1D2bits -#pragma varlocate 14 B1D3 -#pragma varlocate 14 B1D3bits -#pragma varlocate 14 B1D4 -#pragma varlocate 14 B1D4bits -#pragma varlocate 14 B1D5 -#pragma varlocate 14 B1D5bits -#pragma varlocate 14 B1D6 -#pragma varlocate 14 B1D6bits -#pragma varlocate 14 B1D7 -#pragma varlocate 14 B1D7bits -#pragma varlocate 14 CANSTAT_RO8 -#pragma varlocate 14 CANSTAT_RO8bits -#pragma varlocate 14 CANCON_RO8 -#pragma varlocate 14 CANCON_RO8bits -#pragma varlocate 14 B2CON -#pragma varlocate 14 B2CONbits -#pragma varlocate 14 B2SIDH -#pragma varlocate 14 B2SIDHbits -#pragma varlocate 14 B2SIDL -#pragma varlocate 14 B2SIDLbits -#pragma varlocate 14 B2EIDH -#pragma varlocate 14 B2EIDHbits -#pragma varlocate 14 B2EIDL -#pragma varlocate 14 B2EIDLbits -#pragma varlocate 14 B2DLC -#pragma varlocate 14 B2DLCbits -#pragma varlocate 14 B2D0 -#pragma varlocate 14 B2D0bits -#pragma varlocate 14 B2D1 -#pragma varlocate 14 B2D1bits -#pragma varlocate 14 B2D2 -#pragma varlocate 14 B2D2bits -#pragma varlocate 14 B2D3 -#pragma varlocate 14 B2D3bits -#pragma varlocate 14 B2D4 -#pragma varlocate 14 B2D4bits -#pragma varlocate 14 B2D5 -#pragma varlocate 14 B2D5bits -#pragma varlocate 14 B2D6 -#pragma varlocate 14 B2D6bits -#pragma varlocate 14 B2D7 -#pragma varlocate 14 B2D7bits -#pragma varlocate 14 CANSTAT_RO7 -#pragma varlocate 14 CANSTAT_RO7bits -#pragma varlocate 14 CANCON_RO7 -#pragma varlocate 14 CANCON_RO7bits -#pragma varlocate 14 B3CON -#pragma varlocate 14 B3CONbits -#pragma varlocate 14 B3SIDH -#pragma varlocate 14 B3SIDHbits -#pragma varlocate 14 B3SIDL -#pragma varlocate 14 B3SIDLbits -#pragma varlocate 14 B3EIDH -#pragma varlocate 14 B3EIDHbits -#pragma varlocate 14 B3EIDL -#pragma varlocate 14 B3EIDLbits -#pragma varlocate 14 B3DLC -#pragma varlocate 14 B3DLCbits -#pragma varlocate 14 B3D0 -#pragma varlocate 14 B3D0bits -#pragma varlocate 14 B3D1 -#pragma varlocate 14 B3D1bits -#pragma varlocate 14 B3D2 -#pragma varlocate 14 B3D2bits -#pragma varlocate 14 B3D3 -#pragma varlocate 14 B3D3bits -#pragma varlocate 14 B3D4 -#pragma varlocate 14 B3D4bits -#pragma varlocate 14 B3D5 -#pragma varlocate 14 B3D5bits -#pragma varlocate 14 B3D6 -#pragma varlocate 14 B3D6bits -#pragma varlocate 14 B3D7 -#pragma varlocate 14 B3D7bits -#pragma varlocate 14 CANSTAT_RO6 -#pragma varlocate 14 CANSTAT_RO6bits -#pragma varlocate 14 CANCON_RO6 -#pragma varlocate 14 CANCON_RO6bits -#pragma varlocate 14 B4CON -#pragma varlocate 14 B4CONbits -#pragma varlocate 14 B4SIDH -#pragma varlocate 14 B4SIDHbits -#pragma varlocate 14 B4SIDL -#pragma varlocate 14 B4SIDLbits -#pragma varlocate 14 B4EIDH -#pragma varlocate 14 B4EIDHbits -#pragma varlocate 14 B4EIDL -#pragma varlocate 14 B4EIDLbits -#pragma varlocate 14 B4DLC -#pragma varlocate 14 B4DLCbits -#pragma varlocate 14 B4D0 -#pragma varlocate 14 B4D0bits -#pragma varlocate 14 B4D1 -#pragma varlocate 14 B4D1bits -#pragma varlocate 14 B4D2 -#pragma varlocate 14 B4D2bits -#pragma varlocate 14 B4D3 -#pragma varlocate 14 B4D3bits -#pragma varlocate 14 B4D4 -#pragma varlocate 14 B4D4bits -#pragma varlocate 14 B4D5 -#pragma varlocate 14 B4D5bits -#pragma varlocate 14 B4D6 -#pragma varlocate 14 B4D6bits -#pragma varlocate 14 B4D7 -#pragma varlocate 14 B4D7bits -#pragma varlocate 14 CANSTAT_RO5 -#pragma varlocate 14 CANSTAT_RO5bits -#pragma varlocate 14 CANCON_RO5 -#pragma varlocate 14 CANCON_RO5bits -#pragma varlocate 14 B5CON -#pragma varlocate 14 B5CONbits -#pragma varlocate 14 B5SIDH -#pragma varlocate 14 B5SIDHbits -#pragma varlocate 14 B5SIDL -#pragma varlocate 14 B5SIDLbits -#pragma varlocate 14 B5EIDH -#pragma varlocate 14 B5EIDHbits -#pragma varlocate 14 B5EIDL -#pragma varlocate 14 B5EIDLbits -#pragma varlocate 14 B5DLC -#pragma varlocate 14 B5DLCbits -#pragma varlocate 14 B5D0 -#pragma varlocate 14 B5D0bits -#pragma varlocate 14 B5D1 -#pragma varlocate 14 B5D1bits -#pragma varlocate 14 B5D2 -#pragma varlocate 14 B5D2bits -#pragma varlocate 14 B5D3 -#pragma varlocate 14 B5D3bits -#pragma varlocate 14 B5D4 -#pragma varlocate 14 B5D4bits -#pragma varlocate 14 B5D5 -#pragma varlocate 14 B5D5bits -#pragma varlocate 14 B5D6 -#pragma varlocate 14 B5D6bits -#pragma varlocate 14 B5D7 -#pragma varlocate 14 B5D7bits -#pragma varlocate 14 CANSTAT_RO4 -#pragma varlocate 14 CANSTAT_RO4bits -#pragma varlocate 14 CANCON_RO4 -#pragma varlocate 14 CANCON_RO4bits -#pragma varlocate 15 RXF0SIDH -#pragma varlocate 15 RXF0SIDHbits -#pragma varlocate 15 RXF0SIDL -#pragma varlocate 15 RXF0SIDLbits -#pragma varlocate 15 RXF0EIDH -#pragma varlocate 15 RXF0EIDHbits -#pragma varlocate 15 RXF0EIDL -#pragma varlocate 15 RXF0EIDLbits -#pragma varlocate 15 RXF1SIDH -#pragma varlocate 15 RXF1SIDHbits -#pragma varlocate 15 RXF1SIDL -#pragma varlocate 15 RXF1SIDLbits -#pragma varlocate 15 RXF1EIDH -#pragma varlocate 15 RXF1EIDHbits -#pragma varlocate 15 RXF1EIDL -#pragma varlocate 15 RXF1EIDLbits -#pragma varlocate 15 RXF2SIDH -#pragma varlocate 15 RXF2SIDHbits -#pragma varlocate 15 RXF2SIDL -#pragma varlocate 15 RXF2SIDLbits -#pragma varlocate 15 RXF2EIDH -#pragma varlocate 15 RXF2EIDHbits -#pragma varlocate 15 RXF2EIDL -#pragma varlocate 15 RXF2EIDLbits -#pragma varlocate 15 RXF3SIDH -#pragma varlocate 15 RXF3SIDHbits -#pragma varlocate 15 RXF3SIDL -#pragma varlocate 15 RXF3SIDLbits -#pragma varlocate 15 RXF3EIDH -#pragma varlocate 15 RXF3EIDHbits -#pragma varlocate 15 RXF3EIDL -#pragma varlocate 15 RXF3EIDLbits -#pragma varlocate 15 RXF4SIDH -#pragma varlocate 15 RXF4SIDHbits -#pragma varlocate 15 RXF4SIDL -#pragma varlocate 15 RXF4SIDLbits -#pragma varlocate 15 RXF4EIDH -#pragma varlocate 15 RXF4EIDHbits -#pragma varlocate 15 RXF4EIDL -#pragma varlocate 15 RXF4EIDLbits -#pragma varlocate 15 RXF5SIDH -#pragma varlocate 15 RXF5SIDHbits -#pragma varlocate 15 RXF5SIDL -#pragma varlocate 15 RXF5SIDLbits -#pragma varlocate 15 RXF5EIDH -#pragma varlocate 15 RXF5EIDHbits -#pragma varlocate 15 RXF5EIDL -#pragma varlocate 15 RXF5EIDLbits -#pragma varlocate 15 RXM0SIDH -#pragma varlocate 15 RXM0SIDHbits -#pragma varlocate 15 RXM0SIDL -#pragma varlocate 15 RXM0SIDLbits -#pragma varlocate 15 RXM0EIDH -#pragma varlocate 15 RXM0EIDHbits -#pragma varlocate 15 RXM0EIDL -#pragma varlocate 15 RXM0EIDLbits -#pragma varlocate 15 RXM1SIDH -#pragma varlocate 15 RXM1SIDHbits -#pragma varlocate 15 RXM1SIDL -#pragma varlocate 15 RXM1SIDLbits -#pragma varlocate 15 RXM1EIDH -#pragma varlocate 15 RXM1EIDHbits -#pragma varlocate 15 RXM1EIDL -#pragma varlocate 15 RXM1EIDLbits -#pragma varlocate 15 TXB2CON -#pragma varlocate 15 TXB2CONbits -#pragma varlocate 15 TXB2SIDH -#pragma varlocate 15 TXB2SIDHbits -#pragma varlocate 15 TXB2SIDL -#pragma varlocate 15 TXB2SIDLbits -#pragma varlocate 15 TXB2EIDH -#pragma varlocate 15 TXB2EIDHbits -#pragma varlocate 15 TXB2EIDL -#pragma varlocate 15 TXB2EIDLbits -#pragma varlocate 15 TXB2DLC -#pragma varlocate 15 TXB2DLCbits -#pragma varlocate 15 TXB2D0 -#pragma varlocate 15 TXB2D0bits -#pragma varlocate 15 TXB2D1 -#pragma varlocate 15 TXB2D1bits -#pragma varlocate 15 TXB2D2 -#pragma varlocate 15 TXB2D2bits -#pragma varlocate 15 TXB2D3 -#pragma varlocate 15 TXB2D3bits -#pragma varlocate 15 TXB2D4 -#pragma varlocate 15 TXB2D4bits -#pragma varlocate 15 TXB2D5 -#pragma varlocate 15 TXB2D5bits -#pragma varlocate 15 TXB2D6 -#pragma varlocate 15 TXB2D6bits -#pragma varlocate 15 TXB2D7 -#pragma varlocate 15 TXB2D7bits -#pragma varlocate 15 CANSTAT_RO3 -#pragma varlocate 15 CANSTAT_RO3bits -#pragma varlocate 15 CANCON_RO3 -#pragma varlocate 15 CANCON_RO3bits -#pragma varlocate 15 TXB1CON -#pragma varlocate 15 TXB1CONbits -#pragma varlocate 15 TXB1SIDH -#pragma varlocate 15 TXB1SIDHbits -#pragma varlocate 15 TXB1SIDL -#pragma varlocate 15 TXB1SIDLbits -#pragma varlocate 15 TXB1EIDH -#pragma varlocate 15 TXB1EIDHbits -#pragma varlocate 15 TXB1EIDL -#pragma varlocate 15 TXB1EIDLbits -#pragma varlocate 15 TXB1DLC -#pragma varlocate 15 TXB1DLCbits -#pragma varlocate 15 TXB1D0 -#pragma varlocate 15 TXB1D0bits -#pragma varlocate 15 TXB1D1 -#pragma varlocate 15 TXB1D1bits -#pragma varlocate 15 TXB1D2 -#pragma varlocate 15 TXB1D2bits -#pragma varlocate 15 TXB1D3 -#pragma varlocate 15 TXB1D3bits -#pragma varlocate 15 TXB1D4 -#pragma varlocate 15 TXB1D4bits -#pragma varlocate 15 TXB1D5 -#pragma varlocate 15 TXB1D5bits -#pragma varlocate 15 TXB1D6 -#pragma varlocate 15 TXB1D6bits -#pragma varlocate 15 TXB1D7 -#pragma varlocate 15 TXB1D7bits -#pragma varlocate 15 CANSTAT_RO2 -#pragma varlocate 15 CANSTAT_RO2bits -#pragma varlocate 15 CANCON_RO2 -#pragma varlocate 15 CANCON_RO2bits -#pragma varlocate 15 TXB0CON -#pragma varlocate 15 TXB0CONbits -#pragma varlocate 15 TXB0SIDH -#pragma varlocate 15 TXB0SIDHbits -#pragma varlocate 15 TXB0SIDL -#pragma varlocate 15 TXB0SIDLbits -#pragma varlocate 15 TXB0EIDH -#pragma varlocate 15 TXB0EIDHbits -#pragma varlocate 15 TXB0EIDL -#pragma varlocate 15 TXB0EIDLbits -#pragma varlocate 15 TXB0DLC -#pragma varlocate 15 TXB0DLCbits -#pragma varlocate 15 TXB0D0 -#pragma varlocate 15 TXB0D0bits -#pragma varlocate 15 TXB0D1 -#pragma varlocate 15 TXB0D1bits -#pragma varlocate 15 TXB0D2 -#pragma varlocate 15 TXB0D2bits -#pragma varlocate 15 TXB0D3 -#pragma varlocate 15 TXB0D3bits -#pragma varlocate 15 TXB0D4 -#pragma varlocate 15 TXB0D4bits -#pragma varlocate 15 TXB0D5 -#pragma varlocate 15 TXB0D5bits -#pragma varlocate 15 TXB0D6 -#pragma varlocate 15 TXB0D6bits -#pragma varlocate 15 TXB0D7 -#pragma varlocate 15 TXB0D7bits -#pragma varlocate 15 CANSTAT_RO1 -#pragma varlocate 15 CANSTAT_RO1bits -#pragma varlocate 15 CANCON_RO1 -#pragma varlocate 15 CANCON_RO1bits -#pragma varlocate 15 RXB1CON -#pragma varlocate 15 RXB1CONbits -#pragma varlocate 15 RXB1SIDH -#pragma varlocate 15 RXB1SIDHbits -#pragma varlocate 15 RXB1SIDL -#pragma varlocate 15 RXB1SIDLbits -#pragma varlocate 15 RXB1EIDH -#pragma varlocate 15 RXB1EIDHbits -#pragma varlocate 15 RXB1EIDL -#pragma varlocate 15 RXB1EIDLbits -#pragma varlocate 15 RXB1DLC -#pragma varlocate 15 RXB1DLCbits -#pragma varlocate 15 RXB1D0 -#pragma varlocate 15 RXB1D0bits -#pragma varlocate 15 RXB1D1 -#pragma varlocate 15 RXB1D1bits -#pragma varlocate 15 RXB1D2 -#pragma varlocate 15 RXB1D2bits -#pragma varlocate 15 RXB1D3 -#pragma varlocate 15 RXB1D3bits -#pragma varlocate 15 RXB1D4 -#pragma varlocate 15 RXB1D4bits -#pragma varlocate 15 RXB1D5 -#pragma varlocate 15 RXB1D5bits -#pragma varlocate 15 RXB1D6 -#pragma varlocate 15 RXB1D6bits -#pragma varlocate 15 RXB1D7 -#pragma varlocate 15 RXB1D7bits -#pragma varlocate 15 CANSTAT_RO0 -#pragma varlocate 15 CANSTAT_RO0bits -#pragma varlocate 15 CANCON_RO0 -#pragma varlocate 15 CANCON_RO0bits - - -#line 4978 "C:/MCC18/h/p18f4685.h" - -#line 4980 "C:/MCC18/h/p18f4685.h" -#line 4981 "C:/MCC18/h/p18f4685.h" - - -#line 4984 "C:/MCC18/h/p18f4685.h" - -#line 4986 "C:/MCC18/h/p18f4685.h" -#line 4987 "C:/MCC18/h/p18f4685.h" -#line 4988 "C:/MCC18/h/p18f4685.h" -#line 4989 "C:/MCC18/h/p18f4685.h" - -#line 4991 "C:/MCC18/h/p18f4685.h" -#line 4992 "C:/MCC18/h/p18f4685.h" -#line 4993 "C:/MCC18/h/p18f4685.h" -#line 4994 "C:/MCC18/h/p18f4685.h" -#line 4995 "C:/MCC18/h/p18f4685.h" - - -#line 4999 "C:/MCC18/h/p18f4685.h" - -#line 5001 "C:/MCC18/h/p18f4685.h" - - -#line 5004 "C:/MCC18/h/p18f4685.h" -#line 80 "p2_deco_main - 090915b.c" - -#line 1 "C:/MCC18/h/math.h" - - -#line 4 "C:/MCC18/h/math.h" - -typedef float float_t; -typedef float double_t; - -#line 9 "C:/MCC18/h/math.h" -#line 10 "C:/MCC18/h/math.h" -#line 11 "C:/MCC18/h/math.h" - -float fabs (auto float x); -float ldexp (auto float x, auto int n); -float exp (auto float f); -float sqrt (auto float x); -float asin (auto float x); -float acos (auto float x); -float atan2 (auto float y, auto float x); -float atan (auto float x); -float sin (auto float x); -float cos (auto float x); -float tan (auto float x); -float sinh (auto float x); -float cosh (auto float x); -float tanh (auto float x); -float frexp (auto float x, auto int *pexp); -float log10 (auto float x); -float log (auto float x); -float pow (auto float x, auto float y); -float ceil (auto float x); -float floor (auto float x); -float modf (auto float x, auto float *ipart); -float fmod (auto float x, auto float y); - -float mchptoieee (auto unsigned long v); -unsigned long ieeetomchp (auto float v); - -#line 39 "C:/MCC18/h/math.h" -#line 81 "p2_deco_main - 090915b.c" - - - - - - - #pragma config OSC = IRCIO67 - #pragma config FCMEN = OFF - #pragma config IESO = OFF - #pragma config PWRT = ON - #pragma config BOREN = OFF - #pragma config WDT = OFF - #pragma config WDTPS = 128 - #pragma config MCLRE = ON - #pragma config LPT1OSC = OFF - #pragma config PBADEN = OFF - #pragma config DEBUG = OFF - #pragma config XINST = OFF - #pragma config LVP = OFF - #pragma config STVREN = OFF - - - - - -#line 107 "p2_deco_main - 090915b.c" -#line 108 "p2_deco_main - 090915b.c" -#line 109 "p2_deco_main - 090915b.c" - - -#line 112 "p2_deco_main - 090915b.c" -#line 113 "p2_deco_main - 090915b.c" -#line 114 "p2_deco_main - 090915b.c" -#line 115 "p2_deco_main - 090915b.c" - -#line 117 "p2_deco_main - 090915b.c" -#line 118 "p2_deco_main - 090915b.c" -#line 119 "p2_deco_main - 090915b.c" -#line 120 "p2_deco_main - 090915b.c" - -#line 122 "p2_deco_main - 090915b.c" -#line 123 "p2_deco_main - 090915b.c" -#line 124 "p2_deco_main - 090915b.c" -#line 125 "p2_deco_main - 090915b.c" - -#line 127 "p2_deco_main - 090915b.c" -#line 128 "p2_deco_main - 090915b.c" -#line 129 "p2_deco_main - 090915b.c" -#line 130 "p2_deco_main - 090915b.c" - - -#line 133 "p2_deco_main - 090915b.c" -#line 134 "p2_deco_main - 090915b.c" -#line 135 "p2_deco_main - 090915b.c" -#line 136 "p2_deco_main - 090915b.c" - -#line 138 "p2_deco_main - 090915b.c" -#line 139 "p2_deco_main - 090915b.c" -#line 140 "p2_deco_main - 090915b.c" -#line 141 "p2_deco_main - 090915b.c" - -#line 143 "p2_deco_main - 090915b.c" -#line 144 "p2_deco_main - 090915b.c" -#line 145 "p2_deco_main - 090915b.c" -#line 146 "p2_deco_main - 090915b.c" - -#line 148 "p2_deco_main - 090915b.c" -#line 149 "p2_deco_main - 090915b.c" -#line 150 "p2_deco_main - 090915b.c" -#line 151 "p2_deco_main - 090915b.c" - - -#line 154 "p2_deco_main - 090915b.c" -#line 155 "p2_deco_main - 090915b.c" -#line 156 "p2_deco_main - 090915b.c" -#line 157 "p2_deco_main - 090915b.c" - -#line 159 "p2_deco_main - 090915b.c" -#line 160 "p2_deco_main - 090915b.c" -#line 161 "p2_deco_main - 090915b.c" -#line 162 "p2_deco_main - 090915b.c" - -#line 164 "p2_deco_main - 090915b.c" -#line 165 "p2_deco_main - 090915b.c" -#line 166 "p2_deco_main - 090915b.c" -#line 167 "p2_deco_main - 090915b.c" - - - - - - - - - - - - - - - - - - - - - -#line 189 "p2_deco_main - 090915b.c" -#line 190 "p2_deco_main - 090915b.c" -#line 191 "p2_deco_main - 090915b.c" - -#line 193 "p2_deco_main - 090915b.c" -#line 194 "p2_deco_main - 090915b.c" - -#line 196 "p2_deco_main - 090915b.c" -#line 197 "p2_deco_main - 090915b.c" - - -#pragma udata bank0a=0x060 -volatile unsigned char wp_stringstore[26]; -volatile unsigned char wp_color1; -volatile unsigned char wp_color2; -volatile unsigned char wp_top; -volatile unsigned char wp_leftx2; -volatile unsigned char wp_font; -volatile unsigned char wp_invert; -volatile unsigned char wp_temp_U8; - -#pragma udata bank0b=0x081 -volatile unsigned char wp_txtptr; -volatile unsigned char wp_char; -volatile unsigned char wp_command; -volatile unsigned int wp_data_16bit; -volatile unsigned char wp_data_8bit_one; -volatile unsigned char wp_data_8bit_two; -volatile unsigned int wp_start; -volatile unsigned int wp_end; -volatile unsigned int wp_i; -volatile unsigned char wp_black; - -volatile unsigned char wp_debug_U8; - - -#pragma udata bank0c=0x0D0 -#line 226 "p2_deco_main - 090915b.c" -volatile unsigned char keep_free_bank0[48 ]; - - -#pragma udata bank1=0x100 -#line 231 "p2_deco_main - 090915b.c" -volatile unsigned char keep_free_bank1[256 ]; - - #pragma udata bank2a=0x200 - - static unsigned int int_O_tissue_for_debug[32]; - static unsigned int int_O_GF_spare____; - static unsigned int int_O_GF_step; - static unsigned int int_O_gtissue_limit; - static unsigned int int_O_gtissue_press; - static unsigned int int_O_limit_GF_low; - static unsigned int int_O_gtissue_press_at_GF_low; - - - #pragma udata bank2b=0x24E - static unsigned char char_O_GF_low_pointer; - static unsigned char char_O_actual_pointer; - #pragma udata bank2c=0x250 - static unsigned char char_O_deco_table[32]; - #pragma udata bank2d=0x270 - static unsigned char char_I_table_deco_done[32]; - #pragma udata bank2e=0x290 - static unsigned int int_O_calc_tissue_call_counter; - - unsigned char lock_GF_depth_list; - static float temp_limit; - static float GF_low; - static float GF_high; - static float GF_delta; - static float GF_temp; - static float GF_step; - static float GF_step2; - static float temp_pres_gtissue; - static float temp_pres_gtissue_diff; - static float temp_pres_gtissue_limit_GF_low; - static float temp_pres_gtissue_limit_GF_low_below_surface; - static unsigned int temp_depth_limit; - static unsigned char temp_decotime; - static unsigned char temp_gtissue_no; - static unsigned int temp_depth_last_deco; - - static unsigned char temp_depth_GF_low_meter; - static unsigned char temp_depth_GF_low_number; - static unsigned char internal_deco_pointer; - static unsigned char internal_deco_table[32]; - static float temp_pres_deco_GF_low; - -static unsigned int debug_temp; - - -#pragma udata bank3a=0x300 -static char output[32]; - -#pragma udata bank3b=0x380 -volatile float pres_tissue_vault[32]; - -#pragma udata bank4a=0x400 - - unsigned char ci ; - unsigned char x; - unsigned int main_i; - unsigned int int_temp; - unsigned int int_temp_decostatus; - static float pres_respiration; - static float pres_surface; - static float temp1; - static float temp2; - static float temp3; - static float temp4; - static float temp_deco; - static float temp_atem; - static float temp2_atem; - static float temp_tissue; - static float temp_surface; - static float N2_ratio; - static float He_ratio; - static float temp_ratio; - static float var_a; - static float var2_a; - static float var_b; - static float var2_b; - static float var_t05nc; - static float var2_t05nc; - static float var_e2secs; - static float var2_e2secs; - static float var_e1min; - static float var2_e1min; - static float var_halftimes; - static float var2_halftimes; - static float pres_gtissue_limit; - static float temp_pres_gtissue_limit; - static float actual_ppO2; - - #pragma udata bank4b=0x480 - static float pres_tissue[32]; - - #pragma udata bank5=0x500 - - - static unsigned int int_I_pres_respiration; - static unsigned int int_I_pres_surface; - static unsigned int int_I_temp; - static unsigned char char_I_temp; - static unsigned char char_I_actual_ppO2; - static unsigned int int_I_spare_3; - static unsigned int int_I_spare_4; - static unsigned int int_I_spare_5; - static unsigned int int_I_spare_6; - static unsigned char char_I_N2_ratio; - static unsigned char char_I_He_ratio; - static unsigned char char_I_saturation_multiplier; - static unsigned char char_I_desaturation_multiplier; - static unsigned char char_I_GF_High_percentage; - static unsigned char char_I_GF_Low_percentage; - static unsigned char char_I_spare; - static unsigned char char_I_deco_distance; - static unsigned char char_I_const_ppO2; - static unsigned char char_I_deco_ppO2_change; - static unsigned char char_I_deco_ppO2; - static unsigned char char_I_deco_gas_change; - static unsigned char char_I_deco_N2_ratio; - static unsigned char char_I_deco_He_ratio; - static unsigned char char_I_depth_last_deco; - static unsigned char char_I_deco_model; - - static unsigned int int_O_desaturation_time; - static unsigned char char_O_nullzeit; - static unsigned char char_O_deco_status; - static unsigned char char_O_array_decotime[7]; - static unsigned char char_O_array_decodepth[6]; - static unsigned char char_O_ascenttime; - static unsigned char char_O_gradient_factor; - static unsigned char char_O_tissue_saturation[32]; - static unsigned char char_O_array_gradient_weighted[16]; - static unsigned char char_O_gtissue_no; - static unsigned char char_O_diluent; - static unsigned char char_O_CNS_fraction; - static unsigned char char_O_relative_gradient_GF; - - - static float pres_tissue_limit[16]; - static float sim_pres_tissue_limit[16]; - static float pres_diluent; - static float deco_diluent; - static float const_ppO2; - static float deco_ppO2_change; - static float deco_ppO2; - - #pragma udata bank6=0x600 - - static float sim_pres_tissue[32]; - static float sim_pres_tissue_backup[32]; - - - - - #pragma udata bank8=0x800 - static char md_pi_subst[256]; - - #pragma udata bank9a=0x900 - - static char md_state[48]; - #pragma udata bank9b=0x930 - - static unsigned int int_O_DBS_bitfield; - static unsigned int int_O_DBS2_bitfield; - static unsigned int int_O_DBG_pre_bitfield; - static unsigned int int_O_DBG_post_bitfield; - static char char_O_NDL_at_20mtr; - - static char md_t; - static char md_buffer[16]; - static char md_cksum[16]; - static char md_i; - static char md_j; - static char md_temp; - static unsigned int md_pointer; - static float deco_N2_ratio; - static float deco_He_ratio; - static float calc_N2_ratio; - static float calc_He_ratio; - static float deco_gas_change; - static float CNS_fraction; - static float float_saturation_multiplier; - static float float_desaturation_multiplier; - static float float_deco_distance; - - static unsigned char DBG_char_I_deco_model; - static unsigned char DBG_char_I_depth_last_deco; - static float DBG_pres_surface; - static float DBG_GF_low; - static float DBG_GF_high; - static float DBG_const_ppO2; - static float DBG_deco_ppO2_change; - static float DBG_deco_ppO2; - static float DBG_deco_N2_ratio; - static float DBG_deco_He_ratio; - static float DBG_deco_gas_change; - static float DBG_float_saturation_multiplier; - static float DBG_float_desaturation_multiplier; - static float DBG_float_deco_distance; - static float DBG_deco_N2_ratio; - static float DBG_deco_He_ratio; - static float DBG_N2_ratio; - static float DBG_He_ratio; - static char flag_in_divemode; - static int int_dbg_i; - unsigned int temp_DBS; - - - - -void main_calc_hauptroutine(void); -void main_calc_without_deco(void); -void main_clear_tissue(void); -void main_calc_percentage(void); -void main_calc_wo_deco_step_1_min(void); -void main_debug(void); -void main_gradient_array(void); -void main_hash(void); - -void calc_hauptroutine(void); -void calc_tissue(void); -void calc_nullzeit(void); -void backup_sim_pres_tissue(void); -void restore_sim_pres_tissue(void); - -void calc_without_deco(void); -void clear_tissue(void); -void calc_ascenttime(void); -void update_startvalues(void); -void clear_decoarray(void); -void update_decoarray(void); -void sim_tissue_1min(void); -void sim_tissue_10min(void); -void calc_gradient_factor(void); -void calc_gradient_array_only(void); -void calc_desaturation_time(void); -void calc_wo_deco_step_1_min(void); -void calc_tissue_step_1_min(void); -void hash(void); -void clear_CNS_fraction(void); -void calc_CNS_fraction(void); -void calc_CNS_decrease_15min(void); -void calc_percentage(void); -void main(void); -void calc_hauptroutine_data_input(void); -void calc_hauptroutine_update_tissues(void); -void calc_hauptroutine_calc_deco(void); -void calc_hauptroutine_calc_ascend_to_deco(void); -void calc_nextdecodepth_GF(void); -void copy_deco_table_GF(void); -void clear_internal_deco_table_GF(void); -void update_internal_deco_table_GF(void); -void push_tissues_to_vault(void); -void pull_tissues_from_vault(void); -void main_push_tissues_to_vault(void); -void main_pull_tissues_from_vault(void); -void wordprocessor(void); - - - - - -#pragma romdata der_code = 0x0000 -#pragma code der_start = 0x0000 -void der_start(void) -{ -_asm - goto main -_endasm -} - - - - - - -#pragma code main = 0x9000 -void main(void) -{ - for(wp_temp_U8=0;wp_temp_U8<48 - 1;wp_temp_U8++) - keep_free_bank0[wp_temp_U8] = 7; - keep_free_bank0[48 - 1] = 7; - - for(wp_temp_U8=0;wp_temp_U8<256 - 1;wp_temp_U8++) - keep_free_bank1[wp_temp_U8] = 7; - keep_free_bank1[256 - 1] = 7; - -#line 520 "p2_deco_main - 090915b.c" - - -wp_top = 10; -wp_leftx2 = 10; -wp_color1 = 255; -wp_color2 = 255; -wp_font = 0; -wp_invert = 0; -wp_stringstore[0] = ' '; -wp_stringstore[1] = '!'; -wp_stringstore[2] = '"'; -wp_stringstore[3] = ':'; -wp_stringstore[4] = 0; -wordprocessor(); - -GF_low = 1.0; -GF_high = 1.0; - -GF_temp = GF_low * GF_high; - -clear_CNS_fraction(); - - - - - - - - - -int_I_pres_respiration = 1000; -int_I_pres_surface = 1000; -char_I_N2_ratio = 39; -char_I_He_ratio = 40; -char_I_deco_distance = 0; -char_I_depth_last_deco = 3; - -char_I_const_ppO2 = 0; -char_I_deco_ppO2_change = 0; -char_I_deco_ppO2 = 0; - -char_I_deco_gas_change = 0; -char_I_deco_N2_ratio = 0; -char_I_deco_He_ratio = 0; - - -char_I_GF_High_percentage = 100; -char_I_GF_Low_percentage = 100; - -char_I_saturation_multiplier = 110; -char_I_desaturation_multiplier = 90; - -char_I_deco_model = 0; - -main_clear_tissue(); - -int_I_pres_respiration = 1000 + int_I_pres_surface; -main_calc_wo_deco_step_1_min(); -int_I_pres_respiration = 3000 + int_I_pres_surface; -main_calc_wo_deco_step_1_min(); -int_I_pres_respiration = 5000 + int_I_pres_surface; -main_calc_wo_deco_step_1_min(); - - -#line 587 "p2_deco_main - 090915b.c" - - -char_O_deco_status = 255; -while (char_O_deco_status) - main_calc_hauptroutine(); -_asm -nop -_endasm - -for (main_i=0;main_i<50;main_i++) -{ -main_calc_hauptroutine(); -} -int_I_pres_respiration = 10000; -for (main_i=0;main_i<1500;main_i++) -{ -main_calc_hauptroutine(); -} - -_asm -nop -_endasm - - -int_I_pres_respiration = 3000; -for (main_i=0;main_i<150;main_i++) -{ - calc_hauptroutine_data_input(); - calc_hauptroutine_update_tissues(); -} - - update_startvalues(); - clear_decoarray(); - clear_internal_deco_table_GF(); - calc_hauptroutine_calc_ascend_to_deco(); - if (char_O_deco_status > 15) - { - char_O_deco_status = 2; - - } - else - { - - calc_hauptroutine_calc_deco(); - } - - -_asm -nop -_endasm -while (char_O_deco_status == 1) -{ - char_O_deco_status = 0; - - calc_hauptroutine_calc_deco(); - -_asm -nop -_endasm -}; -debug_temp = 60; -int_I_pres_respiration = 9980; -for (main_i=0;main_i<debug_temp;main_i++) -{ -int_I_pres_respiration = int_I_pres_respiration - 33; - calc_hauptroutine_data_input(); - calc_hauptroutine_update_tissues(); -int_I_pres_respiration = int_I_pres_respiration - 33; - calc_hauptroutine_data_input(); - calc_hauptroutine_update_tissues(); -int_I_pres_respiration = int_I_pres_respiration - 34; - calc_hauptroutine_data_input(); - calc_hauptroutine_update_tissues(); -} -_asm -nop -_endasm - - update_startvalues(); - clear_decoarray(); - clear_internal_deco_table_GF(); - calc_hauptroutine_calc_ascend_to_deco(); - if (char_O_deco_status > 15) - { - char_O_deco_status = 2; - - } - else - { - - calc_hauptroutine_calc_deco(); - } - - -_asm -nop -_endasm -while (char_O_deco_status == 1) -{ - char_O_deco_status = 0; - - calc_hauptroutine_calc_deco(); - -_asm -nop -_endasm -}; -_asm -nop -_endasm -debug_temp = 60; -int_I_pres_respiration = 9980; -debug_temp = debug_temp * 3; -for (main_i=0;main_i<debug_temp;main_i++) -{ - calc_hauptroutine_data_input(); - calc_hauptroutine_update_tissues(); -} -_asm -nop -_endasm -#line 709 "p2_deco_main - 090915b.c" - - -} - - - - - - - - - - - - - - - -#pragma romdata font_data_small = 0x0A0C4 -rom const rom unsigned int wp_small_data[] = -{ -#line 1 "./ostc28.drx.txt" -0xF803 -,0x8A01 -,0x850C -,0x8202 -,0x850A -,0x8302 -,0xFF94 -,0xCD00 -,0x9105 -,0x9103 -,0xC701 -,0x9105 -,0x9103 -,0xDA9D -,0x0183 -,0x018F -,0x0183 -,0x018F -,0x0183 -,0x0688 -,0x0D87 -,0x0781 -,0x018F -,0x0183 -,0x018F -,0x0183 -,0x018F -,0x0182 -,0x0786 -,0x0D89 -,0x0583 -,0x018F -,0x0183 -,0x018F -,0x0183 -,0x00A2 -,0xB402 -,0x8601 -,0x8A04 -,0x8601 -,0x8801 -,0x8102 -,0x8501 -,0x8800 -,0x8301 -,0x8600 -,0x8702 -,0x8202 -,0x8501 -,0x8512 -,0x8501 -,0x8402 -,0x8401 -,0x8700 -,0x8501 -,0x8301 -,0x8801 -,0x8402 -,0x8201 -,0x8901 -,0x8405 -,0x9203 -,0x9F9A -,0x0392 -,0x0588 -,0x0185 -,0x0183 -,0x0185 -,0x0286 -,0x0183 -,0x0084 -,0x0289 -,0x0582 -,0x038B -,0x0382 -,0x0292 -,0x0282 -,0x028C -,0x0283 -,0x0489 -,0x0284 -,0x0182 -,0x0186 -,0x0385 -,0x0183 -,0x0086 -,0x0187 -,0x0182 -,0x0191 -,0x049D -,0xA403 -,0x9106 -,0x8804 -,0x8102 -,0x8202 -,0x8608 -,0x8501 -,0x8600 -,0x8402 -,0x8501 -,0x8600 -,0x8403 -,0x8401 -,0x8601 -,0x8205 -,0x8301 -,0x8606 -,0x8202 -,0x8001 -,0x8803 -,0x8503 -,0x9402 -,0x9206 -,0x9001 -,0x8200 -,0x9DFF -,0x9401 -,0x9006 -,0x9102 -,0xFF8B -,0xE707 -,0x8C0C -,0x8903 -,0x8703 -,0x8602 -,0x8B02 -,0x8401 -,0x8E02 -,0x8201 -,0x9101 -,0x8101 -,0x9102 -,0x8000 -,0x9300 -,0xB0B0 -,0x0093 -,0x0081 -,0x0191 -,0x0181 -,0x028F -,0x0282 -,0x028D -,0x0284 -,0x028B -,0x0286 -,0x0387 -,0x0389 -,0x0B8D -,0x07E7 -,0x9F00 -,0x9601 -,0x9501 -,0x8202 -,0x9000 -,0x8102 -,0x9104 -,0x8D07 -,0x8F07 -,0x9404 -,0x9200 -,0x8102 -,0x9001 -,0x8301 -,0x8F01 -,0x9500 -,0xA6A0 -,0x0195 -,0x0195 -,0x0195 -,0x0195 -,0x0191 -,0x0A8B -,0x0B90 -,0x0195 -,0x0195 -,0x0195 -,0x0195 -,0x01A4 -,0xFF88 -,0x0182 -,0x018F -,0x0690 -,0x0494 -,0x00FC -,0xB801 -,0x9501 -,0x9501 -,0x9501 -,0x9501 -,0x9501 -,0x9501 -,0x9501 -,0x9501 -,0x9501 -,0xBCFF -,0x8701 -,0x9502 -,0x9402 -,0xFF94 -,0xC101 -,0x9303 -,0x9004 -,0x9004 -,0x9004 -,0x9003 -,0x9103 -,0x9103 -,0x9103 -,0x9301 -,0xC4A0 -,0x0290 -,0x0A8B -,0x0285 -,0x0389 -,0x0186 -,0x0587 -,0x0186 -,0x0183 -,0x0186 -,0x0086 -,0x0184 -,0x0186 -,0x0084 -,0x0285 -,0x0186 -,0x0182 -,0x0286 -,0x0186 -,0x0280 -,0x0187 -,0x0188 -,0x0484 -,0x038B -,0x0A90 -,0x02A3 -,0xCA01 -,0x9501 -,0x9401 -,0x9510 -,0x8610 -,0xFF94 -,0xB300 -,0x8B01 -,0x8701 -,0x8903 -,0x8601 -,0x8904 -,0x8601 -,0x8802 -,0x8001 -,0x8600 -,0x8801 -,0x8201 -,0x8600 -,0x8701 -,0x8301 -,0x8601 -,0x8501 -,0x8401 -,0x8602 -,0x8301 -,0x8501 -,0x8706 -,0x8601 -,0x8804 -,0x8701 -,0xB4BF -,0x0188 -,0x008B -,0x0187 -,0x018C -,0x0186 -,0x0085 -,0x0185 -,0x0186 -,0x0085 -,0x0185 -,0x0186 -,0x0085 -,0x0185 -,0x0186 -,0x0183 -,0x0285 -,0x0186 -,0x0281 -,0x0180 -,0x0183 -,0x0188 -,0x0482 -,0x0592 -,0x03B7 -,0xA400 -,0x9402 -,0x9204 -,0x9102 -,0x8001 -,0x8F02 -,0x8201 -,0x8E02 -,0x8301 -,0x8C02 -,0x8501 -,0x8B10 -,0x8610 -,0x9002 -,0x9401 -,0x9600 -,0xA1B7 -,0x0185 -,0x0088 -,0x0883 -,0x0287 -,0x0282 -,0x0185 -,0x0187 -,0x0084 -,0x0087 -,0x0186 -,0x0084 -,0x0087 -,0x0186 -,0x0084 -,0x0087 -,0x0186 -,0x0084 -,0x0186 -,0x0186 -,0x0084 -,0x0185 -,0x0187 -,0x0085 -,0x0887 -,0x0086 -,0x06B6 -,0xB508 -,0x8C0C -,0x8902 -,0x8201 -,0x8302 -,0x8701 -,0x8301 -,0x8601 -,0x8601 -,0x8301 -,0x8601 -,0x8600 -,0x8400 -,0x8701 -,0x8600 -,0x8401 -,0x8601 -,0x8601 -,0x8302 -,0x8401 -,0x8701 -,0x8408 -,0x8F05 -,0xB7B1 -,0x0096 -,0x0096 -,0x008D -,0x0186 -,0x008A -,0x0486 -,0x0087 -,0x0588 -,0x0085 -,0x048B -,0x0082 -,0x058D -,0x0690 -,0x0393 -,0x01C3 -,0xBB04 -,0x8904 -,0x8206 -,0x8702 -,0x8002 -,0x8001 -,0x8301 -,0x8701 -,0x8302 -,0x8501 -,0x8600 -,0x8501 -,0x8501 -,0x8600 -,0x8501 -,0x8501 -,0x8601 -,0x8302 -,0x8501 -,0x8602 -,0x8101 -,0x8001 -,0x8301 -,0x8805 -,0x8106 -,0x8902 -,0x8404 -,0xB6B3 -,0x0586 -,0x0088 -,0x0784 -,0x0187 -,0x0284 -,0x0184 -,0x0186 -,0x0186 -,0x0084 -,0x0186 -,0x0087 -,0x0183 -,0x0186 -,0x0087 -,0x0084 -,0x0186 -,0x0185 -,0x0183 -,0x0187 -,0x0284 -,0x0182 -,0x0288 -,0x0D8B -,0x09B8 -,0xFE01 -,0x8601 -,0x8C02 -,0x8502 -,0x8B02 -,0x8502 -,0xFF94 -,0xFF01 -,0x8601 -,0x8201 -,0x8602 -,0x8506 -,0x8702 -,0x8504 -,0x9400 -,0xFCA0 -,0x0195 -,0x0293 -,0x0393 -,0x0081 -,0x0191 -,0x0181 -,0x0190 -,0x0183 -,0x018F -,0x0184 -,0x018D -,0x0185 -,0x018D -,0x0186 -,0x018B -,0x0187 -,0x018B -,0x0188 -,0x0189 -,0x0189 -,0x019E -,0x9E00 -,0x8400 -,0x9000 -,0x8400 -,0x9000 -,0x8400 -,0x9000 -,0x8400 -,0x9000 -,0x8400 -,0x9000 -,0x8400 -,0x9000 -,0x8400 -,0x9000 -,0x8400 -,0x9000 -,0x8400 -,0x9000 -,0x8400 -,0x9000 -,0x8400 -,0x9000 -,0x8400 -,0xA19A -,0x0189 -,0x018A -,0x0188 -,0x018A -,0x0187 -,0x018C -,0x0186 -,0x018C -,0x0185 -,0x018E -,0x0184 -,0x018E -,0x0183 -,0x0190 -,0x0181 -,0x0192 -,0x0081 -,0x0192 -,0x0394 -,0x0294 -,0x01A4 -,0xB101 -,0x9501 -,0x9401 -,0x9501 -,0x9401 -,0x8801 -,0x8202 -,0x8401 -,0x8604 -,0x8102 -,0x8501 -,0x8402 -,0x8401 -,0x8602 -,0x8202 -,0x8F06 -,0x9104 -,0xBF9D -,0x078D -,0x0481 -,0x048A -,0x0287 -,0x0288 -,0x018B -,0x0187 -,0x0184 -,0x0383 -,0x0087 -,0x0084 -,0x0582 -,0x0186 -,0x0083 -,0x0182 -,0x0182 -,0x0186 -,0x0083 -,0x0084 -,0x0082 -,0x0186 -,0x0182 -,0x0084 -,0x0082 -,0x0186 -,0x0281 -,0x0083 -,0x0182 -,0x0187 -,0x0A82 -,0x008A -,0x08A1 -,0xA702 -,0x9104 -,0x8F04 -,0x8F06 -,0x8D04 -,0x8201 -,0x8B03 -,0x8501 -,0x8C04 -,0x8301 -,0x8F04 -,0x8001 -,0x9105 -,0x9404 -,0x9504 -,0x9402 -,0x9C99 -,0x1086 -,0x1086 -,0x0085 -,0x0185 -,0x0186 -,0x0085 -,0x0086 -,0x0186 -,0x0085 -,0x0086 -,0x0186 -,0x0085 -,0x0086 -,0x0186 -,0x0085 -,0x0185 -,0x0186 -,0x0183 -,0x0285 -,0x0186 -,0x0183 -,0x0284 -,0x0287 -,0x0580 -,0x0281 -,0x0289 -,0x0382 -,0x0593 -,0x029F -,0x9E06 -,0x8E0A -,0x8A03 -,0x8503 -,0x8901 -,0x8902 -,0x8701 -,0x8B02 -,0x8600 -,0x8D01 -,0x8600 -,0x8D01 -,0x8600 -,0x8D01 -,0x8601 -,0x8C01 -,0x8601 -,0x8B01 -,0x8802 -,0x8802 -,0x8900 -,0x8A00 -,0x9E99 -,0x1086 -,0x1086 -,0x008D -,0x0186 -,0x008D -,0x0186 -,0x008D -,0x0186 -,0x008D -,0x0186 -,0x018C -,0x0186 -,0x018C -,0x0186 -,0x028A -,0x0188 -,0x0386 -,0x028B -,0x0A8E -,0x05A2 -,0xB110 -,0x8610 -,0x8600 -,0x8501 -,0x8501 -,0x8600 -,0x8501 -,0x8501 -,0x8600 -,0x8501 -,0x8501 -,0x8600 -,0x8501 -,0x8501 -,0x8600 -,0x8501 -,0x8501 -,0x8600 -,0x8501 -,0x8501 -,0x8600 -,0x8501 -,0x8501 -,0x8600 -,0x8D01 -,0xB4B1 -,0x1086 -,0x1086 -,0x0085 -,0x018E -,0x0085 -,0x008F -,0x0085 -,0x008F -,0x0085 -,0x008F -,0x0085 -,0x008F -,0x0085 -,0x008F -,0x0085 -,0x008F -,0x00C4 -,0x9E06 -,0x8D0B -,0x8A02 -,0x8702 -,0x8802 -,0x8A01 -,0x8701 -,0x8C01 -,0x8600 -,0x8D01 -,0x8600 -,0x8D01 -,0x8600 -,0x8700 -,0x8401 -,0x8601 -,0x8600 -,0x8401 -,0x8601 -,0x8600 -,0x8400 -,0x8802 -,0x8406 -,0x8900 -,0x8505 -,0x9EB1 -,0x1086 -,0x108D -,0x0195 -,0x0195 -,0x0195 -,0x0195 -,0x0195 -,0x018E -,0x1086 -,0x10B4 -,0xB100 -,0x8E00 -,0x8600 -,0x8D01 -,0x8600 -,0x8D01 -,0x8600 -,0x8D01 -,0x8610 -,0x8610 -,0x8600 -,0x8D01 -,0x8600 -,0x8D01 -,0x8600 -,0x8D01 -,0xCCBF -,0x0196 -,0x0195 -,0x0186 -,0x008D -,0x0186 -,0x008D -,0x0186 -,0x008C -,0x0187 -,0x0F87 -,0x0D89 -,0x0096 -,0x0096 -,0x00AC -,0x9910 -,0x8610 -,0x8D02 -,0x9302 -,0x9304 -,0x9102 -,0x8002 -,0x8F02 -,0x8202 -,0x8D01 -,0x8503 -,0x8A01 -,0x8802 -,0x8801 -,0x8A03 -,0x8600 -,0x8D01 -,0x9600 -,0x9CB1 -,0x1086 -,0x1095 -,0x0195 -,0x0195 -,0x0195 -,0x0195 -,0x0195 -,0x0195 -,0x0195 -,0x01B4 -,0x9910 -,0x8610 -,0x8703 -,0x9503 -,0x9503 -,0x9503 -,0x9302 -,0x9202 -,0x9203 -,0x9103 -,0x9210 -,0x8610 -,0x9C99 -,0x1086 -,0x1086 -,0x0395 -,0x0295 -,0x0395 -,0x0395 -,0x0395 -,0x0395 -,0x0295 -,0x0387 -,0x1086 -,0x109C -,0x9D08 -,0x8C0C -,0x8902 -,0x8703 -,0x8701 -,0x8B01 -,0x8701 -,0x8C01 -,0x8600 -,0x8D01 -,0x8600 -,0x8D01 -,0x8601 -,0x8C01 -,0x8601 -,0x8B01 -,0x8802 -,0x8802 -,0x890C -,0x8C08 -,0xA0B1 -,0x1086 -,0x1086 -,0x0086 -,0x008E -,0x0086 -,0x008E -,0x0086 -,0x008E -,0x0086 -,0x008E -,0x0184 -,0x018E -,0x0184 -,0x018E -,0x0282 -,0x028F -,0x0692 -,0x02A7 -,0x9D08 -,0x8C0C -,0x8902 -,0x8802 -,0x8701 -,0x8B02 -,0x8601 -,0x8C01 -,0x8600 -,0x8E02 -,0x8400 -,0x8E04 -,0x8201 -,0x8C01 -,0x8101 -,0x8201 -,0x8C01 -,0x8101 -,0x8302 -,0x8802 -,0x8201 -,0x840C -,0x8301 -,0x8608 -,0xA0B1 -,0x1086 -,0x1086 -,0x0086 -,0x008E -,0x0086 -,0x008E -,0x0086 -,0x008E -,0x0086 -,0x018D -,0x0184 -,0x048B -,0x0184 -,0x0180 -,0x0389 -,0x0783 -,0x0388 -,0x0586 -,0x028A -,0x008A -,0x009C -,0xB303 -,0x8602 -,0x8805 -,0x8601 -,0x8701 -,0x8202 -,0x8601 -,0x8601 -,0x8301 -,0x8601 -,0x8600 -,0x8501 -,0x8501 -,0x8600 -,0x8501 -,0x8501 -,0x8600 -,0x8501 -,0x8501 -,0x8601 -,0x8501 -,0x8302 -,0x8602 -,0x8402 -,0x8102 -,0x8801 -,0x8505 -,0x9301 -,0xA099 -,0x0096 -,0x0096 -,0x0096 -,0x0096 -,0x0096 -,0x1086 -,0x1086 -,0x0096 -,0x0096 -,0x0096 -,0x0096 -,0x00AC -,0x990C -,0x8A0E -,0x9502 -,0x9501 -,0x9601 -,0x9501 -,0x9501 -,0x9501 -,0x9401 -,0x9402 -,0x870E -,0x880C -,0xA099 -,0x0195 -,0x0494 -,0x0594 -,0x0594 -,0x0594 -,0x0592 -,0x048F -,0x048F -,0x048F -,0x048F -,0x0492 -,0x01AB -,0x9905 -,0x920A -,0x9209 -,0x9004 -,0x8E05 -,0x8E04 -,0x9005 -,0x9406 -,0x9406 -,0x9206 -,0x8909 -,0x8A06 -,0xA6A9 -,0x0086 -,0x018B -,0x0286 -,0x0388 -,0x0388 -,0x0384 -,0x038B -,0x0381 -,0x038F -,0x0591 -,0x058F -,0x0381 -,0x038C -,0x0285 -,0x0388 -,0x0387 -,0x0387 -,0x018B -,0x0296 -,0x009C -,0x9900 -,0x9602 -,0x9503 -,0x9503 -,0x9503 -,0x940A -,0x8D09 -,0x8B04 -,0x9004 -,0x9003 -,0x9202 -,0x9400 -,0xACA9 -,0x0086 -,0x008C -,0x0286 -,0x008A -,0x0486 -,0x0089 -,0x0280 -,0x0186 -,0x0087 -,0x0381 -,0x0186 -,0x0085 -,0x0383 -,0x0186 -,0x0084 -,0x0285 -,0x0186 -,0x0082 -,0x0386 -,0x0186 -,0x0080 -,0x0388 -,0x0186 -,0x038A -,0x0186 -,0x028B -,0x0195 -,0x019C -,0xDF15 -,0x8101 -,0x9101 -,0x8101 -,0x9101 -,0x8101 -,0x9101 -,0x8101 -,0x9101 -,0x8101 -,0x9101 -,0x8101 -,0x9101 -,0x8200 -,0x9100 -,0xB2B0 -,0x0195 -,0x0395 -,0x0395 -,0x0395 -,0x0395 -,0x0494 -,0x0495 -,0x0395 -,0x0395 -,0x01B3 -,0xB000 -,0x9100 -,0x8201 -,0x9101 -,0x8101 -,0x9101 -,0x8101 -,0x9101 -,0x8101 -,0x9101 -,0x8101 -,0x9101 -,0x8101 -,0x9101 -,0x8115 -,0xE1CE -,0x0194 -,0x0292 -,0x0292 -,0x0294 -,0x0296 -,0x0295 -,0x0395 -,0x01D6 -,0xAB00 -,0x9600 -,0x9600 -,0x9600 -,0x9600 -,0x9600 -,0x9600 -,0x9600 -,0x9600 -,0x9600 -,0x9600 -,0x9600 -,0x9AE0 -,0x0195 -,0x0395 -,0x0295 -,0x0295 -,0x00FF -,0x89A6 -,0x0193 -,0x048C -,0x0183 -,0x0180 -,0x028B -,0x0083 -,0x0182 -,0x018A -,0x0183 -,0x0084 -,0x008A -,0x0183 -,0x0084 -,0x008A -,0x0183 -,0x0084 -,0x008A -,0x0183 -,0x0083 -,0x008C -,0x0182 -,0x0082 -,0x018C -,0x0B8C -,0x0AB4 -,0xAF12 -,0x8411 -,0x8C01 -,0x8601 -,0x8C00 -,0x8801 -,0x8A01 -,0x8801 -,0x8A01 -,0x8801 -,0x8A01 -,0x8801 -,0x8B01 -,0x8602 -,0x8B03 -,0x8302 -,0x8D08 -,0x9004 -,0xA0B8 -,0x068F -,0x088D -,0x0284 -,0x028C -,0x0186 -,0x028A -,0x0188 -,0x018A -,0x0188 -,0x018A -,0x0188 -,0x018A -,0x0188 -,0x018B -,0x0186 -,0x018C -,0x0285 -,0x018D -,0x00A6 -,0xA104 -,0x9008 -,0x8D02 -,0x8402 -,0x8C01 -,0x8602 -,0x8A01 -,0x8801 -,0x8A01 -,0x8801 -,0x8A01 -,0x8801 -,0x8B00 -,0x8800 -,0x8C01 -,0x8601 -,0x8611 -,0x8412 -,0xB4A2 -,0x0292 -,0x078E -,0x0480 -,0x038C -,0x0181 -,0x0182 -,0x018B -,0x0182 -,0x0183 -,0x018A -,0x0182 -,0x0183 -,0x018A -,0x0182 -,0x0183 -,0x018A -,0x0182 -,0x0183 -,0x018B -,0x0181 -,0x0183 -,0x018B -,0x0582 -,0x018D -,0x0483 -,0x00B5 -,0xB601 -,0x9501 -,0x9501 -,0x9010 -,0x8503 -,0x8101 -,0x8F01 -,0x8301 -,0x8F00 -,0x8401 -,0x8E01 -,0x8401 -,0x8E01 -,0x8400 -,0x9001 -,0x9502 -,0xABAA -,0x0289 -,0x0481 -,0x0180 -,0x0487 -,0x0B81 -,0x0186 -,0x0183 -,0x0181 -,0x0183 -,0x0086 -,0x0085 -,0x0082 -,0x0083 -,0x0185 -,0x0085 -,0x0082 -,0x0083 -,0x0185 -,0x0085 -,0x0082 -,0x0083 -,0x0185 -,0x0183 -,0x0182 -,0x0083 -,0x0186 -,0x0583 -,0x0083 -,0x0086 -,0x0584 -,0x0181 -,0x0186 -,0x0089 -,0x0487 -,0x008B -,0x019A -,0xAF12 -,0x8412 -,0x8C01 -,0x9401 -,0x9500 -,0x9501 -,0x9501 -,0x9502 -,0x950B -,0x8C0A -,0xB4CD -,0x0188 -,0x018A -,0x0188 -,0x018A -,0x0188 -,0x0185 -,0x0182 -,0x0C85 -,0x0182 -,0x0C95 -,0x0195 -,0x0195 -,0x01CC -,0xC401 -,0x9601 -,0x8501 -,0x8D01 -,0x8501 -,0x8D01 -,0x8501 -,0x8D01 -,0x8501 -,0x8C01 -,0x8101 -,0x8210 -,0x8102 -,0x810F -,0x8201 -,0xDCAF -,0x1284 -,0x128F -,0x0294 -,0x0194 -,0x0392 -,0x0180 -,0x0290 -,0x0182 -,0x028E -,0x0184 -,0x028C -,0x0186 -,0x038A -,0x0089 -,0x0196 -,0x009C -,0xB000 -,0x8E01 -,0x8401 -,0x8E01 -,0x8401 -,0x8E01 -,0x8401 -,0x8E01 -,0x8412 -,0x8412 -,0x9501 -,0x9501 -,0x9501 -,0x9600 -,0xB49D -,0x0C8A -,0x0C8B -,0x0095 -,0x0195 -,0x0195 -,0x0C8B -,0x0B8B -,0x0194 -,0x0195 -,0x0195 -,0x0C8B -,0x0B9C -,0xB50C -,0x8A0C -,0x8C01 -,0x9401 -,0x9500 -,0x9501 -,0x9501 -,0x9502 -,0x950B -,0x8C0A -,0xB4A1 -,0x0491 -,0x078E -,0x0282 -,0x038C -,0x0186 -,0x018B -,0x0188 -,0x018A -,0x0188 -,0x018A -,0x0188 -,0x018A -,0x0188 -,0x018B -,0x0186 -,0x018C -,0x0383 -,0x028D -,0x0890 -,0x04A0 -,0xB511 -,0x8510 -,0x8701 -,0x8601 -,0x8C00 -,0x8800 -,0x8B01 -,0x8801 -,0x8A01 -,0x8801 -,0x8A01 -,0x8801 -,0x8B01 -,0x8602 -,0x8B02 -,0x8402 -,0x8D08 -,0x9004 -,0xA0A1 -,0x0490 -,0x088D -,0x0283 -,0x038C -,0x0087 -,0x028A -,0x0188 -,0x018A -,0x0188 -,0x018A -,0x0188 -,0x018B -,0x0088 -,0x008C -,0x0186 -,0x018C -,0x0F86 -,0x11AF -,0xCD0C -,0x8A0C -,0x8C01 -,0x9401 -,0x9500 -,0x9501 -,0x9501 -,0x9501 -,0x9601 -,0x9500 -,0xA7B8 -,0x0085 -,0x018C -,0x0483 -,0x018C -,0x0484 -,0x018A -,0x0182 -,0x0183 -,0x018A -,0x0182 -,0x0183 -,0x018A -,0x0182 -,0x0183 -,0x018A -,0x0183 -,0x0182 -,0x018B -,0x0083 -,0x0182 -,0x018B -,0x0182 -,0x058D -,0x0083 -,0x03B6 -,0xB501 -,0x9501 -,0x9501 -,0x920E -,0x880F -,0x8A01 -,0x8801 -,0x8A01 -,0x8801 -,0x8A01 -,0x8801 -,0x8A01 -,0x8801 -,0x9401 -,0xB5B5 -,0x0A8C -,0x0B95 -,0x0295 -,0x0196 -,0x0096 -,0x0095 -,0x0095 -,0x018B -,0x0C8A -,0x0CB4 -,0x9D00 -,0x9603 -,0x9404 -,0x9504 -,0x9404 -,0x9404 -,0x9303 -,0x9103 -,0x9103 -,0x9004 -,0x9003 -,0x9300 -,0xA89D -,0x0593 -,0x0893 -,0x0593 -,0x038F -,0x048F -,0x0492 -,0x0395 -,0x0594 -,0x0593 -,0x038C -,0x098B -,0x06A2 -,0xB501 -,0x8801 -,0x8A02 -,0x8602 -,0x8C02 -,0x8203 -,0x8E02 -,0x8002 -,0x9104 -,0x9204 -,0x9102 -,0x8002 -,0x8E02 -,0x8303 -,0x8B02 -,0x8602 -,0x8A00 -,0x8901 -,0xB4AC -,0x0186 -,0x028C -,0x0185 -,0x0589 -,0x0188 -,0x0487 -,0x018A -,0x0484 -,0x018E -,0x0791 -,0x048F -,0x0490 -,0x048F -,0x0490 -,0x0393 -,0x01A7 -,0xA900 -,0x8A01 -,0x8702 -,0x8A01 -,0x8603 -,0x8A01 -,0x8504 -,0x8A01 -,0x8402 -,0x8001 -,0x8A01 -,0x8202 -,0x8201 -,0x8A01 -,0x8102 -,0x8301 -,0x8A01 -,0x8002 -,0x8401 -,0x8A04 -,0x8501 -,0x8A02 -,0x8701 -,0x8A01 -,0x8801 -,0x9501 -,0x9CA2 -,0x0096 -,0x0195 -,0x0193 -,0x0581 -,0x0286 -,0x0781 -,0x0883 -,0x068A -,0x0281 -,0x0191 -,0x0181 -,0x0192 -,0x0081 -,0x0192 -,0x0081 -,0x0192 -,0x00C8 -,0xFF90 -,0x1581 -,0x15FF -,0x90C8 -,0x0192 -,0x0081 -,0x0192 -,0x0081 -,0x0192 -,0x0081 -,0x0191 -,0x0182 -,0x0685 -,0x0181 -,0x0383 -,0x0781 -,0x088A -,0x0581 -,0x018F -,0x0195 -,0x01BA -,0x9F00 -,0x9501 -,0x9501 -,0x9401 -,0x9501 -,0x9601 -,0x9502 -,0x9501 -,0x9501 -,0x9501 -,0x9401 -,0x9501 -,0xA6F8 -,0x0189 -,0x0485 -,0x0381 -,0x0C85 -,0x0283 -,0x0AFF -,0x94A1 -,0x0291 -,0x078E -,0x0382 -,0x038C -,0x0186 -,0x018B -,0x0188 -,0x018A -,0x0086 -,0x0786 -,0x0E86 -,0x0884 -,0x0187 -,0x0081 -,0x0188 -,0x018A -,0x0187 -,0x028B -,0x0186 -,0x01B6 -,0xA900 -,0x8C01 -,0x8601 -,0x8904 -,0x8502 -,0x870E -,0x8702 -,0x8206 -,0x8001 -,0x8701 -,0x8301 -,0x8600 -,0x8700 -,0x8401 -,0x8601 -,0x8600 -,0x8D01 -,0x8601 -,0x8D00 -,0x8601 -,0x8D00 -,0x9501 -,0x9501 -,0x9CB4 -,0x0086 -,0x008E -,0x088F -,0x0182 -,0x018F -,0x0184 -,0x008F -,0x0184 -,0x018E -,0x0184 -,0x018E -,0x0184 -,0x0090 -,0x0182 -,0x018F -,0x088E -,0x0086 -,0x00B9 -,0xB101 -,0x8700 -,0x8100 -,0x8903 -,0x8401 -,0x8100 -,0x8B03 -,0x8201 -,0x8100 -,0x8D02 -,0x8101 -,0x8100 -,0x8F0A -,0x8C0A -,0x8A03 -,0x8001 -,0x8100 -,0x8B03 -,0x8201 -,0x8100 -,0x8903 -,0x8401 -,0x8100 -,0x8901 -,0x8601 -,0x8100 -,0x8900 -,0xACFF -,0x9009 -,0x8208 -,0x8109 -,0x8208 -,0xFF90 -,0xB802 -,0x8500 -,0x8604 -,0x8004 -,0x8302 -,0x8407 -,0x8101 -,0x8401 -,0x8401 -,0x8201 -,0x8301 -,0x8401 -,0x8201 -,0x8301 -,0x8301 -,0x8401 -,0x8201 -,0x8401 -,0x8201 -,0x8401 -,0x8300 -,0x8401 -,0x8301 -,0x8201 -,0x8401 -,0x8402 -,0x8007 -,0x8501 -,0x8304 -,0x8004 -,0x8E01 -,0xBBC8 -,0x0194 -,0x0295 -,0x01C5 -,0x0194 -,0x0295 -,0x01DC -,0x8902 -,0x9107 -,0x8E01 -,0x8502 -,0x8B01 -,0x8202 -,0x8200 -,0x8B00 -,0x8105 -,0x8200 -,0x8901 -,0x8100 -,0x8301 -,0x8100 -,0x8900 -,0x8101 -,0x8401 -,0x8000 -,0x8900 -,0x8101 -,0x8401 -,0x8000 -,0x8901 -,0x8001 -,0x8400 -,0x8100 -,0x8A00 -,0x8101 -,0x8201 -,0x8100 -,0x8A01 -,0x8100 -,0x8501 -,0x8B01 -,0x8601 -,0x8D02 -,0x8202 -,0x9004 -,0x89BC -,0x018F -,0x0381 -,0x018A -,0x0181 -,0x0481 -,0x018A -,0x0082 -,0x0181 -,0x0180 -,0x018A -,0x0082 -,0x0082 -,0x0180 -,0x018A -,0x0082 -,0x0082 -,0x0180 -,0x018A -,0x0181 -,0x0081 -,0x0181 -,0x018A -,0x0881 -,0x018B -,0x0781 -,0x0195 -,0x01B8 -,0xBA01 -,0x9403 -,0x9202 -,0x8001 -,0x9002 -,0x8201 -,0x8F01 -,0x8401 -,0x9101 -,0x9403 -,0x9202 -,0x8001 -,0x9002 -,0x8201 -,0x8F01 -,0x8401 -,0xB6D0 -,0x0195 -,0x0190 -,0x0C8B -,0x0A8D -,0x088F -,0x0691 -,0x0493 -,0x0295 -,0x00BC -,0xFFFF -,0xCF89 -,0x0291 -,0x078E -,0x0185 -,0x028B -,0x0188 -,0x008B -,0x0080 -,0x0781 -,0x0089 -,0x0180 -,0x0781 -,0x0089 -,0x0081 -,0x0082 -,0x0084 -,0x0089 -,0x0081 -,0x0082 -,0x0084 -,0x0089 -,0x0180 -,0x0180 -,0x0382 -,0x008A -,0x0081 -,0x0281 -,0x0181 -,0x008A -,0x0188 -,0x018B -,0x0186 -,0x018D -,0x0282 -,0x0290 -,0x0489 -,0xC900 -,0x9600 -,0x9600 -,0x9600 -,0x9600 -,0x9600 -,0x9600 -,0x9600 -,0xDCCB -,0x0193 -,0x0591 -,0x0181 -,0x0190 -,0x0183 -,0x018F -,0x0183 -,0x018F -,0x0183 -,0x0091 -,0x0592 -,0x03D8 -,0x9F00 -,0x8700 -,0x8D00 -,0x8701 -,0x8C00 -,0x8701 -,0x8C00 -,0x8701 -,0x8C00 -,0x8701 -,0x870B -,0x8101 -,0x870B -,0x8101 -,0x8C00 -,0x8701 -,0x8C00 -,0x8701 -,0x8C00 -,0x8701 -,0x8C00 -,0x8701 -,0x8C00 -,0x8700 -,0x9DCA -,0x0086 -,0x008D -,0x0184 -,0x028C -,0x0184 -,0x038C -,0x0184 -,0x0080 -,0x018C -,0x0183 -,0x0180 -,0x018C -,0x0182 -,0x0181 -,0x018D -,0x0482 -,0x018E -,0x0283 -,0x01D3 -,0xD100 -,0x8E01 -,0x8401 -,0x8D01 -,0x8601 -,0x8C01 -,0x8200 -,0x8201 -,0x8C01 -,0x8200 -,0x8201 -,0x8C01 -,0x8101 -,0x8201 -,0x8D05 -,0x8001 -,0x8F01 -,0x8103 -,0xD4FF -,0x9101 -,0x9303 -,0x9301 -,0x9500 -,0xF69D -,0x1185 -,0x0B95 -,0x0196 -,0x0195 -,0x0195 -,0x0195 -,0x0094 -,0x028B -,0x0B95 -,0x0295 -,0x0195 -,0x0195 -,0x0085 -,0xFFFF -,0xCF00 - -#line 2487 "./ostc28.drx.txt" - #line 730 "p2_deco_main - 090915b.c" - -}; - -#pragma romdata font_table_small = 0x0B548 -rom const rom unsigned int wp_small_table[] = -{ -#line 1 "./ostc28.tbl.txt" -0x0000 -,0x000E -,0x001B -,0x0048 -,0x007D -,0x00B4 -,0x00E7 -,0x00F0 -,0x010D -,0x012A -,0x014B -,0x0164 -,0x0170 -,0x0185 -,0x018E -,0x01A3 -,0x01D6 -,0x01E2 -,0x0215 -,0x0246 -,0x0267 -,0x029C -,0x02CB -,0x02EA -,0x0321 -,0x0352 -,0x0360 -,0x0371 -,0x039C -,0x03CD -,0x03F8 -,0x041B -,0x045C -,0x047D -,0x04B8 -,0x04E5 -,0x050E -,0x0541 -,0x0564 -,0x0597 -,0x05AC -,0x05CD -,0x05EA -,0x060F -,0x0624 -,0x063D -,0x0656 -,0x067F -,0x06A4 -,0x06D5 -,0x0700 -,0x0739 -,0x0752 -,0x076B -,0x0784 -,0x079D -,0x07C6 -,0x07DF -,0x0818 -,0x0837 -,0x084C -,0x086B -,0x087C -,0x0895 -,0x08A1 -,0x08D4 -,0x08F9 -,0x0920 -,0x0945 -,0x097A -,0x099B -,0x09E4 -,0x09F9 -,0x0A14 -,0x0A33 -,0x0A54 -,0x0A71 -,0x0A8A -,0x0A9F -,0x0AC8 -,0x0AED -,0x0B12 -,0x0B27 -,0x0B5A -,0x0B77 -,0x0B8C -,0x0BA5 -,0x0BBE -,0x0BE3 -,0x0C04 -,0x0C39 -,0x0C5C -,0x0C63 -,0x0C86 -,0x0C9F -,0x0CAD -,0x0CD6 -,0x0D05 -,0x0D2A -,0x0D61 -,0x0D6C -,0x0DAB -,0x0DB8 -,0x0E05 -,0x0E3C -,0x0E5D -,0x0E70 -,0x0E73 -,0x0EBA -,0x0ECB -,0x0EE4 -,0x0F15 -,0x0F3C -,0x0F61 -,0x0F6B -,0x0F86 -,0x0F89 - - -#line 205 "./ostc28.tbl.txt" - #line 736 "p2_deco_main - 090915b.c" - -}; - -#pragma romdata font_table_medium = 0x0B632 -rom const rom unsigned int wp_medium_table[] = -{ -#line 1 "./ostc48.tbl.txt" -0x0000 -,0x000F -,0x0016 -,0x006B -,0x0083 -,0x00DC -,0x012D -,0x0166 -,0x01C1 -,0x0216 -,0x024C -,0x02AB -,0x0302 -,0x031B -,0x032A -,0x0344 -,0x036F -,0x0375 -#line 742 "p2_deco_main - 090915b.c" - -}; - -#pragma romdata font_data_medium = 0x0B656 -rom const rom unsigned int wp_medium_data[] = -{ -#line 1 "./ostc48.drx.txt" -0x9F9F -,0xBA03 -,0x9A04 -,0x9A05 -,0x9904 -,0x9B03 -,0x9F9F -,0xC09F -,0x9FBF -,0x7F9F -,0x9FBF -,0xCD03 -,0x960E -,0x8E12 -,0x8A16 -,0x8704 -,0x8B07 -,0x8503 -,0x8C03 -,0x8004 -,0x8303 -,0x8B04 -,0x8204 -,0x8202 -,0x8B04 -,0x8403 -,0x8102 -,0x8B03 -,0x8702 -,0x8102 -,0x8A03 -,0x8802 -,0x8102 -,0x8804 -,0x8903 -,0x8002 -,0x8703 -,0x8B02 -,0x8103 -,0x8503 -,0x8C02 -,0x8203 -,0x8204 -,0x8C03 -,0x8303 -,0x8004 -,0x8C03 -,0x8506 -,0x8C04 -,0x8716 -,0x8913 -,0x8E0E -,0x9503 -,0xCDFF -,0x8400 -,0x9E01 -,0x9C02 -,0x9B02 -,0x9C02 -,0x9B03 -,0x9B02 -,0x9B1D -,0x811D -,0x811D -,0xFFFF -,0xC0FC -,0x0185 -,0x0094 -,0x0384 -,0x0291 -,0x0583 -,0x0390 -,0x0682 -,0x0390 -,0x0782 -,0x0290 -,0x0381 -,0x0281 -,0x028F -,0x0482 -,0x0281 -,0x028E -,0x0483 -,0x0281 -,0x028D -,0x0484 -,0x0281 -,0x028D -,0x0385 -,0x0281 -,0x028C -,0x0386 -,0x0281 -,0x038A -,0x0387 -,0x0282 -,0x0288 -,0x0488 -,0x0282 -,0x0386 -,0x0489 -,0x0283 -,0x0D8A -,0x0284 -,0x0A8C -,0x0285 -,0x088D -,0x0287 -,0x0390 -,0x02E0 -,0xFF9A -,0x0185 -,0x0292 -,0x0483 -,0x0393 -,0x0482 -,0x0295 -,0x0382 -,0x0296 -,0x0281 -,0x0289 -,0x028A -,0x0281 -,0x0289 -,0x028A -,0x0281 -,0x0289 -,0x028A -,0x0281 -,0x0289 -,0x028A -,0x0281 -,0x0288 -,0x038A -,0x0282 -,0x0287 -,0x0489 -,0x0282 -,0x0385 -,0x0687 -,0x0383 -,0x0A81 -,0x0384 -,0x0484 -,0x0A81 -,0x0C87 -,0x0684 -,0x0A8A -,0x0288 -,0x07FF -,0x84D3 -,0x029A -,0x0499 -,0x0597 -,0x0796 -,0x0381 -,0x0294 -,0x0482 -,0x0293 -,0x0384 -,0x0291 -,0x0485 -,0x0290 -,0x0387 -,0x028E -,0x0488 -,0x028D -,0x038A -,0x028B -,0x048B -,0x028A -,0x1C81 -,0x1D81 -,0x1D81 -,0x1D94 -,0x029C -,0x029C -,0x029C -,0x02C8 -,0xFA00 -,0x8D06 -,0x8802 -,0x830F -,0x8704 -,0x820F -,0x8803 -,0x8209 -,0x8102 -,0x8A03 -,0x8102 -,0x8702 -,0x8C02 -,0x8102 -,0x8702 -,0x8C02 -,0x8102 -,0x8701 -,0x8D02 -,0x8102 -,0x8701 -,0x8E02 -,0x8002 -,0x8701 -,0x8D03 -,0x8002 -,0x8702 -,0x8C02 -,0x8102 -,0x8702 -,0x8C02 -,0x8102 -,0x8703 -,0x8A03 -,0x8102 -,0x8803 -,0x8804 -,0x8102 -,0x8805 -,0x8405 -,0x8202 -,0x890E -,0x8302 -,0x8A0C -,0x9408 -,0xE5EC -,0x0891 -,0x118B -,0x1588 -,0x1785 -,0x0584 -,0x0286 -,0x0584 -,0x0385 -,0x0289 -,0x0383 -,0x0386 -,0x028A -,0x0381 -,0x0386 -,0x028C -,0x0281 -,0x0287 -,0x028C -,0x0281 -,0x0287 -,0x028D -,0x0280 -,0x0287 -,0x028C -,0x0281 -,0x0287 -,0x028C -,0x0281 -,0x0287 -,0x038B -,0x0281 -,0x0288 -,0x0389 -,0x0283 -,0x0287 -,0x0584 -,0x0583 -,0x0387 -,0x0E85 -,0x008A -,0x0C95 -,0x06E6 -,0xFF80 -,0x029C -,0x029C -,0x029C -,0x0297 -,0x0281 -,0x0294 -,0x0581 -,0x0291 -,0x0881 -,0x028F -,0x0982 -,0x028C -,0x0985 -,0x0289 -,0x0988 -,0x0287 -,0x088B -,0x0284 -,0x098D -,0x0282 -,0x0890 -,0x0B93 -,0x0995 -,0x0698 -,0x049A -,0x01FC -,0xF405 -,0x8A03 -,0x8808 -,0x8707 -,0x850A -,0x8509 -,0x8304 -,0x8105 -,0x830B -,0x8103 -,0x8504 -,0x8202 -,0x8506 -,0x8803 -,0x8102 -,0x8705 -,0x8902 -,0x8102 -,0x8803 -,0x8A02 -,0x8102 -,0x8803 -,0x8A02 -,0x8102 -,0x8902 -,0x8A02 -,0x8102 -,0x8803 -,0x8A02 -,0x8102 -,0x8804 -,0x8902 -,0x8103 -,0x8606 -,0x8802 -,0x8203 -,0x8303 -,0x8103 -,0x8602 -,0x830B -,0x8105 -,0x8204 -,0x8408 -,0x840B -,0x8705 -,0x8609 -,0x9705 -,0xE5E7 -,0x0498 -,0x098B -,0x0086 -,0x0C89 -,0x0284 -,0x0E88 -,0x0382 -,0x0388 -,0x0388 -,0x0282 -,0x028A -,0x0387 -,0x0281 -,0x028C -,0x0287 -,0x0281 -,0x028C -,0x0287 -,0x0380 -,0x028C -,0x0287 -,0x0281 -,0x028C -,0x0287 -,0x0281 -,0x028C -,0x0287 -,0x0281 -,0x038A -,0x0287 -,0x0382 -,0x0389 -,0x0286 -,0x0383 -,0x0487 -,0x0285 -,0x0485 -,0x0781 -,0x0381 -,0x0887 -,0x168A -,0x128F -,0x0CE9 -,0x9F9F -,0xAB03 -,0x8A03 -,0x8B04 -,0x8904 -,0x8B04 -,0x8905 -,0x8A04 -,0x8904 -,0x8C02 -,0x8B03 -,0x9F9F -,0xC09F -,0x9FC8 -,0x0194 -,0x0A94 -,0x0A94 -,0x0896 -,0x059F -,0x9FB9 -,0xFFA9 -,0x009B -,0x0394 -,0x0A94 -,0x0995 -,0x0698 -,0x03FF -,0x8302 -,0x940A -,0x940A -,0x9407 -,0x9704 -,0xFFBA -,0xC815 -,0x8915 -,0x8915 -,0x8B02 -,0x9B01 -,0x9C01 -,0x9D01 -,0x9D02 -,0x9C04 -,0x9A15 -,0x8A14 -,0x8B13 -,0x8A02 -,0x9B02 -,0x9C01 -,0x9D01 -,0x9D02 -,0x9C15 -,0x8915 -,0x8A14 -,0x8D11 -,0xA0FF -,0xFFFF -,0xFFFF -,0xFF00 -#line 748 "p2_deco_main - 090915b.c" - -}; - -#pragma romdata font_data_large = 0x0BA46 -rom const rom unsigned int wp_large_data[] = -{ -#line 1 "./ostc90.drx.txt" -0x9BAF -,0xAFAF -,0xAFAF -,0xAFD1 -,0x05B2 -,0x07B0 -,0x08B0 -,0x09AF -,0x09AF -,0x09AF -,0x09AF -,0x08B1 -,0x07B2 -,0x049B -,0x9F9F -,0x9F9F -,0x9FAE -,0xFFFF -,0xFFFF -,0xFFFF -,0xFFFF -,0xFFFF -,0xFFFF -,0xFFFF -,0xFFFF -,0xFFFF -,0x8FFF -,0xFF82 -,0x04AC -,0x14A1 -,0x1A9B -,0x2096 -,0x2492 -,0x288F -,0x0E8A -,0x108C -,0x0B94 -,0x0C8A -,0x0996 -,0x0F87 -,0x0896 -,0x1285 -,0x0797 -,0x0783 -,0x0785 -,0x0697 -,0x0785 -,0x0783 -,0x0696 -,0x0887 -,0x0782 -,0x0596 -,0x078A -,0x0681 -,0x0596 -,0x078C -,0x0581 -,0x0594 -,0x088E -,0x0580 -,0x0494 -,0x0790 -,0x0580 -,0x0493 -,0x0791 -,0x0580 -,0x0491 -,0x0892 -,0x0580 -,0x0490 -,0x0794 -,0x0580 -,0x058E -,0x0795 -,0x0580 -,0x058C -,0x0896 -,0x0580 -,0x068A -,0x0896 -,0x0582 -,0x0688 -,0x0797 -,0x0682 -,0x0785 -,0x0897 -,0x0684 -,0x0783 -,0x0897 -,0x0785 -,0x0880 -,0x0798 -,0x0787 -,0x0F97 -,0x0889 -,0x0D95 -,0x0A8B -,0x108C -,0x0E8E -,0x2891 -,0x2694 -,0x2299 -,0x1CA0 -,0x15AA -,0x0797 -,0xFFFF -,0xFFD7 -,0x01B7 -,0x03B4 -,0x04B4 -,0x03B4 -,0x04B4 -,0x04B3 -,0x04B3 -,0x05B3 -,0x05B2 -,0x06B2 -,0x05B2 -,0x06B2 -,0x3681 -,0x3781 -,0x3781 -,0x3781 -,0x3781 -,0x37FF -,0xFFFF -,0xFFFF -,0xFFAC -,0xFFFF -,0xFF90 -,0x0389 -,0x00A8 -,0x0587 -,0x03A5 -,0x0786 -,0x05A3 -,0x0885 -,0x07A0 -,0x0A84 -,0x089F -,0x0B84 -,0x069F -,0x0D83 -,0x069F -,0x0E82 -,0x069F -,0x0881 -,0x0482 -,0x059E -,0x0883 -,0x0482 -,0x049E -,0x0884 -,0x0481 -,0x059D -,0x0885 -,0x0481 -,0x059C -,0x0787 -,0x0481 -,0x049C -,0x0788 -,0x0481 -,0x049B -,0x0789 -,0x0481 -,0x049A -,0x078A -,0x0481 -,0x0499 -,0x078B -,0x0481 -,0x0498 -,0x078C -,0x0481 -,0x0596 -,0x078D -,0x0481 -,0x0595 -,0x078E -,0x0481 -,0x0594 -,0x078F -,0x0481 -,0x0692 -,0x0790 -,0x0482 -,0x0690 -,0x0791 -,0x0482 -,0x078E -,0x0792 -,0x0483 -,0x078B -,0x0893 -,0x0483 -,0x0986 -,0x0A94 -,0x0484 -,0x1995 -,0x0485 -,0x1796 -,0x0486 -,0x1498 -,0x0487 -,0x1299 -,0x0489 -,0x0E9B -,0x048C -,0x089D -,0x05B3 -,0x05BA -,0xFFFF -,0xFF8E -,0x00B7 -,0x028A -,0x01A8 -,0x0488 -,0x03A5 -,0x0786 -,0x05A3 -,0x0886 -,0x05A5 -,0x0784 -,0x05A7 -,0x0684 -,0x05A8 -,0x0682 -,0x05AA -,0x0582 -,0x05AA -,0x0581 -,0x0591 -,0x0495 -,0x0580 -,0x0591 -,0x0495 -,0x0580 -,0x0591 -,0x0495 -,0x0580 -,0x0492 -,0x0495 -,0x0580 -,0x0492 -,0x0495 -,0x0580 -,0x0492 -,0x0495 -,0x0580 -,0x0492 -,0x0594 -,0x0580 -,0x0590 -,0x0694 -,0x0580 -,0x0590 -,0x0694 -,0x0580 -,0x058F -,0x0892 -,0x0582 -,0x058E -,0x0892 -,0x0582 -,0x068C -,0x0A90 -,0x0682 -,0x078A -,0x0C8E -,0x0684 -,0x0787 -,0x0681 -,0x068C -,0x0785 -,0x1581 -,0x0789 -,0x0887 -,0x1383 -,0x1889 -,0x1185 -,0x168B -,0x0F87 -,0x148D -,0x0C8A -,0x1291 -,0x078E -,0x0EAC -,0x0AFF -,0xB8FF -,0xFF8B -,0x05B2 -,0x06B0 -,0x08AF -,0x09AD -,0x0BAC -,0x0CAA -,0x0EA9 -,0x0781 -,0x05A7 -,0x0882 -,0x05A6 -,0x0784 -,0x05A4 -,0x0786 -,0x05A3 -,0x0787 -,0x05A1 -,0x0789 -,0x059F -,0x088A -,0x059E -,0x078C -,0x059C -,0x088D -,0x059B -,0x078F -,0x0599 -,0x0890 -,0x0598 -,0x0792 -,0x0596 -,0x0794 -,0x0595 -,0x0795 -,0x0593 -,0x0797 -,0x0592 -,0x3581 -,0x3781 -,0x3781 -,0x3781 -,0x3781 -,0x3781 -,0x37A4 -,0x05B3 -,0x05B3 -,0x05B3 -,0x05B3 -,0x05B3 -,0x05B3 -,0x058F -,0xFFFF -,0xFF8C -,0x01A2 -,0x0092 -,0x0392 -,0x1090 -,0x0585 -,0x1C8F -,0x0784 -,0x1D8E -,0x0883 -,0x1D8E -,0x0883 -,0x1C91 -,0x0782 -,0x1B93 -,0x0682 -,0x058E -,0x0595 -,0x0681 -,0x058E -,0x0497 -,0x0581 -,0x058E -,0x0497 -,0x0581 -,0x058D -,0x0598 -,0x0580 -,0x058D -,0x0499 -,0x0580 -,0x058D -,0x0499 -,0x0580 -,0x058D -,0x0499 -,0x0580 -,0x058D -,0x0499 -,0x0580 -,0x058D -,0x0499 -,0x0580 -,0x058D -,0x0499 -,0x0580 -,0x058D -,0x0499 -,0x0580 -,0x058D -,0x0499 -,0x0580 -,0x058D -,0x0597 -,0x0581 -,0x058D -,0x0597 -,0x0581 -,0x058E -,0x0595 -,0x0681 -,0x058E -,0x0693 -,0x0682 -,0x058E -,0x0791 -,0x0782 -,0x058F -,0x088D -,0x0883 -,0x0590 -,0x0A87 -,0x0B83 -,0x0591 -,0x1C84 -,0x0592 -,0x1A85 -,0x0593 -,0x1886 -,0x0594 -,0x15A5 -,0x11AA -,0x0CC5 -,0xFFFF -,0xF111 -,0xA21B -,0x9A21 -,0x9426 -,0x9029 -,0x8E2B -,0x8C0D -,0x8505 -,0x850E -,0x880B -,0x8805 -,0x8B09 -,0x8808 -,0x8906 -,0x8E08 -,0x8607 -,0x8B05 -,0x9107 -,0x8407 -,0x8B05 -,0x9306 -,0x8306 -,0x8C05 -,0x9506 -,0x8205 -,0x8D05 -,0x9605 -,0x8106 -,0x8D04 -,0x9706 -,0x8005 -,0x8D05 -,0x9805 -,0x8005 -,0x8D05 -,0x9805 -,0x8004 -,0x8E04 -,0x990B -,0x8E04 -,0x990B -,0x8E05 -,0x980B -,0x8E05 -,0x980B -,0x8E05 -,0x9805 -,0x8004 -,0x8E06 -,0x9605 -,0x8104 -,0x8F05 -,0x9605 -,0x8105 -,0x8E06 -,0x9405 -,0x8205 -,0x8F07 -,0x9007 -,0x8305 -,0x8E09 -,0x8C08 -,0x8407 -,0x8D0B -,0x860A -,0x8507 -,0x8E1B -,0x8705 -,0x9019 -,0x8903 -,0x9217 -,0x8B00 -,0x9613 -,0xA70F -,0xAD07 -,0xC8FF -,0xFFFF -,0x9605 -,0xB305 -,0xB305 -,0xB305 -,0xB305 -,0xB305 -,0xAF01 -,0x8105 -,0xAC04 -,0x8105 -,0xA907 -,0x8105 -,0xA60A -,0x8105 -,0xA40C -,0x8105 -,0xA10F -,0x8105 -,0x9E12 -,0x8105 -,0x9B13 -,0x8305 -,0x9813 -,0x8605 -,0x9612 -,0x8905 -,0x9312 -,0x8C05 -,0x9012 -,0x8F05 -,0x8E11 -,0x9205 -,0x8B11 -,0x9505 -,0x8910 -,0x9805 -,0x8610 -,0x9B05 -,0x840F -,0x9E05 -,0x8110 -,0xA015 -,0xA312 -,0xA610 -,0xA80D -,0xAB0B -,0xAD09 -,0xAF06 -,0xB204 -,0xFFA7 -,0xFFFF -,0xCA03 -,0xB10B -,0xAB0F -,0x9007 -,0x8F11 -,0x8D0C -,0x8A14 -,0x8A0F -,0x8816 -,0x8811 -,0x8618 -,0x8614 -,0x8407 -,0x8708 -,0x8515 -,0x8306 -,0x8B07 -,0x8406 -,0x8608 -,0x8106 -,0x8D06 -,0x8306 -,0x8907 -,0x8004 -,0x9006 -,0x8205 -,0x8B0C -,0x9105 -,0x8105 -,0x8D0A -,0x9205 -,0x8104 -,0x8F08 -,0x9405 -,0x8004 -,0x9006 -,0x9505 -,0x8004 -,0x9006 -,0x950B -,0x9105 -,0x950B -,0x9105 -,0x950B -,0x9205 -,0x940B -,0x9106 -,0x9405 -,0x8004 -,0x9107 -,0x9305 -,0x8005 -,0x8F08 -,0x9304 -,0x8105 -,0x8E0A -,0x9105 -,0x8106 -,0x8C0C -,0x8F06 -,0x8206 -,0x8906 -,0x8106 -,0x8E05 -,0x8308 -,0x8508 -,0x8107 -,0x8C06 -,0x8415 -,0x8308 -,0x8807 -,0x8613 -,0x850A -,0x820A -,0x8711 -,0x8716 -,0x890F -,0x8914 -,0x8B0C -,0x8C12 -,0x8F06 -,0x9010 -,0xAA0C -,0xAF06 -,0xC5FF -,0xFFE9 -,0x09AC -,0x0F98 -,0x008D -,0x1395 -,0x028A -,0x1792 -,0x0488 -,0x1990 -,0x0686 -,0x1B8E -,0x0785 -,0x0988 -,0x0A8F -,0x0683 -,0x088D -,0x0790 -,0x0582 -,0x0790 -,0x078F -,0x0582 -,0x0693 -,0x0590 -,0x0580 -,0x0694 -,0x068F -,0x0580 -,0x0596 -,0x058F -,0x0580 -,0x0597 -,0x048F -,0x0580 -,0x0498 -,0x048F -,0x0580 -,0x0498 -,0x058E -,0x0B98 -,0x058E -,0x0B98 -,0x048F -,0x0580 -,0x0498 -,0x048E -,0x0581 -,0x0597 -,0x048E -,0x0581 -,0x0596 -,0x058D -,0x0681 -,0x0695 -,0x048E -,0x0583 -,0x0594 -,0x058D -,0x0683 -,0x0693 -,0x048D -,0x0685 -,0x0790 -,0x058B -,0x0786 -,0x098D -,0x058A -,0x0888 -,0x0B88 -,0x0687 -,0x0C89 -,0x2D8C -,0x2B8F -,0x2793 -,0x2496 -,0x1F9D -,0x17A9 -,0x07D3 -,0xFF00 -#line 754 "p2_deco_main - 090915b.c" - -}; - -#pragma romdata font_table_large = 0x0BFE6 -rom const rom unsigned int wp_large_table[] = -{ -#line 1 "./ostc90.tbl.txt" -0x0000 -,0x0022 -,0x0035 -,0x00D2 -,0x0100 -,0x01A8 -,0x0243 -,0x02AC -,0x0354 -,0x03ED -,0x0454 -,0x04FF -,0x059A -#line 760 "p2_deco_main - 090915b.c" - -}; - - - - - - - - - -#pragma code subroutines2 = 0x0C000 - - - - -void create_dbs_set_dbg_and_ndl20mtr(void) -{ - int_O_DBS_bitfield = 0; - int_O_DBS2_bitfield = 0; - if(int_O_DBG_pre_bitfield & 0b0000000000000100 ) - int_O_DBG_pre_bitfield = 0b0000000000001000 ; - else - int_O_DBG_pre_bitfield = 0b0000000000000100 ; - int_O_DBG_post_bitfield = 0; - char_O_NDL_at_20mtr = 255; - - DBG_N2_ratio = N2_ratio; - DBG_He_ratio = He_ratio; - DBG_char_I_deco_model = char_I_deco_model; - DBG_char_I_depth_last_deco = char_I_depth_last_deco; - DBG_pres_surface = pres_surface; - DBG_GF_low = GF_low; - DBG_GF_high = GF_high; - DBG_const_ppO2 = const_ppO2; - DBG_deco_ppO2_change = deco_ppO2_change; - DBG_deco_ppO2 = deco_ppO2; - DBG_deco_N2_ratio = deco_N2_ratio; - DBG_deco_He_ratio = deco_He_ratio; - DBG_deco_gas_change = deco_gas_change; - DBG_float_saturation_multiplier = float_saturation_multiplier; - DBG_float_desaturation_multiplier = float_desaturation_multiplier; - DBG_float_deco_distance = float_deco_distance; - - if(char_I_deco_model) - int_O_DBS_bitfield |= 0b0000000000000001 ; - if(const_ppO2) - int_O_DBS_bitfield |= 0b0000000000000010 ; - for(int_dbg_i = 16; int_dbg_i < 32; int_dbg_i++) - if(pres_tissue[int_dbg_i]) - int_O_DBS_bitfield |= 0b0000000000000100 ; - if(deco_ppO2_change) - int_O_DBS_bitfield |= 0b0000000000001000 ; - if(float_saturation_multiplier < 0.99) - int_O_DBS_bitfield |= 0b0000000000010000 ; - if(float_saturation_multiplier > 1.3) - int_O_DBS_bitfield |= 0b0000000000100000 ; - if(GF_low < 0.19) - int_O_DBS_bitfield |= 0b0000000001000000 ; - if(GF_low > 1.01) - int_O_DBS_bitfield |= 0b0000000010000000 ; - if(GF_high < 0.6) - int_O_DBS_bitfield |= 0b0000000100000000 ; - if(GF_high > 1.01) - int_O_DBS_bitfield |= 0b0000001000000000 ; - if((N2_ratio + He_ratio) > 0.95) - int_O_DBS_bitfield |= 0b0000010000000000 ; - if((N2_ratio + He_ratio) < 0.05) - int_O_DBS_bitfield |= 0b0000100000000000 ; - if(float_deco_distance > 0.25) - int_O_DBS_bitfield |= 0b0001000000000000 ; - if(char_I_depth_last_deco > 8) - int_O_DBS_bitfield |= 0b0010000000000000 ; - if(DBG_deco_gas_change && ((deco_N2_ratio + deco_He_ratio) > 0.95)) - int_O_DBS_bitfield |= 0b0100000000000000 ; - if(DBG_deco_gas_change && ((deco_N2_ratio + deco_He_ratio) < 0.05)) - int_O_DBS_bitfield |= 0b1000000000000000 ; - if(pres_respiration > 3.0) - int_O_DBS2_bitfield |= 0b0000000000000001 ; - if(pres_surface - pres_respiration > 0.2) - int_O_DBS2_bitfield |= 0b0000000000000010 ; - if(pres_surface < 0.75) - int_O_DBS2_bitfield |= 0b0000000000000100 ; - if(pres_surface > 1.11) - int_O_DBS2_bitfield |= 0b0000000000001000 ; - if(float_desaturation_multiplier < 0.70) - int_O_DBS2_bitfield |= 0b0000000000010000 ; - if(float_desaturation_multiplier > 1.01) - int_O_DBS2_bitfield |= 0b0000000000100000 ; - if(GF_low > GF_high) - int_O_DBS2_bitfield |= 0b0000000001000000 ; -} - - - - -void set_dbg_end_of_dive(void) -{ - int_O_DBG_pre_bitfield &= (~0b0000000000000100 ); - int_O_DBG_post_bitfield &= (~0b0000000000000100 ); -} - - - - -void check_ndl(void) -{ - if((char_O_NDL_at_20mtr == -1) && (int_I_pres_respiration > 3000)) - { - char_O_NDL_at_20mtr = char_O_nullzeit; - if(char_O_NDL_at_20mtr == 255) - char_O_NDL_at_20mtr == 254; - } -} - - - - -void check_dbg(char is_post_check) -{ - temp_DBS = 0; - if( (DBG_N2_ratio != N2_ratio) || (DBG_He_ratio != He_ratio) ) - temp_DBS |= 0b0000000000000001 ; - if(DBG_const_ppO2 != const_ppO2) - temp_DBS |= 0b0000000000000010 ; - if((DBG_float_saturation_multiplier != float_saturation_multiplier) || (DBG_float_desaturation_multiplier != float_desaturation_multiplier)) - temp_DBS |= 0b0000000000010000 ; - if(DBG_char_I_deco_model != char_I_deco_model) - temp_DBS |= 0b0000000000100000 ; - if(DBG_pres_surface != pres_surface) - temp_DBS |= 0b0000000001000000 ; - if((!0b0000000000000100 ) && (!He_ratio)) - for(int_dbg_i = 16; int_dbg_i < 32; int_dbg_i++) - if(pres_tissue[int_dbg_i]) - temp_DBS |= 0b0000000010000000 ; - if(DBG_deco_ppO2 != deco_ppO2) - temp_DBS |= 0b0000000100000000 ; - if((DBG_deco_gas_change != deco_gas_change) || (DBG_deco_N2_ratio != deco_N2_ratio) || (DBG_deco_He_ratio != deco_He_ratio)) - temp_DBS |= 0b0000001000000000 ; - if(DBG_float_deco_distance != float_deco_distance) - temp_DBS |= 0b0000010000000000 ; - if(DBG_char_I_depth_last_deco != char_I_depth_last_deco) - temp_DBS |= 0b0000100000000000 ; - if((DBG_GF_low != GF_low) || (DBG_GF_high != GF_high)) - temp_DBS |= 0b0001000000000000 ; - if(pres_respiration > 13.0) - temp_DBS |= 0b0100000000000000 ; - if(pres_surface - pres_respiration > 0.2) - temp_DBS |= 0b1000000000000000 ; - -#line 914 "p2_deco_main - 090915b.c" - - if(is_post_check) - int_O_DBG_post_bitfield |= temp_DBS; - else - int_O_DBG_pre_bitfield |= temp_DBS; -} - - - - -void check_pre_dbg(void) -{ - check_dbg(0); -} - - - - -void check_post_dbg(void) -{ - check_dbg(1); -} - - - - - - - -void calc_nextdecodepth_GF(void) -{ - - - - - - - - - - - - - - - - - - - - - - - - - - - char_I_table_deco_done[0] = 0; - if (char_I_deco_model == 1) - { - if (lock_GF_depth_list == 0) - { - temp2 = temp_pres_gtissue_limit_GF_low_below_surface / 0.29985; - int_temp = (int) (temp2 + 0.99); - if (int_temp > 31) - int_temp = 31; - if (int_temp < 0) - int_temp = 0; - temp_depth_GF_low_number = int_temp; - temp_depth_GF_low_meter = 3 * temp_depth_GF_low_number; - temp2 = (float)temp_depth_GF_low_meter * 0.09995; - temp_pres_deco_GF_low = temp2 + float_deco_distance + pres_surface; - if (temp_depth_GF_low_number == 0) - GF_step = 0; - else - GF_step = GF_delta / (float)temp_depth_GF_low_number; - if (GF_step < 0) - GF_step = 0; - if (GF_step > GF_delta) - GF_step = GF_delta; - int_O_GF_step = (int)(GF_step * 10000); - int_O_limit_GF_low = (int)(temp_pres_deco_GF_low * 1000); - int_O_gtissue_press_at_GF_low = (int)(temp_pres_gtissue * 1000); - char_O_GF_low_pointer = temp_depth_GF_low_number; - lock_GF_depth_list = 1; - internal_deco_pointer = 0; - } - if (internal_deco_pointer == 0) - { - internal_deco_pointer = temp_depth_GF_low_number; - GF_temp = GF_high - ((float)internal_deco_pointer * GF_step); - int_temp = char_I_table_deco_done[internal_deco_pointer]; - output[8] = int_temp; - output[9] = 33; - } - else - { - int_temp = 1; - } - while (int_temp == 1) - { - int_temp = internal_deco_pointer - 1; - if (int_temp == 1) - { - temp2 = (float)(temp_depth_last_deco * int_temp) * 0.09995; - GF_step2 = GF_step/3.0 * ((float)(6 - temp_depth_last_deco)); - } - else - if (int_temp == 0) - { - temp2 = 0.0; - GF_step2 = GF_high - GF_temp; - } - else - { - temp2 = (float)(3 *int_temp) * 0.09995; - GF_step2 = GF_step; - } - temp2 = temp2 + pres_surface; - temp1 = ((GF_temp + GF_step2)* temp_pres_gtissue_diff) + temp_pres_gtissue; - if (temp1 > temp2) - { - int_temp = 0; - } - else - { - internal_deco_pointer = int_temp; - GF_temp = GF_temp + GF_step2; - int_temp = char_I_table_deco_done[internal_deco_pointer]; - } - } - if (internal_deco_pointer > 0) - { - temp2 = (float)(0.29985 * internal_deco_pointer); - temp_deco = temp2 + float_deco_distance + pres_surface; - if (internal_deco_pointer == 1) - temp_depth_limit = temp_depth_last_deco; - else - temp_depth_limit = 3 * internal_deco_pointer; - if (output[9] == 33) - { - output[9] = internal_deco_pointer; - output[10] = char_I_table_deco_done[internal_deco_pointer]; - output[12] = output[12] + 1; - if (output[12] == 100) - output[12] = 0; - } - } - else - { - temp_deco = pres_surface; - temp_depth_limit = 0; - } - } - else - { - - - - - temp1 = temp_pres_gtissue_limit - pres_surface; - if (temp1 >= 0) - { - temp1 = temp1 / 0.29985; - temp_depth_limit = (int) (temp1 + 0.99); - temp_depth_limit = 3 * temp_depth_limit; - if (temp_depth_limit == 0) - temp_deco = pres_surface; - else - { - if (temp_depth_limit < temp_depth_last_deco) - temp_depth_limit = temp_depth_last_deco; - temp1 = (float)temp_depth_limit * 0.09995; - temp_deco = temp1 + float_deco_distance + pres_surface; - } - } - else - { - temp_deco = pres_surface; - temp_depth_limit = 0; - } - } -} - - -#line 1100 "p2_deco_main - 090915b.c" -#line 1116 "p2_deco_main - 090915b.c" - - - - - -void copy_deco_table_GF(void) -{ - if (char_I_deco_model == 1) - { - int_temp = 32; - for (ci=0;ci<int_temp;ci++) - char_O_deco_table[ci] = internal_deco_table[ci]; - } -} - - - - - - -void clear_internal_deco_table_GF(void) -{ - if (char_I_deco_model == 1) - { - for (ci=0;ci<32;ci++) - { - internal_deco_table[ci] = 0; - } - } -} - - - - - - -void update_internal_deco_table_GF(void) -{ - if ((char_I_deco_model == 1) && (internal_deco_table[internal_deco_pointer] < 255)) - internal_deco_table[internal_deco_pointer] = internal_deco_table[internal_deco_pointer] + 1; -} - - - - - - -void temp_tissue_safety(void) -{ - if (char_I_deco_model == 1) - { - } - else - { - if (temp_tissue < 0.0) - temp_tissue = temp_tissue * float_desaturation_multiplier; - else - temp_tissue = temp_tissue * float_saturation_multiplier; - } -} - - - - - - - - -#pragma code main_calc_hauptroutine = 0x10000 -void main_calc_hauptroutine(void) -{ -calc_hauptroutine(); -int_O_desaturation_time = 65535; -} -#pragma code main_without_deco = 0x10020 -void main_calc_without_deco(void) -{ -calc_without_deco(); -calc_desaturation_time(); -} - -#pragma code main_clear_CNS_fraction = 0x10030 -void main_clear_CNS_fraction(void) -{ -clear_CNS_fraction(); -} - -#pragma code main_calc_CNS_decrease_15min = 0x10034 -void main_calc_CNS_decrease_15min(void) -{ -calc_CNS_decrease_15min(); -} - -#pragma code main_calc_percentage = 0x10038 -void main_calc_percentage (void) -{ -calc_percentage(); -} - -#pragma code main_clear_tissue = 0x10040 -void main_clear_tissue(void) -{ -clear_tissue(); -char_I_depth_last_deco = 0; -} - -#pragma code main_calc_CNS_fraction = 0x10050 -void main_calc_CNS_fraction(void) -{ -calc_CNS_fraction(); -} - -#pragma code main_calc_desaturation_time = 0x10060 -void main_calc_desaturation_time(void) -{ -calc_desaturation_time(); -} - -#pragma code main_calc_wo_deco_step_1_min = 0x10080 -void main_calc_wo_deco_step_1_min(void) -{ -calc_wo_deco_step_1_min(); -char_O_deco_status = 3; -calc_desaturation_time(); -} - -#pragma code main_debug = 0x100A0 -void main_debug(void) -{ - -} - -#pragma code main_DD2_write_incon42 = 0x100B0 -void main_DD2_write_incon42(void) -{ - return; -} - -#pragma code main_DD2_write_incon24 = 0x100B4 -void main_DD2_write_incon24(void) -{ - return; -} - -#pragma code main_wordprocessor = 0x100B8 -void main_wordprocessor(void) -{ - wordprocessor(); -} - -#pragma code main_gradient_array = 0x100C0 -void main_gradient_array(void) -{ -calc_gradient_array_only(); -} -#pragma code main_push_tissues = 0x100C4 -void main_push_tissues_to_vault(void) -{ - push_tissues_to_vault(); -} -#pragma code main_pull_tissues = 0x100C8 -void main_pull_tissues_from_vault(void) -{ - pull_tissues_from_vault(); -} - -#pragma code main_hash = 0x100E0 -void main_hash(void) -{ -hash(); -} - - - - - - - -#pragma romdata tables = 0x10200 - - -#pragma romdata tables2 = 0x10600 -rom const rom unsigned int md_pi[] = -{ - 0x292E, 0x43C9, 0xA2D8, 0x7C01, 0x3D36, 0x54A1, 0xECF0, 0x0613 - , 0x62A7, 0x05F3, 0xC0C7, 0x738C, 0x9893, 0x2BD9, 0xBC4C, 0x82CA - , 0x1E9B, 0x573C, 0xFDD4, 0xE016, 0x6742, 0x6F18, 0x8A17, 0xE512 - , 0xBE4E, 0xC4D6, 0xDA9E, 0xDE49, 0xA0FB, 0xF58E, 0xBB2F, 0xEE7A - , 0xA968, 0x7991, 0x15B2, 0x073F, 0x94C2, 0x1089, 0x0B22, 0x5F21 - , 0x807F, 0x5D9A, 0x5A90, 0x3227, 0x353E, 0xCCE7, 0xBFF7, 0x9703 - , 0xFF19, 0x30B3, 0x48A5, 0xB5D1, 0xD75E, 0x922A, 0xAC56, 0xAAC6 - , 0x4FB8, 0x38D2, 0x96A4, 0x7DB6, 0x76FC, 0x6BE2, 0x9C74, 0x04F1 - , 0x459D, 0x7059, 0x6471, 0x8720, 0x865B, 0xCF65, 0xE62D, 0xA802 - , 0x1B60, 0x25AD, 0xAEB0, 0xB9F6, 0x1C46, 0x6169, 0x3440, 0x7E0F - , 0x5547, 0xA323, 0xDD51, 0xAF3A, 0xC35C, 0xF9CE, 0xBAC5, 0xEA26 - , 0x2C53, 0x0D6E, 0x8528, 0x8409, 0xD3DF, 0xCDF4, 0x4181, 0x4D52 - , 0x6ADC, 0x37C8, 0x6CC1, 0xABFA, 0x24E1, 0x7B08, 0x0CBD, 0xB14A - , 0x7888, 0x958B, 0xE363, 0xE86D, 0xE9CB, 0xD5FE, 0x3B00, 0x1D39 - , 0xF2EF, 0xB70E, 0x6658, 0xD0E4, 0xA677, 0x72F8, 0xEB75, 0x4B0A - , 0x3144, 0x50B4, 0x8FED, 0x1F1A, 0xDB99, 0x8D33, 0x9F11, 0x8314 -}; - - - - - - - -#pragma code subroutines = 0x10700 - - - - - - - -void clear_tissue(void) -{ - - flag_in_divemode = 0; - int_O_DBS_bitfield = 0; - int_O_DBS2_bitfield = 0; - int_O_DBG_pre_bitfield = 0; - int_O_DBG_post_bitfield = 0; - char_O_NDL_at_20mtr = 255; - -_asm -lfsr 1, 0x300 -movlw 0x01 -movwf TBLPTRU,0 -_endasm - - - N2_ratio = 0.7902; - pres_respiration = (float)int_I_pres_respiration / 1000.0; -for (ci=0;ci<16;ci++) -{ - pres_tissue[ci] = N2_ratio * (pres_respiration - 0.0627) ; -_asm -movlw 0x02 -movwf TBLPTRH,0 -movlb 4 -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addlw 0x80 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_a+1 -TBLRDPOSTINC -movff TABLAT,var_a -TBLRDPOSTINC -movff TABLAT,var_a+3 -TBLRD -movff TABLAT,var_a+2 -addlw 0x80 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_b+1 -TBLRDPOSTINC -movff TABLAT,var_b -TBLRDPOSTINC -movff TABLAT,var_b+3 -TBLRD -movff TABLAT,var_b+2 -_endasm - -pres_tissue_limit[ci] = (pres_tissue[ci] - var_a) * var_b ; - -if (pres_tissue_limit[ci] < 0) -pres_tissue_limit[ci] = 0; -} - -for (ci=16;ci<32;ci++) -{ - pres_tissue[ci] = 0.0; -} - - clear_decoarray(); - char_O_deco_status = 0; - char_O_nullzeit = 0; - char_O_ascenttime = 0; - char_O_gradient_factor = 0; - char_O_relative_gradient_GF = 0; -} - - - - - - - - -void calc_without_deco(void) -{ -_asm - lfsr 1, 0x300 -_endasm - N2_ratio = 0.7902; - pres_respiration = (float)int_I_pres_respiration / 1000.0; - pres_surface = (float)int_I_pres_surface / 1000.0; - temp_atem = N2_ratio * (pres_respiration - 0.0627); - temp2_atem = 0.0; - temp_surface = pres_surface; - float_desaturation_multiplier = char_I_desaturation_multiplier / 100.0; - float_saturation_multiplier = char_I_saturation_multiplier / 100.0; - - calc_tissue(); - - clear_decoarray(); - char_O_deco_status = 0; - char_O_nullzeit = 0; - char_O_ascenttime = 0; - calc_gradient_factor(); - -} - - - - - - - - - - - -void calc_hauptroutine(void) -{ - calc_hauptroutine_data_input(); - - if(!flag_in_divemode) - { - flag_in_divemode = 1; - create_dbs_set_dbg_and_ndl20mtr(); - } - else - check_pre_dbg(); - - calc_hauptroutine_update_tissues(); - calc_gradient_factor(); - - - switch (char_O_deco_status) - { - case 0: - update_startvalues(); - calc_nullzeit(); - check_ndl(); - char_O_deco_status = 255; - break; - case 1: - if (char_O_deco_status == 3) - break; - char_O_deco_status = 0; - - calc_hauptroutine_calc_deco(); - - break; - case 3: - clear_decoarray(); - clear_internal_deco_table_GF(); - copy_deco_table_GF(); - internal_deco_pointer = 0; - lock_GF_depth_list = 0; - update_startvalues(); - calc_nextdecodepth_GF(); - char_O_deco_status = 0; - break; - default: - update_startvalues(); - clear_decoarray(); - clear_internal_deco_table_GF(); - output[6] = 1; - calc_hauptroutine_calc_ascend_to_deco(); - if (char_O_deco_status > 15) - { - char_O_deco_status = 2; - - } - else - { - - calc_hauptroutine_calc_deco(); - } - - break; - } - calc_ascenttime(); - check_post_dbg(); -} - -void calc_hauptroutine_data_input(void) -{ - pres_respiration = (float)int_I_pres_respiration / 1000.0; - pres_surface = (float)int_I_pres_surface / 1000.0; - - N2_ratio = (float)char_I_N2_ratio / 100.0;; - He_ratio = (float)char_I_He_ratio / 100.0;; - deco_N2_ratio = (float)char_I_deco_N2_ratio / 100.0; - deco_He_ratio = (float)char_I_deco_He_ratio / 100.0; - float_deco_distance = (float)char_I_deco_distance / 100.0; - if(char_I_deco_gas_change) - { - deco_gas_change = (float)char_I_deco_gas_change / 9.995 + pres_surface; - deco_gas_change = deco_gas_change + float_deco_distance; - } - else - deco_gas_change = 0; - const_ppO2 = (float)char_I_const_ppO2 / 100.0; - deco_ppO2_change = (float)char_I_deco_ppO2_change / 99.95 + pres_surface; - deco_ppO2_change = deco_ppO2_change + float_deco_distance; - deco_ppO2 = (float)char_I_deco_ppO2 / 100.0; - float_desaturation_multiplier = char_I_desaturation_multiplier / 100.0; - float_saturation_multiplier = char_I_saturation_multiplier / 100.0; - GF_low = (float)char_I_GF_Low_percentage / 100.0; - GF_high = (float)char_I_GF_High_percentage / 100.0; - GF_delta = GF_high - GF_low; - - temp2 = (pres_respiration - pres_surface) / 0.29985; - int_temp = (int)(temp2); - if (int_temp < 0) - int_temp = 0; - if (int_temp > 255) - int_temp = 255; - char_O_actual_pointer = int_temp; - - temp_depth_last_deco = (int)char_I_depth_last_deco; -} - -void calc_hauptroutine_update_tissues(void) -{ - int_O_calc_tissue_call_counter = int_O_calc_tissue_call_counter + 1; - if (char_I_const_ppO2 == 0) - pres_diluent = pres_respiration; - else - pres_diluent = ((pres_respiration - const_ppO2)/(N2_ratio + He_ratio)); - if (pres_diluent > pres_respiration) - pres_diluent = pres_respiration; - if (pres_diluent > 0.0627) - { - temp_atem = N2_ratio * (pres_diluent - 0.0627); - temp2_atem = He_ratio * (pres_diluent - 0.0627); - char_O_diluent = (char)(pres_diluent/pres_respiration*100.0); - } - else - { - temp_atem = 0.0; - temp2_atem = 0.0; - char_O_diluent = 0; - } - temp_surface = pres_surface; - calc_tissue(); - int_O_gtissue_limit = (int)(pres_tissue_limit[char_O_gtissue_no] * 1000); - int_O_gtissue_press = (int)((pres_tissue[char_O_gtissue_no] + pres_tissue[char_O_gtissue_no+16]) * 1000); - if (char_I_deco_model == 1) - { - temp1 = temp1 * GF_high; - } - else - { - temp1 = temp_surface; - } - if (pres_gtissue_limit > temp1 && char_O_deco_status == 0) - { - char_O_nullzeit = 0; - char_O_deco_status = 255; - } -} -void calc_hauptroutine_calc_deco(void) -{ - do - { - int_temp_decostatus = 0; - calc_nextdecodepth_GF(); - if (temp_depth_limit > 0) - { - if (char_I_const_ppO2 == 0) - { - deco_diluent = temp_deco; - if (temp_deco > deco_gas_change) - { - calc_N2_ratio = N2_ratio; - calc_He_ratio = He_ratio; - } - else - { - calc_N2_ratio = deco_N2_ratio; - calc_He_ratio = deco_He_ratio; - } - } - else - { - calc_N2_ratio = N2_ratio; - calc_He_ratio = He_ratio; - if (temp_deco > deco_ppO2_change) - { - deco_diluent = ((temp_deco - const_ppO2)/(N2_ratio + He_ratio)); - } - else - { - deco_diluent = ((temp_deco - deco_ppO2)/(N2_ratio + He_ratio)); - } - } - if (deco_diluent > temp_deco) - deco_diluent = temp_deco; - if (deco_diluent > 0.0627) - { - temp_atem = calc_N2_ratio * (deco_diluent - 0.0627); - temp2_atem = calc_He_ratio * (deco_diluent - 0.0627); - } - else - { - temp_atem = 0.0; - temp2_atem = 0.0; - } - sim_tissue_1min(); - update_internal_deco_table_GF(); - temp_decotime = 1; - update_decoarray(); - char_O_deco_status = char_O_deco_status + 1; - if (char_O_deco_status < 16) - int_temp_decostatus = 1; - } - else - { - char_O_deco_status = 0; - } - } while (int_temp_decostatus == 1); - if (char_O_deco_status > 15) - { - char_O_deco_status = 1; - } - else - { - copy_deco_table_GF(); - char_O_deco_status = 0; - } -} - -void calc_hauptroutine_calc_ascend_to_deco(void) -{ - update_startvalues(); - char_O_deco_status = 0; - temp_deco = pres_respiration; - lock_GF_depth_list = 1; - do - { - int_temp_decostatus = 0; - temp_deco = temp_deco - 1.0; - if ( char_I_deco_model == 1) - temp_limit = temp_pres_gtissue_limit_GF_low; - else - temp_limit = temp_pres_gtissue_limit; - if ((temp_deco > temp_limit) && (temp_deco > pres_surface)) - { - lock_GF_depth_list = 0; - output[6] = 0; - if (char_I_const_ppO2 == 0) - { - deco_diluent = temp_deco + 0.5; - if (temp_deco + 0.5 > deco_gas_change) - { - calc_N2_ratio = N2_ratio; - calc_He_ratio = He_ratio; - } - else - { - calc_N2_ratio = deco_N2_ratio; - calc_He_ratio = deco_He_ratio; - } - } - else - { - calc_N2_ratio = N2_ratio; - calc_He_ratio = He_ratio; - if (temp_deco + 0.5 > deco_ppO2_change) - deco_diluent = ((temp_deco + 0.5 - const_ppO2)/(N2_ratio + He_ratio)); - else - deco_diluent = ((temp_deco + 0.5 - deco_ppO2)/(N2_ratio + He_ratio)); - if (deco_diluent > (temp_deco +0.5)) - deco_diluent = temp_deco + 0.5; - } - if (deco_diluent > 0.0627) - { - temp_atem = calc_N2_ratio * (deco_diluent - 0.0627); - temp2_atem = calc_He_ratio * (deco_diluent - 0.0627); - } - else - { - temp_atem = 0.0; - temp2_atem = 0.0; - } - sim_tissue_1min(); - char_O_deco_status = char_O_deco_status + 1; - if (char_O_deco_status < 16) - int_temp_decostatus = 1; - } - } while (int_temp_decostatus == 1); -} - - - - - - -void calc_tissue(void) -{ -_asm -lfsr 1, 0x300 -movlw 0x01 -movwf TBLPTRU,0 -_endasm - - char_O_gtissue_no = 255; - pres_gtissue_limit = 0.0; - -for (ci=0;ci<16;ci++) -{ -_asm -movlw 0x02 -movwf TBLPTRH,0 -movlb 4 -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_e2secs+1 -TBLRDPOSTINC -movff TABLAT,var_e2secs -TBLRDPOSTINC -movff TABLAT,var_e2secs+3 -TBLRD -movff TABLAT,var_e2secs+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_e2secs+1 -TBLRDPOSTINC -movff TABLAT,var2_e2secs -TBLRDPOSTINC -movff TABLAT,var2_e2secs+3 -TBLRD -movff TABLAT,var2_e2secs+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_a+1 -TBLRDPOSTINC -movff TABLAT,var_a -TBLRDPOSTINC -movff TABLAT,var_a+3 -TBLRD -movff TABLAT,var_a+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_a+1 -TBLRDPOSTINC -movff TABLAT,var2_a -TBLRDPOSTINC -movff TABLAT,var2_a+3 -TBLRD -movff TABLAT,var2_a+2 -addlw 0x40 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_b+1 -TBLRDPOSTINC -movff TABLAT,var_b -TBLRDPOSTINC -movff TABLAT,var_b+3 -TBLRD -movff TABLAT,var_b+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_b+1 -TBLRDPOSTINC -movff TABLAT,var2_b -TBLRDPOSTINC -movff TABLAT,var2_b+3 -TBLRD -movff TABLAT,var2_b+2 -_endasm - - - if( (var_e2secs < 0.0000363) - || (var_e2secs > 0.00577) - || (var2_e2secs < 0.0000961) - || (var2_e2secs > 0.150) - || (var_a < 0.231) - || (var_a > 1.27) - || (var_b < 0.504) - || (var_b > 0.966) - || (var2_a < 0.510) - || (var2_a > 1.75) - || (var2_b < 0.423) - || (var2_b > 0.927) - ) - int_O_DBG_pre_bitfield |= 0b0010000000000000 ; - - - temp_tissue = (temp_atem - pres_tissue[ci]) * var_e2secs; - temp_tissue_safety(); - pres_tissue[ci] = pres_tissue[ci] + temp_tissue; - - - temp_tissue = (temp2_atem - pres_tissue[ci+16]) * var2_e2secs; - temp_tissue_safety(); - pres_tissue[ci+16] = pres_tissue[ci+16] + temp_tissue; - - temp_tissue = pres_tissue[ci] + pres_tissue[ci+16]; - - var_a = (var_a * pres_tissue[ci] + var2_a * pres_tissue[ci+16]) / temp_tissue; - var_b = (var_b * pres_tissue[ci] + var2_b * pres_tissue[ci+16]) / temp_tissue; - pres_tissue_limit[ci] = (temp_tissue - var_a) * var_b; - if (pres_tissue_limit[ci] < 0) - pres_tissue_limit[ci] = 0; - if (pres_tissue_limit[ci] > pres_gtissue_limit) - { - pres_gtissue_limit = pres_tissue_limit[ci]; - char_O_gtissue_no = ci; - } -} -} - - - - - - - - -void calc_nullzeit(void) -{ - char_O_nullzeit = 0; - int_temp = 1; - do - { - backup_sim_pres_tissue(); - sim_tissue_10min(); - char_O_nullzeit = char_O_nullzeit + 10; - int_temp = int_temp + 1; - if (char_I_deco_model == 1) - temp1 = GF_high * temp_pres_gtissue_diff + temp_pres_gtissue; - else - temp1 = temp_pres_gtissue_limit; - if (temp1 > temp_surface) - int_temp = 255; - } while (int_temp < 17); - if (int_temp == 255) - { - restore_sim_pres_tissue(); - char_O_nullzeit = char_O_nullzeit - 10; - } - int_temp = 1; - if (char_O_nullzeit < 60) - { - do - { - sim_tissue_1min(); - char_O_nullzeit = char_O_nullzeit + 1; - int_temp = int_temp + 1; - if (char_I_deco_model == 1) - temp1 = GF_high * temp_pres_gtissue_diff + temp_pres_gtissue; - else - temp1 = temp_pres_gtissue_limit; - if (temp1 > temp_surface) - int_temp = 255; - } while (int_temp < 10); - if (int_temp == 255) - char_O_nullzeit = char_O_nullzeit - 1; - } -} - - - - -void backup_sim_pres_tissue(void) -{ - for (x = 0;x<16;x++) - { - sim_pres_tissue_backup[x] = sim_pres_tissue[x]; - sim_pres_tissue_backup[x+16] = sim_pres_tissue[x+16]; - } -} - - - - -void restore_sim_pres_tissue(void) -{ - for (x = 0;x<16;x++) - { - sim_pres_tissue[x] = sim_pres_tissue_backup[x]; - sim_pres_tissue[x+16] = sim_pres_tissue_backup[x+16]; - } -} - - - - - -void calc_ascenttime(void) -{ -if (pres_respiration > pres_surface) - { - switch (char_O_deco_status) - { - case 2: - char_O_ascenttime = 255; - break; - case 1: - break; - default: - temp1 = pres_respiration - pres_surface + 0.6; - if (temp1 < 0) - temp1 = 0; - if (temp1 > 255) - temp1 = 255; - char_O_ascenttime = (char)temp1; - - for(ci=0;ci<7;ci++) - { - x = char_O_ascenttime + char_O_array_decotime[ci]; - if (x < char_O_ascenttime) - char_O_ascenttime = 255; - else - char_O_ascenttime = x; - } - } - } -else - char_O_ascenttime = 0; -} - - - - - - - -void update_startvalues(void) -{ - temp_pres_gtissue_limit = pres_gtissue_limit; - temp_pres_gtissue = pres_tissue[char_O_gtissue_no] + pres_tissue[char_O_gtissue_no+16]; - temp_pres_gtissue_diff = temp_pres_gtissue_limit - temp_pres_gtissue; - temp_pres_gtissue_limit_GF_low = GF_low * temp_pres_gtissue_diff + temp_pres_gtissue; - temp_pres_gtissue_limit_GF_low_below_surface = temp_pres_gtissue_limit_GF_low - pres_surface; - if (temp_pres_gtissue_limit_GF_low_below_surface < 0) - temp_pres_gtissue_limit_GF_low_below_surface = 0; - - temp_gtissue_no = char_O_gtissue_no; - for (x = 0;x<16;x++) - { - sim_pres_tissue[x] = pres_tissue[x]; - sim_pres_tissue[x+16] = pres_tissue[x+16]; - sim_pres_tissue_limit[x] = pres_tissue_limit[x]; - } -} - - - - - - - -void sim_tissue_1min(void) -{ -temp_pres_gtissue_limit = 0.0; -temp_gtissue_no = 255; - -_asm -lfsr 1, 0x300 -movlw 0x01 -movwf TBLPTRU,0 -_endasm - - -for (ci=0;ci<16;ci++) -{ -_asm -movlw 0x02 -movwf TBLPTRH,0 -movlb 4 -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addlw 0x80 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_a+1 -TBLRDPOSTINC -movff TABLAT,var_a -TBLRDPOSTINC -movff TABLAT,var_a+3 -TBLRD -movff TABLAT,var_a+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_a+1 -TBLRDPOSTINC -movff TABLAT,var2_a -TBLRDPOSTINC -movff TABLAT,var2_a+3 -TBLRD -movff TABLAT,var2_a+2 -addlw 0x40 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_b+1 -TBLRDPOSTINC -movff TABLAT,var_b -TBLRDPOSTINC -movff TABLAT,var_b+3 -TBLRD -movff TABLAT,var_b+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_b+1 -TBLRDPOSTINC -movff TABLAT,var2_b -TBLRDPOSTINC -movff TABLAT,var2_b+3 -TBLRD -movff TABLAT,var2_b+2 -addlw 0xC0 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_e1min+1 -TBLRDPOSTINC -movff TABLAT,var_e1min -TBLRDPOSTINC -movff TABLAT,var_e1min+3 -TBLRD -movff TABLAT,var_e1min+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_e1min+1 -TBLRDPOSTINC -movff TABLAT,var2_e1min -TBLRDPOSTINC -movff TABLAT,var2_e1min+3 -TBLRD -movff TABLAT,var2_e1min+2 -_endasm - - temp_tissue = (temp_atem - sim_pres_tissue[ci]) * var_e1min; - temp_tissue_safety(); - sim_pres_tissue[ci] = sim_pres_tissue[ci] + temp_tissue; - - temp_tissue = (temp2_atem - sim_pres_tissue[ci+16]) * var2_e1min; - temp_tissue_safety(); - sim_pres_tissue[ci+16] = sim_pres_tissue[ci+16] + temp_tissue; - - temp_tissue = sim_pres_tissue[ci] + sim_pres_tissue[ci+16]; - var_a = (var_a * sim_pres_tissue[ci] + var2_a * sim_pres_tissue[ci+16]) / temp_tissue; - var_b = (var_b * sim_pres_tissue[ci] + var2_b * sim_pres_tissue[ci+16]) / temp_tissue; - sim_pres_tissue_limit[ci] = (temp_tissue - var_a) * var_b; - - if (sim_pres_tissue_limit[ci] < 0) - sim_pres_tissue_limit[ci] = 0; - if (sim_pres_tissue_limit[ci] > temp_pres_gtissue_limit) - { - temp_pres_gtissue = temp_tissue; - temp_pres_gtissue_limit = sim_pres_tissue_limit[ci]; - temp_gtissue_no = ci; - } -} - temp_pres_gtissue_diff = temp_pres_gtissue_limit - temp_pres_gtissue; - temp_pres_gtissue_limit_GF_low = GF_low * temp_pres_gtissue_diff + temp_pres_gtissue; - temp_pres_gtissue_limit_GF_low_below_surface = temp_pres_gtissue_limit_GF_low - pres_surface; - if (temp_pres_gtissue_limit_GF_low_below_surface < 0) - temp_pres_gtissue_limit_GF_low_below_surface = 0; -} - - - - - - - - - - -void sim_tissue_10min(void) -{ -temp_pres_gtissue_limit = 0.0; -temp_gtissue_no = 255; - -_asm -lfsr 1, 0x300 -movlw 0x01 -movwf TBLPTRU,0 -_endasm - -for (ci=0;ci<16;ci++) -{ -_asm -movlw 0x02 -movwf TBLPTRH,0 -movlb 4 -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addlw 0x80 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_a+1 -TBLRDPOSTINC -movff TABLAT,var_a -TBLRDPOSTINC -movff TABLAT,var_a+3 -TBLRD -movff TABLAT,var_a+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_a+1 -TBLRDPOSTINC -movff TABLAT,var2_a -TBLRDPOSTINC -movff TABLAT,var2_a+3 -TBLRD -movff TABLAT,var2_a+2 -addlw 0x40 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_b+1 -TBLRDPOSTINC -movff TABLAT,var_b -TBLRDPOSTINC -movff TABLAT,var_b+3 -TBLRD -movff TABLAT,var_b+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_b+1 -TBLRDPOSTINC -movff TABLAT,var2_b -TBLRDPOSTINC -movff TABLAT,var2_b+3 -TBLRD -movff TABLAT,var2_b+2 -addlw 0xC0 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_e1min+1 -TBLRDPOSTINC -movff TABLAT,var_e1min -TBLRDPOSTINC -movff TABLAT,var_e1min+3 -TBLRD -movff TABLAT,var_e1min+2 -addlw 0x40 -movwf TBLPTRL,0 - -TBLRDPOSTINC -movff TABLAT,var2_e1min+1 -TBLRDPOSTINC -movff TABLAT,var2_e1min -TBLRDPOSTINC -movff TABLAT,var2_e1min+3 -TBLRD -movff TABLAT,var2_e1min+2 -_endasm - - temp_tissue = (temp_atem - sim_pres_tissue[ci]) * var_e1min; - temp_tissue_safety(); - sim_pres_tissue[ci] = sim_pres_tissue[ci] + temp_tissue; - - temp_tissue = (temp2_atem - sim_pres_tissue[ci+16]) * var2_e1min; - temp_tissue_safety(); - sim_pres_tissue[ci+16] = sim_pres_tissue[ci+16] + temp_tissue; - -temp_tissue = sim_pres_tissue[ci] + sim_pres_tissue[ci+16]; - var_a = (var_a * sim_pres_tissue[ci] + var2_a * sim_pres_tissue[ci+16]) / temp_tissue; - var_b = (var_b * sim_pres_tissue[ci] + var2_b * sim_pres_tissue[ci+16]) / temp_tissue; - -sim_pres_tissue_limit[ci] = (temp_tissue - var_a) * var_b; - if (sim_pres_tissue_limit[ci] < 0) - sim_pres_tissue_limit[ci] = 0; - if (sim_pres_tissue_limit[ci] > temp_pres_gtissue_limit) - { - temp_pres_gtissue = temp_tissue; - temp_pres_gtissue_limit = sim_pres_tissue_limit[ci]; - temp_gtissue_no = ci; - } -} - temp_pres_gtissue_diff = temp_pres_gtissue_limit - temp_pres_gtissue; - temp_pres_gtissue_limit_GF_low = GF_low * temp_pres_gtissue_diff + temp_pres_gtissue; - temp_pres_gtissue_limit_GF_low_below_surface = temp_pres_gtissue_limit_GF_low - pres_surface; - if (temp_pres_gtissue_limit_GF_low_below_surface < 0) - temp_pres_gtissue_limit_GF_low_below_surface = 0; -} - - - - - - - -void clear_decoarray(void) -{ -char_O_array_decodepth[0] = 0; -char_O_array_decodepth[1] = 0; -char_O_array_decodepth[2] = 0; -char_O_array_decodepth[3] = 0; -char_O_array_decodepth[4] = 0; -char_O_array_decodepth[5] = 0; -char_O_array_decotime[0] = 0; -char_O_array_decotime[1] = 0; -char_O_array_decotime[2] = 0; -char_O_array_decotime[3] = 0; -char_O_array_decotime[4] = 0; -char_O_array_decotime[5] = 0; -char_O_array_decotime[6] = 0; -} - - - - - - - -void update_decoarray() -{ - x = 0; - do - { - if (char_O_array_decodepth[x] == temp_depth_limit) - { - int_temp = char_O_array_decotime[x] + temp_decotime; - if (int_temp < 0) - int_temp = 0; - if (int_temp > 240) - int_temp = 240; - char_O_array_decotime[x] = int_temp; - x = 10; - } - else - { - if (char_O_array_decodepth[x] == 0) - { - if (temp_depth_limit > 255) - char_O_array_decodepth[x] = 255; - else - char_O_array_decodepth[x] = (char)temp_depth_limit; - int_temp = char_O_array_decotime[x] + temp_decotime; - if (int_temp > 240) - char_O_array_decotime[x] = 240; - else - char_O_array_decotime[x] = (char)int_temp; - x = 10; - } - else - x++; - } - } while (x<6); - if (x == 6) - { - int_temp = char_O_array_decotime[6] + temp_decotime; - if (int_temp > 220) - char_O_array_decotime[6] = 220; - else - char_O_array_decotime[6] = (char)int_temp; - } -} - - - - - - - - -void calc_gradient_factor(void) -{ - - - - - temp_tissue = pres_tissue[char_O_gtissue_no] + pres_tissue[char_O_gtissue_no+16]; - temp1 = temp_tissue - pres_respiration; - temp2 = temp_tissue - pres_tissue_limit[char_O_gtissue_no]; - temp2 = temp1/temp2; - temp2 = temp2 * 100; - if (temp2 < 0) - temp2 = 0; - if (temp2 > 255) - temp2 = 255; - if (temp1 < 0) - char_O_gradient_factor = 0; - else - char_O_gradient_factor = (char)temp2; - - temp3 = temp2; - - if (char_I_deco_model == 1) - { - temp1 = (float)temp_depth_GF_low_meter * 0.09995; - temp2 = pres_respiration - pres_surface; - if (temp2 <= 0) - temp1 = GF_high; - else - if (temp2 >= temp1) - temp1 = GF_low; - else - temp1 = GF_low + (temp1 - temp2)/temp1*GF_delta; - if (temp_depth_GF_low_meter == 0) - temp1 = GF_high; - temp2 = temp3 / temp1; - if (temp2 < 0) - temp2 = 0; - if (temp2 > 255) - temp2 = 255; - char_O_relative_gradient_GF = (char)temp2; - } - else - { - char_O_relative_gradient_GF = char_O_gradient_factor; - } -} - - - - - - - -void calc_gradient_array_only() -{ - pres_respiration = (float)int_I_pres_respiration / 1000.0; -for (ci=0;ci<16;ci++) -{ - temp_tissue = pres_tissue[ci] + pres_tissue[ci+16]; - temp1 = temp_tissue - pres_respiration; - temp2 = temp_tissue - pres_tissue_limit[ci]; - temp2 = temp1/temp2; - temp2 = temp2 * 200; - if (temp2 < 0) - temp2 = 0; - if (temp2 > 255) - temp2 = 255; - if (temp1 < 0) - char_O_array_gradient_weighted[ci] = 0; - else - char_O_array_gradient_weighted[ci] = (char)temp2; -} -} - - - - - - - - -void calc_desaturation_time(void) -{ -_asm -lfsr 1, 0x300 -movlw 0x01 -movwf TBLPTRU,0 -_endasm - N2_ratio = 0.7902; - pres_surface = (float)int_I_pres_surface / 1000.0; - temp_atem = N2_ratio * (pres_surface - 0.0627); - int_O_desaturation_time = 0; - float_desaturation_multiplier = char_I_desaturation_multiplier / 142.0; - -for (ci=0;ci<16;ci++) -{ -_asm -movlw 0x04 -movwf TBLPTRH,0 -movlb 4 -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addlw 0x80 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_halftimes+1 -TBLRDPOSTINC -movff TABLAT,var_halftimes -TBLRDPOSTINC -movff TABLAT,var_halftimes+3 -TBLRD -movff TABLAT,var_halftimes+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_halftimes+1 -TBLRDPOSTINC -movff TABLAT,var2_halftimes -TBLRDPOSTINC -movff TABLAT,var2_halftimes+3 -TBLRD -movff TABLAT,var2_halftimes+2 -_endasm - - - - - - - temp1 = 1.05 * temp_atem; - temp1 = temp1 - pres_tissue[ci]; - temp2 = temp_atem - pres_tissue[ci]; - if (temp2 >= 0.0) - { - temp1 = 0; - temp2 = 0; - } - else - temp1 = temp1 / temp2; - if (temp1 > 0.0) - { - temp1 = log(1.0 - temp1); - temp1 = temp1 / -0.6931; - - - temp2 = var_halftimes * temp1 / float_desaturation_multiplier; - } - else - { - temp1 = 0; - temp2 = 0; - } - - - temp3 = 0.1 - pres_tissue[ci+16]; -if (temp3 >= 0.0) - { - temp3 = 0; - temp4 = 0; - } - else - temp3 = -1.0 * temp3 / pres_tissue[ci+16]; - if (temp3 > 0.0) - { - temp3 = log(1.0 - temp3); - temp3 = temp3 / -0.6931; - - - temp4 = var2_halftimes * temp3 / float_desaturation_multiplier; - } - else - { - temp3 = 0; - temp4 = 0; - } - - - if (temp4 > temp2) - int_temp = (int)temp4; - else - int_temp = (int)temp2; - if(int_temp > int_O_desaturation_time) - int_O_desaturation_time = int_temp; - - - temp2 = temp1 * 20.0; - temp2 = temp2 + 80.0; - if (temp2 < 0.0) - temp2 = 0.0; - if (temp2 > 255.0) - temp2 = 255.0; - char_O_tissue_saturation[ci] = (char)temp2; - - temp4 = temp3 * 20.0; - temp4 = temp4 + 80.0; - if (temp4 < 0.0) - temp4 = 0.0; - if (temp4 > 255.0) - temp4 = 255.0; - char_O_tissue_saturation[ci+16] = (char)temp4; -} -} - - - - - - - - - -void calc_wo_deco_step_1_min(void) -{ - if(flag_in_divemode) - { - flag_in_divemode = 0; - set_dbg_end_of_dive(); - } -_asm - lfsr 1, 0x300 -_endasm - N2_ratio = 0.7902; - pres_respiration = (float)int_I_pres_respiration / 1000.0; - pres_surface = (float)int_I_pres_surface / 1000.0; - temp_atem = N2_ratio * (pres_respiration - 0.0627); - temp2_atem = 0.0; - temp_surface = pres_surface; - float_desaturation_multiplier = char_I_desaturation_multiplier / 142.0; - float_saturation_multiplier = char_I_saturation_multiplier / 100.0; - - calc_tissue_step_1_min(); - clear_decoarray(); - char_O_deco_status = 0; - char_O_nullzeit = 0; - char_O_ascenttime = 0; - calc_gradient_factor(); - -} - - - - - - - -void calc_tissue_step_1_min(void) -{ -_asm -lfsr 1, 0x300 -movlw 0x01 -movwf TBLPTRU,0 -_endasm - - char_O_gtissue_no = 255; - pres_gtissue_limit = 0.0; - -for (ci=0;ci<16;ci++) -{ -_asm -movlw 0x02 -movwf TBLPTRH,0 -movlb 4 -movf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addwf ci,0,1 -addlw 0x80 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var_a+1 -TBLRDPOSTINC -movff TABLAT,var_a -TBLRDPOSTINC -movff TABLAT,var_a+3 -TBLRD -movff TABLAT,var_a+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_a+1 -TBLRDPOSTINC -movff TABLAT,var2_a -TBLRDPOSTINC -movff TABLAT,var2_a+3 -TBLRD -movff TABLAT,var2_a+2 -addlw 0x40 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_b+1 -TBLRDPOSTINC -movff TABLAT,var_b -TBLRDPOSTINC -movff TABLAT,var_b+3 -TBLRD -movff TABLAT,var_b+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_b+1 -TBLRDPOSTINC -movff TABLAT,var2_b -TBLRDPOSTINC -movff TABLAT,var2_b+3 -TBLRD -movff TABLAT,var2_b+2 -addlw 0xC0 -movwf TBLPTRL,0 -incf TBLPTRH,1,0 -TBLRDPOSTINC -movff TABLAT,var_e1min+1 -TBLRDPOSTINC -movff TABLAT,var_e1min -TBLRDPOSTINC -movff TABLAT,var_e1min+3 -TBLRD -movff TABLAT,var_e1min+2 -addlw 0x40 -movwf TBLPTRL,0 -TBLRDPOSTINC -movff TABLAT,var2_e1min+1 -TBLRDPOSTINC -movff TABLAT,var2_e1min -TBLRDPOSTINC -movff TABLAT,var2_e1min+3 -TBLRD -movff TABLAT,var2_e1min+2 -_endasm - - - temp_tissue = (temp_atem - pres_tissue[ci]) * var_e1min; - temp_tissue_safety(); - pres_tissue[ci] = pres_tissue[ci] + temp_tissue; - - - temp_tissue = (temp2_atem - pres_tissue[ci+16]) * var2_e1min; - temp_tissue_safety(); - pres_tissue[ci+16] = pres_tissue[ci+16] + temp_tissue; - - temp_tissue = pres_tissue[ci] + pres_tissue[ci+16]; - var_a = (var_a * pres_tissue[ci] + var2_a * pres_tissue[ci+16]) / temp_tissue; - var_b = (var_b * pres_tissue[ci] + var2_b * pres_tissue[ci+16]) / temp_tissue; - pres_tissue_limit[ci] = (temp_tissue - var_a) * var_b; - if (pres_tissue_limit[ci] < 0) - pres_tissue_limit[ci] = 0; - if (pres_tissue_limit[ci] > pres_gtissue_limit) - { - pres_gtissue_limit = pres_tissue_limit[ci]; - char_O_gtissue_no = ci; - } - - - - - - - - - -temp1 = temp_tissue - pres_respiration; -temp2 = temp_tissue - pres_tissue_limit[ci]; -temp2 = temp1/temp2; -temp2 = temp2 * 200; -if (temp2 < 0) - temp2 = 0; -if (temp2 > 255) - temp2 = 255; -if (temp1 < 0) - char_O_array_gradient_weighted[ci] = 0; -else - char_O_array_gradient_weighted[ci] = (char)temp2; - -} -} - -#line 2689 "p2_deco_main - 090915b.c" -#line 2700 "p2_deco_main - 090915b.c" - - - - -void hash(void) -{ - - for (md_i=0;md_i<16;md_i++) - { - md_state[md_i] = 0; - md_cksum[md_i] = 0; - } - -_asm - movlw 0x01 - movwf TBLPTRU,0 - movlw 0x06 - movwf TBLPTRH,0 - movlw 0x00 - movwf TBLPTRL,0 -_endasm - for (md_i=0;md_i<127;md_i++) - { -_asm - TBLRDPOSTINC - movff TABLAT,md_temp -_endasm - md_pi_subst[md_i] = md_temp; - } -_asm - TBLRDPOSTINC - movff TABLAT,md_temp -_endasm - md_pi_subst[127] = md_temp; - for (md_i=0;md_i<127;md_i++) - { -_asm - TBLRDPOSTINC - movff TABLAT,md_temp -_endasm - md_pi_subst[md_i+128] = md_temp; - } -_asm - TBLRD - movff TABLAT,md_temp -_endasm - md_pi_subst[255] = md_temp; - -_asm - movlw 0x00 - movwf TBLPTRU,0 - movlw 0x00 - movwf TBLPTRH,0 - movlw 0x00 - movwf TBLPTRL,0 -_endasm - -for (md_pointer=0x0000;md_pointer<0x17f3;md_pointer++) -{ - md_t = 0; - for (md_i=0;md_i<16;md_i++) - { - if(md_pointer == 9) - md_temp = md_cksum[md_i]; - else - { -_asm - TBLRDPOSTINC - movff TABLAT,md_temp -_endasm - } - md_buffer[md_i] = md_temp; - md_state[md_i+16] = md_buffer[md_i]; - md_state[md_i+32] = (unsigned char)(md_buffer[md_i] ^ md_state[md_i]); - } - - for (md_i=0;md_i<18;md_i++) - { - for (md_j=0;md_j<48;md_j++) - { - md_state[md_j] = (unsigned char)(md_state[md_j] ^ md_pi_subst[md_t]); - md_t = md_state[md_j]; - } - md_t = (unsigned char)(md_t+1); - } - md_t = md_cksum[15]; - - for (md_i=0;md_i<16;md_i++) - { - md_cksum[md_i] = (unsigned char)(md_cksum[md_i] ^ md_pi_subst[(md_buffer[md_i] ^ md_t)]); - md_t = md_cksum[md_i]; - } -} -} - - - - - - -void clear_CNS_fraction(void) -{ - CNS_fraction = 0.0; - char_O_CNS_fraction = 0; -} - - - - - - - - - - - - - -void calc_CNS_fraction(void) -{ - actual_ppO2 = (float)char_I_actual_ppO2 / 100.0; - - if (char_I_actual_ppO2 < 50) - CNS_fraction = CNS_fraction; - else if (char_I_actual_ppO2 < 60) - CNS_fraction = 1/(-54000.0 * actual_ppO2 + 54000.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 70) - CNS_fraction = 1/(-45000.0 * actual_ppO2 + 48600.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 80) - CNS_fraction = 1/(-36000.0 * actual_ppO2 + 42300.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 90) - CNS_fraction = 1/(-27000.0 * actual_ppO2 + 35100.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 110) - CNS_fraction = 1/(-18000.0 * actual_ppO2 + 27000.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 150) - CNS_fraction = 1/(-9000.0 * actual_ppO2 + 17100.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 160) - CNS_fraction = 1/(-22500.0 * actual_ppO2 + 37350.0) + CNS_fraction; - else if (char_I_actual_ppO2 < 165) - CNS_fraction = 0.000755 + CNS_fraction; - else if (char_I_actual_ppO2 < 170) - CNS_fraction = 0.00102 + CNS_fraction; - else if (char_I_actual_ppO2 < 175) - CNS_fraction = 0.00136 + CNS_fraction; - else if (char_I_actual_ppO2 < 180) - CNS_fraction = 0.00180 + CNS_fraction; - else if (char_I_actual_ppO2 < 185) - CNS_fraction = 0.00237 + CNS_fraction; - else if (char_I_actual_ppO2 < 190) - CNS_fraction = 0.00310 + CNS_fraction; - else if (char_I_actual_ppO2 < 195) - CNS_fraction = 0.00401 + CNS_fraction; - else if (char_I_actual_ppO2 < 200) - CNS_fraction = 0.00517 + CNS_fraction; - else if (char_I_actual_ppO2 < 230) - CNS_fraction = 0.0209 + CNS_fraction; - else - CNS_fraction = 0.0482 + CNS_fraction; - - if (CNS_fraction > 2.5) - CNS_fraction = 2.5; - if (CNS_fraction < 0.0) - CNS_fraction = 0.0; - char_O_CNS_fraction = (char)((CNS_fraction + 0.005)* 100.0); -} - - - - - - - - - - - -void calc_CNS_decrease_15min(void) -{ - CNS_fraction = 0.890899 * CNS_fraction; - char_O_CNS_fraction = (char)((CNS_fraction + 0.005)* 100.0); -} - - - - - - - - - - -void calc_percentage(void) -{ - temp1 = (float)int_I_temp; - temp2 = (float)char_I_temp / 100.0; - temp3 = temp1 * temp2; - int_I_temp = (int)temp3; -} -void push_tissues_to_vault(void) -{ - for (ci=0;ci<32;ci++) - pres_tissue_vault[ci] = pres_tissue[ci]; -} -void pull_tissues_from_vault(void) -{ - for (ci=0;ci<32;ci++) - pres_tissue[ci] = pres_tissue_vault[ci]; -} - -void wp_write_command(void) -{ - _asm - bcf PORTE,0,0 - movff wp_command,PORTD - bcf PORTA,2,0 - bsf PORTA,2,0 - _endasm -} - -void wp_write_data(void) -{ - wp_data_8bit_one = wp_data_16bit >> 8; - wp_data_8bit_two = wp_data_16bit; -_asm - bsf PORTE,0,0 - movff wp_data_8bit_one,PORTD - bcf PORTA,2,0 - bsf PORTA,2,0 - movff wp_data_8bit_two,PORTD - bcf PORTA,2,0 - bsf PORTA,2,0 -_endasm -} - -void wp_write_black(void) -{ -_asm - movff wp_black,PORTD - bcf PORTA,2,0 - bsf PORTA,2,0 - bcf PORTA,2,0 - bsf PORTA,2,0 -_endasm -} - -void wp_write_color(void) -{ -_asm - movff wp_color1,PORTD - bcf PORTA,2,0 - bsf PORTA,2,0 - movff wp_color2,PORTD - bcf PORTA,2,0 - bsf PORTA,2,0 -_endasm -} - -void wp_set_window(void) -{ - - wp_command = 0x35; - wp_write_command(); - wp_data_16bit = ((unsigned int )wp_leftx2) << 1; - wp_write_data(); - - wp_command = 0x36; - wp_write_command(); - wp_data_16bit = 319; - wp_write_data(); - - wp_command = 0x37; - wp_write_command(); - - wp_data_16bit = wp_top; - if(wp_font == 2) - wp_data_16bit += 58 ; - else if(wp_font == 1) - wp_data_16bit += 32 ; - else - wp_data_16bit += 24 ; - wp_data_16bit--; - if(wp_data_16bit > 239) - wp_data_16bit = 239; - - wp_data_16bit |= ((unsigned int )wp_top) << 8; - - wp_write_data(); - - - wp_command = 0x20; - wp_write_command(); - wp_data_16bit = wp_top; - wp_write_data(); - - wp_command = 0x21; - wp_write_command(); - wp_data_16bit = ((unsigned int )wp_leftx2) << 1; - wp_write_data(); -} - -void wp_set_char_font_small(void) -{ - if (wp_char == ' ') - wp_char = '¶'; - - if((wp_char < '!') || (wp_char > '¶')) - wp_char = '¤'; - - if (wp_char > 0x7E) - wp_char -= 34; - - wp_start = wp_small_table[wp_char - '!']; - wp_end = wp_small_table[1 + wp_char - '!']; -} - -void wp_set_char_font_medium(void) -{ - - if (wp_char == 0x27) - wp_char = 0x3B; - if (wp_char == '"') - wp_char = 0x3C; - if (wp_char == 'm') - wp_char = 0x3D; - if (wp_char == ' ') - wp_char = 0x3E; - - if((wp_char < '.') || (wp_char > 0x3E)) - wp_char = 0x3E; - wp_start = wp_medium_table[wp_char - '.']; - wp_end = wp_medium_table[1 + wp_char - '.']; -} - -void wp_set_char_font_large(void) -{ - - if (wp_char == ' ') - wp_char = 0x2F; - - if((wp_char < '.') || (wp_char > '9')) - wp_char = 0x2F; - wp_start = wp_large_table[wp_char - '.']; - wp_end = wp_large_table[1 + wp_char - '.']; -} - -void wordprocessor(void) -{ - wp_set_window(); - - - wp_command = 0x22; - wp_write_command(); - _asm - bsf PORTE,0,0 - _endasm - - wp_txtptr = 0; - wp_char = wp_stringstore[wp_txtptr]; - - while(wp_char) - { - if(wp_font == 2) - wp_set_char_font_large(); - else if(wp_font == 1) - wp_set_char_font_medium(); - else - wp_set_char_font_small(); - - wp_black = 0; - - for(wp_i = wp_start; wp_i<wp_end;wp_i++) - { - if(wp_font == 2) - wp_data_16bit = wp_large_data[wp_i / 2]; - else if(wp_font == 1) - wp_data_16bit = wp_medium_data[wp_i / 2]; - else - wp_data_16bit = wp_small_data[wp_i / 2]; - if(wp_i & 1) - wp_temp_U8 = wp_data_16bit & 0xFF; - else - wp_temp_U8 = wp_data_16bit >> 8; - if((wp_temp_U8 & 128)) - { - wp_temp_U8 -= 127; - if(wp_invert) - { - while(wp_temp_U8 > 0) - { - wp_temp_U8--; - wp_write_color(); - } - } - else - { - _asm - movff wp_black,PORTD - _endasm - while(wp_temp_U8 > 0) - { - wp_temp_U8--; - _asm - bcf PORTA,2,0 - bsf PORTA,2,0 - bcf PORTA,2,0 - bsf PORTA,2,0 - _endasm - } - } - } - else - { - wp_temp_U8++; - if(wp_invert) - { - _asm - movff wp_black,PORTD - _endasm - while(wp_temp_U8 > 0) - { - wp_temp_U8--; - _asm - bcf PORTA,2,0 - bsf PORTA,2,0 - bcf PORTA,2,0 - bsf PORTA,2,0 - _endasm - } - } - else - { - while(wp_temp_U8 > 0) - { - wp_temp_U8--; - wp_write_color(); - } - } - } - } - wp_txtptr++; - wp_char = wp_stringstore[wp_txtptr]; - } - wp_command = 0x00; - wp_write_command(); -}