Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 39:1705b3f7e5b3
1.62 beta rc2
author | heinrichsweikamp |
---|---|
date | Tue, 01 Jun 2010 12:23:17 +0200 |
parents | 8ece4837a642 |
children | 92001c045088 |
comparison
equal
deleted
inserted
replaced
38:8ece4837a642 | 39:1705b3f7e5b3 |
---|---|
320 bra reset_decompression_gases ; While in NDL, do not set deompression gas | 320 bra reset_decompression_gases ; While in NDL, do not set deompression gas |
321 | 321 |
322 divemode_check_decogases: ; CALLed from Simulator | 322 divemode_check_decogases: ; CALLed from Simulator |
323 ; Copy active gases to char_I_deco_N2_ratio and char_I_deco_He_ratio | 323 ; Copy active gases to char_I_deco_N2_ratio and char_I_deco_He_ratio |
324 | 324 |
325 clrf hi ; # of gas (0-4) | 325 setf hi ; # of gas (0-4) |
326 ; Gas0 is Start gas, do not copy | |
327 | 326 |
328 lfsr FSR1, char_I_deco_He_ratio5 ; most shallow decogas | 327 lfsr FSR1, char_I_deco_He_ratio5 ; most shallow decogas |
329 divemode_check_decogases2: | 328 divemode_check_decogases2: |
330 incf hi,F ; increase | 329 incf hi,F ; increase (First time: hi=0) |
331 rcall copy_decogas_info | 330 rcall copy_decogas_info |
332 movlw d'4' | 331 movlw d'3' |
333 cpfseq hi ; 4 Gases copied? | 332 cpfseq hi ; Gases 0-3 copied? |
334 bra divemode_check_decogases2 ; No, Continue | 333 bra divemode_check_decogases2 ; No, Continue |
334 | |
335 read_int_eeprom d'23' ; Read He ratio | |
336 movff EEDATA,char_I_deco_He_ratio ; And copy into hold register | |
337 | |
338 read_int_eeprom d'22' ; Read O2 ratio | |
339 movff char_I_deco_He_ratio, wait_temp ; copy into bank1 register | |
340 bsf STATUS,C ; | |
341 movlw d'100' ; 100% | |
342 subfwb wait_temp,W ; minus He | |
343 subfwb EEDATA,F ; minus O2 | |
344 movff EEDATA, char_I_deco_N2_ratio; = N2! | |
335 | 345 |
336 ; Now, set change depth. Inactive gases get depth=0! | 346 ; Now, set change depth. Inactive gases get depth=0! |
337 | 347 |
338 read_int_eeprom d'27' ; read flag register | 348 read_int_eeprom d'27' ; read flag register |
339 movff EEDATA,hi ; temp | 349 movff EEDATA,hi ; temp |
340 | 350 |
351 read_int_eeprom d'28' ; read gas_change_depth Gas1 | |
352 movlw d'0' | |
353 btfsc hi,0 ; Skip if clear -> Skip if inactive | |
354 movf EEDATA,W | |
355 movff WREG,char_I_deco_gas_change5 | |
356 | |
341 read_int_eeprom d'29' ; read gas_change_depth Gas2 | 357 read_int_eeprom d'29' ; read gas_change_depth Gas2 |
342 movlw d'0' | 358 movlw d'0' |
343 btfsc hi,1 ; Skip if clear -> Skip if inactive | 359 btfsc hi,1 ; Skip if clear -> Skip if inactive |
344 movf EEDATA,W | 360 movf EEDATA,W |
345 movff WREG,char_I_deco_gas_change5 | 361 movff WREG,char_I_deco_gas_change4 |
346 | 362 |
347 read_int_eeprom d'30' ; read gas_change_depth Gas3 | 363 read_int_eeprom d'30' ; read gas_change_depth Gas3 |
348 movlw d'0' | 364 movlw d'0' |
349 btfsc hi,2 ; Skip if clear -> Skip if inactive | 365 btfsc hi,2 ; Skip if clear -> Skip if inactive |
350 movf EEDATA,W | 366 movf EEDATA,W |
351 movff WREG,char_I_deco_gas_change4 | 367 movff WREG,char_I_deco_gas_change3 |
352 | 368 |
353 read_int_eeprom d'31' ; read gas_change_depth Gas4 | 369 read_int_eeprom d'31' ; read gas_change_depth Gas4 |
354 movlw d'0' | 370 movlw d'0' |
355 btfsc hi,3 ; Skip if clear -> Skip if inactive | 371 btfsc hi,3 ; Skip if clear -> Skip if inactive |
356 movf EEDATA,W | 372 movf EEDATA,W |
357 movff WREG,char_I_deco_gas_change3 | 373 movff WREG,char_I_deco_gas_change2 |
358 | 374 |
359 read_int_eeprom d'32' ; read gas_change_depth Gas5 | 375 read_int_eeprom d'32' ; read gas_change_depth Gas5 |
360 movlw d'0' | 376 movlw d'0' |
361 btfsc hi,4 ; Skip if clear -> Skip if inactive | 377 btfsc hi,4 ; Skip if clear -> Skip if inactive |
362 movf EEDATA,W | 378 movf EEDATA,W |
363 movff WREG,char_I_deco_gas_change2 | 379 movff WREG,char_I_deco_gas_change |
364 | 380 |
365 ; Debugger | 381 ; Debugger |
366 call enable_rs232 | 382 ;call enable_rs232 |
367 movff char_I_deco_He_ratio5,TXREG | 383 ; movff char_I_deco_He_ratio5,TXREG |
368 call rs232_wait_tx ; wait for UART | 384 ; call rs232_wait_tx ; wait for UART |
369 movff char_I_deco_N2_ratio5,TXREG | 385 ; movff char_I_deco_N2_ratio5,TXREG |
370 call rs232_wait_tx ; wait for UART | 386 ; call rs232_wait_tx ; wait for UART |
371 movff char_I_deco_He_ratio4,TXREG | 387 ; movff char_I_deco_He_ratio4,TXREG |
372 call rs232_wait_tx ; wait for UART | 388 ; call rs232_wait_tx ; wait for UART |
373 movff char_I_deco_N2_ratio4,TXREG | 389 ; movff char_I_deco_N2_ratio4,TXREG |
374 call rs232_wait_tx ; wait for UART | 390 ; call rs232_wait_tx ; wait for UART |
375 movff char_I_deco_He_ratio3,TXREG | 391 ; movff char_I_deco_He_ratio3,TXREG |
376 call rs232_wait_tx ; wait for UART | 392 ; call rs232_wait_tx ; wait for UART |
377 movff char_I_deco_N2_ratio3,TXREG | 393 ; movff char_I_deco_N2_ratio3,TXREG |
378 call rs232_wait_tx ; wait for UART | 394 ; call rs232_wait_tx ; wait for UART |
379 movff char_I_deco_He_ratio2,TXREG | 395 ; movff char_I_deco_He_ratio2,TXREG |
380 call rs232_wait_tx ; wait for UART | 396 ; call rs232_wait_tx ; wait for UART |
381 movff char_I_deco_N2_ratio2,TXREG | 397 ; movff char_I_deco_N2_ratio2,TXREG |
382 call rs232_wait_tx ; wait for UART | 398 ; call rs232_wait_tx ; wait for UART |
383 movff char_I_deco_gas_change5,TXREG | 399 ; movff char_I_deco_He_ratio,TXREG |
384 call rs232_wait_tx ; wait for UART | 400 ; call rs232_wait_tx ; wait for UART |
385 movff char_I_deco_gas_change4,TXREG | 401 ; movff char_I_deco_N2_ratio,TXREG |
386 call rs232_wait_tx ; wait for UART | 402 ; call rs232_wait_tx ; wait for UART |
387 movff char_I_deco_gas_change3,TXREG | 403 ; movff char_I_deco_gas_change5,TXREG |
388 call rs232_wait_tx ; wait for UART | 404 ; call rs232_wait_tx ; wait for UART |
389 movff char_I_deco_gas_change2,TXREG | 405 ; movff char_I_deco_gas_change4,TXREG |
390 call rs232_wait_tx ; wait for UART | 406 ; call rs232_wait_tx ; wait for UART |
391 | 407 ; movff char_I_deco_gas_change3,TXREG |
408 ; call rs232_wait_tx ; wait for UART | |
409 ; movff char_I_deco_gas_change2,TXREG | |
410 ; call rs232_wait_tx ; wait for UART | |
411 ; movff char_I_deco_gas_change,TXREG | |
412 ; call rs232_wait_tx ; wait for UART | |
392 return | 413 return |
393 | 414 |
394 copy_decogas_info: | 415 copy_decogas_info: |
395 movf hi,W ; Gas 1-4 | 416 movf hi,W ; Gas 1-4 |
396 mullw d'4' ; times 4... | 417 mullw d'4' ; times 4... |
420 clrf lo | 441 clrf lo |
421 movff lo,char_I_deco_gas_change5 | 442 movff lo,char_I_deco_gas_change5 |
422 movff lo,char_I_deco_gas_change4 | 443 movff lo,char_I_deco_gas_change4 |
423 movff lo,char_I_deco_gas_change3 | 444 movff lo,char_I_deco_gas_change3 |
424 movff lo,char_I_deco_gas_change2 | 445 movff lo,char_I_deco_gas_change2 |
425 ; movff lo, char_I_deco_gas_change ; clear | 446 movff lo, char_I_deco_gas_change ; clear |
426 ; movff lo, char_I_deco_N2_ratio ; clear | 447 ; movff lo, char_I_deco_N2_ratio ; clear |
427 ; movff lo, char_I_deco_He_ratio ; clear | 448 ; movff lo, char_I_deco_He_ratio ; clear |
428 ;call PLED_gaschange_DEBUG | 449 ;call PLED_gaschange_DEBUG |
429 return | 450 return |
430 | 451 |