changeset 390:a847f416e67e 64kByte Logbook

Debugging timer1
author heinrichsweikamp
date Sun, 19 Jun 2011 14:20:19 +0200
parents a59532d2daf8
children ee5e1c65657c
files code_part1/OSTC_code_asm_part1/isr.asm code_part1/OSTC_code_asm_part1/simulator.asm code_part1/OSTC_code_asm_part1/start.asm
diffstat 3 files changed, 20 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/isr.asm	Sun Jun 19 00:07:35 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/isr.asm	Sun Jun 19 14:20:19 2011 +0200
@@ -181,13 +181,14 @@
 timer1int_debug:
 		bcf		LED_red						; LEDr off (For charge indicator)
 
-		movlw	0x08						; Timer1 int after 62.5ms (=16/second)
-		cpfslt	TMR1H						; Did we miss a 1/16 second?
-		incf	timer1int_counter1,F		; Yes, add extra 1/16 second
+;		movlw	0x08						; Timer1 int after 62.5ms (=16/second)
+;		cpfslt	TMR1H						; Did we miss a 1/16 second?
+;		incf	timer1int_counter1,F		; Yes, add extra 1/16 second
 
-;		movlw	0x10						; Timer1 int after 62.5ms (=16/second)
-;		cpfslt	TMR1H						; Did we miss another 1/16 second?
-;		incf	timer1int_counter1,F		; Yes, add another extra 1/16 second
+		btfsc	TMR1L,0						; Wait for low clock cycle
+		bra		$-2		
+		btfss	TMR1L,0
+		bra		$-2							; max. loop time: 61µs
 
 		movlw	0x08						; Timer1 int after 62.5ms (=16/second)
 		subwf	TMR1H,F			
@@ -399,7 +400,7 @@
 		return
 		clrf		hours
 		incf		day,F
-		movff		time_correction_value,secs			; Correct too slow clock
+;		movff		time_correction_value,secs			; Correct too slow clock
 						
 check_date:
 		movff		month,isr_divB		; new month?
--- a/code_part1/OSTC_code_asm_part1/simulator.asm	Sun Jun 19 00:07:35 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/simulator.asm	Sun Jun 19 14:20:19 2011 +0200
@@ -345,7 +345,7 @@
 	bsf		simulatormode_active        ; normal simulator mode
 	bsf		standalone_simulator        ; Standalone Simulator active
 	bsf		no_sensor_int               ; Disable sensor interrupt
-	clrf	T3CON                       ; Restart time3 counter,
+	clrf	T3CON                       ; Disable timer3 counter,
 	clrf	TMR3L                       ; so the simu won't stop right away.
 	clrf	TMR3H
 
--- a/code_part1/OSTC_code_asm_part1/start.asm	Sun Jun 19 00:07:35 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/start.asm	Sun Jun 19 14:20:19 2011 +0200
@@ -131,6 +131,10 @@
 ;	goto	reset_all_cf			; resets all custom functions bank0 and bank1 and jumps to "restart"
 			
 restart:
+	movlw	b'00000011'
+	movwf	T3CON					; Timer3 with 32768Hz clock running
+	clrf	TMR3L
+	clrf	TMR3H
 	bcf		LED_red
 	bcf		LED_blue				; all LEDs off
 	GETCUSTOM8	d'48'				; time correction value
@@ -177,8 +181,13 @@
 	bsf		high_altitude_mode		; No, Set Flag!
 	
 	; Should we disable sleep (hardware emulator)
-	movlw	.0
-	cpfsgt	EEDATA					; >256
+restart_loop:
+	btfss	0xF81,0,A
+	bra		restart_loop
+	btfss	0xF81,1,A
+	bra		restart_loop
+	movlw	0x80
+	cpfslt	0xFB3,A
 	bsf		nsm						; NO-SLEEP-MODE : for hardware debugging
 
 	call	gassetup_sort_gaslist       ; Sorts Gaslist according to change depth