Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/simulator.asm @ 269:be06783f533b
hunting for bug#30 - solved by disabling timer3 (?)
author | heinrichsweikamp |
---|---|
date | Tue, 12 Apr 2011 22:58:04 +0200 |
parents | ab8ce7de2b46 |
children | fda90f19486a |
comparison
equal
deleted
inserted
replaced
268:7d24c9d62095 | 269:be06783f533b |
---|---|
330 movwf menupos | 330 movwf menupos |
331 bra menu_simulator1 | 331 bra menu_simulator1 |
332 | 332 |
333 | 333 |
334 simulator_calc_deco: | 334 simulator_calc_deco: |
335 call diveloop_boot ; configure gases, etc. | 335 call simulator_save_tissue_data ; Stores 32 floats "pre_tissue" into bank3 |
336 | 336 |
337 bsf simulatormode_active ; normal simulator mode | 337 bsf simulatormode_active ; normal simulator mode |
338 bsf standalone_simulator ; Standalone Simulator active | 338 bsf standalone_simulator ; Standalone Simulator active |
339 bsf no_sensor_int ; Disable sensor interrupt | |
340 clrf T3CON | |
341 clrf TMR3L | |
342 clrf TMR3H | |
343 | |
344 call diveloop_boot ; configure gases, etc. | |
345 | |
339 | 346 |
340 ; Save dive parameters for gas volume estimation: | 347 ; Save dive parameters for gas volume estimation: |
341 movff logbook_temp2,char_I_bottom_depth | 348 movff logbook_temp2,char_I_bottom_depth |
342 movff logbook_temp1,char_I_bottom_time | 349 movff logbook_temp1,char_I_bottom_time |
343 | 350 |
355 addwfc xC+1,F ; add 1000mBar | 362 addwfc xC+1,F ; add 1000mBar |
356 | 363 |
357 movff xC+0,sim_pressure+0 | 364 movff xC+0,sim_pressure+0 |
358 movff xC+1,sim_pressure+1 | 365 movff xC+1,sim_pressure+1 |
359 | 366 |
360 movff sim_pressure+0,amb_pressure+0 ; override readings with simulator values | 367 ; movff sim_pressure+0,amb_pressure+0 ; override readings with simulator values |
361 movff sim_pressure+1,amb_pressure+1 | 368 ; movff sim_pressure+1,amb_pressure+1 |
362 | |
363 call simulator_save_tissue_data ; Stores 32 floats "pre_tissue" into bank3 | |
364 | 369 |
365 call PLED_topline_box | 370 call PLED_topline_box |
366 WIN_INVERT .1 | 371 WIN_INVERT .1 |
367 DISPLAYTEXT .12 ; "Wait..." | 372 DISPLAYTEXT .12 ; "Wait..." |
368 WIN_INVERT .0 | 373 WIN_INVERT .0 |
369 | 374 |
375 movff sim_pressure+0,amb_pressure+0 ; override readings with simulator values | |
376 movff sim_pressure+1,amb_pressure+1 | |
377 | |
370 call divemode_check_decogases ; Checks for decogases and sets the gases | 378 call divemode_check_decogases ; Checks for decogases and sets the gases |
371 call divemode_prepare_flags_for_deco | 379 call divemode_prepare_flags_for_deco |
380 | |
372 movlw d'3' ; Begin of deco cycle (reset table). | 381 movlw d'3' ; Begin of deco cycle (reset table). |
373 movff WREG,char_O_deco_status ; Reset Deco module. | 382 movff WREG,char_O_deco_status ; Reset Deco module. |
383 | |
384 movlw d'0' | |
385 movff WREG,char_I_step_is_1min ; 2 second deco mode | |
374 | 386 |
375 simulator_calc_deco_loop1: | 387 simulator_calc_deco_loop1: |
376 call deco_calc_hauptroutine ; calc_tissue | 388 call deco_calc_hauptroutine ; calc_tissue |
377 movlb b'00000001' ; rambank 1 selected | 389 movlb b'00000001' ; rambank 1 selected |
378 | 390 |
384 movff WREG,char_I_step_is_1min ; 1 minute mode | 396 movff WREG,char_I_step_is_1min ; 1 minute mode |
385 | 397 |
386 simulator_calc_deco_loop2: | 398 simulator_calc_deco_loop2: |
387 call PLED_simulator_data | 399 call PLED_simulator_data |
388 | 400 |
389 call divemode_check_decogases ; Checks for decogases and sets the gases | 401 ; call divemode_check_decogases ; Checks for decogases and sets the gases |
390 call divemode_prepare_flags_for_deco | 402 ; call divemode_prepare_flags_for_deco |
391 | 403 |
392 call deco_calc_hauptroutine ; calc_tissue | 404 call deco_calc_hauptroutine ; calc_tissue |
393 movlb b'00000001' ; rambank 1 selected | 405 movlb b'00000001' ; rambank 1 selected |
394 ostc_debug 'C' ; Sends debug-information to screen if debugmode active | 406 ostc_debug 'C' ; Sends debug-information to screen if debugmode active |
395 | 407 |
397 bra simulator_calc_deco_loop2 | 409 bra simulator_calc_deco_loop2 |
398 | 410 |
399 movlw d'0' | 411 movlw d'0' |
400 movff WREG,char_I_step_is_1min ; 2 second deco mode | 412 movff WREG,char_I_step_is_1min ; 2 second deco mode |
401 | 413 |
402 movlw d'30' | 414 movlw d'255' |
403 movwf timeout_counter2 ; timeout used as temp here | 415 movwf timeout_counter2 ; timeout used as temp here |
404 simulator_calc_deco2: | 416 simulator_calc_deco2: |
405 call divemode_check_decogases ; Checks for decogases and sets the gases | 417 ; call divemode_check_decogases ; Checks for decogases and sets the gases |
406 call divemode_prepare_flags_for_deco | 418 ; call divemode_prepare_flags_for_deco |
407 | 419 |
408 call deco_calc_hauptroutine ; calc_tissue | 420 call deco_calc_hauptroutine ; calc_tissue |
409 movlb b'00000001' ; rambank 1 selected | 421 movlb b'00000001' ; rambank 1 selected |
410 | 422 |
411 dcfsnz timeout_counter2,F ; Abort loop (max. 30 tries)? | 423 dcfsnz timeout_counter2,F ; Abort loop (max. 255 tries)? |
412 bra simulator_calc_deco3 ; Yes... | 424 bra simulator_calc_deco3 ; Yes... |
413 | 425 |
414 movff char_O_deco_status,WREG | 426 movff char_O_deco_status,WREG |
415 tstfsz WREG ; deco_status=0 if decompression calculation done | 427 tstfsz WREG ; deco_status=0 if decompression calculation done |
416 bra simulator_calc_deco2 ; Not finished | 428 bra simulator_calc_deco2 ; Not finished |
417 | 429 |
418 simulator_calc_deco3: | 430 simulator_calc_deco3: |
419 ; Finished | 431 ; Finished |
420 call simulator_restore_tissue_data ; Restore 32 floats "pre_tissue" from bank3 | 432 rcall simulator_restore_tissue_data ; Restore 32 floats "pre_tissue" from bank3 |
421 | 433 |
422 bcf simulatormode_active ; normal simulator mode | 434 bcf simulatormode_active ; normal simulator mode |
423 bcf standalone_simulator ; Standalone Simulator active | 435 bcf standalone_simulator ; Standalone Simulator active |
436 bcf no_sensor_int ; Re-enable sensor interrupt | |
424 | 437 |
425 WAITMS d'250' | 438 WAITMS d'250' |
426 WAITMS d'250' | 439 WAITMS d'250' |
427 WAITMS d'250' ; Wait for Pressure Sensor to get real pressure again... | 440 WAITMS d'250' ; Wait for Pressure Sensor to get real pressure again... |
428 | 441 |