Mercurial > public > mk2
diff code_part1/OSTC_code_asm_part1/tempcomp.asm @ 4:2b5c52ae3923
1.52 beta rc
author | heinrichsweikamp |
---|---|
date | Sun, 14 Feb 2010 20:09:25 +0100 |
parents | 96a35aeda5f2 |
children | cd5b650920f6 |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/tempcomp.asm Thu Feb 04 14:56:12 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/tempcomp.asm Sun Feb 14 20:09:25 2010 +0100 @@ -29,53 +29,49 @@ ; Byte2: high -compensate_temperature: - bcf uart_compensate_temp ; clear flag - bcf PIE1,RCIE ; no interrupt for UART - call set_LEDusb ; LEDusb ON - bcf PIR1,RCIF ; clear flag - - movlw "f" ; send echo - movwf TXREG - call rs232_wait_tx ; wait for UART - - call rs232_get_byte ; low byte - movff RCREG, lo - - call rs232_get_byte ; high byte - movff RCREG, hi - - clrf temperature_correction ; wait for uncompensated temperature value! - WAITMS d'250' ; wait for new temperature - WAITMS d'250' - WAITMS d'250' - WAITMS d'250' - - movff lo,sub_a+0 ; calculate difference - movff hi,sub_a+1 - movff temperature+0, sub_b+0 - movff temperature+1, sub_b+1 - call sub16 ; sub_c = sub_a - sub_b - - movf sub_c+0,W - btfsc neg_flag ; compensate negative? - movlw d'0' ; use zero compensation! - movwf sub_c+0 - - movff sub_c+0,TXREG ; Send answer - - movff sub_c+0,EEDATA ; store low byte only! - movff sub_c+0,temperature_correction ; no reboot required then... - movlw 0x01 - movwf EEADRH - movlw 0x00 - movwf EEADR - call write_eeprom ; stores in internal eeprom - - movlw 0x00 - movwf EEADRH ; reset high address byte - - call clear_LEDusb ; LEDusb OFF - bcf PIR1,RCIF ; clear flag - bsf PIE1,RCIE ; enable interrupt for UART - goto surfloop_loop ; return to surface loop +compensate_temperature: bcf uart_compensate_temp ; clear flag bcf PIE1,RCIE ; no interrupt for UART ; +; call set_LEDusb ; LEDusb ON ; +; bcf PIR1,RCIF ; clear flag ; +; ; +; movlw "f" ; send echo ; +; movwf TXREG ; +; call rs232_wait_tx ; wait for UART ; +; ; +; call rs232_get_byte ; low byte ; +; movff RCREG, lo ; +; ; +; call rs232_get_byte ; high byte ; +; movff RCREG, hi ; +; ; +; clrf temperature_correction ; wait for uncompensated temperature value! ; +; WAITMS d'250' ; wait for new temperature ; +; WAITMS d'250' ; +; WAITMS d'250' ; +; WAITMS d'250' ; +; ; +; movff lo,sub_a+0 ; calculate difference ; +; movff hi,sub_a+1 ; +; movff temperature+0, sub_b+0 ; +; movff temperature+1, sub_b+1 ; +; call sub16 ; sub_c = sub_a - sub_b ; +; ; +; movf sub_c+0,W ; +; btfsc neg_flag ; compensate negative? ; +; movlw d'0' ; use zero compensation! ; +; movwf sub_c+0 ; +; ; +; movff sub_c+0,TXREG ; Send answer ; +; ; +; movff sub_c+0,EEDATA ; store low byte only! ; +; movff sub_c+0,temperature_correction ; no reboot required then... ; +; movlw 0x01 ; +; movwf EEADRH ; +; movlw 0x00 ; +; movwf EEADR ; +; call write_eeprom ; stores in internal eeprom ; +; ; +; movlw 0x00 ; +; movwf EEADRH ; reset high address byte ; +; ; +; call clear_LEDusb ; LEDusb OFF ; +; bcf PIR1,RCIF ; clear flag bsf PIE1,RCIE ; enable interrupt for UART goto surfloop_loop ; return to surface loop