changeset 465:915e0d38edec

Merge with 2.01stable
author heinrichsweikamp
date Sun, 02 Oct 2011 17:54:30 +0200
parents 86fc79735d3b (current diff) 6ad9af3a5771 (diff)
children 67d908f51e80
files code_part1/OSTC_code_asm_part1/definitions.asm code_part1/OSTC_code_asm_part1/start.asm
diffstat 2 files changed, 41 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/menu_reset.asm	Tue Sep 27 22:23:12 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm	Sun Oct 02 17:54:30 2011 +0200
@@ -324,23 +324,7 @@
 	bcf			nofly_active                	; Clear flag
 
 ; reset gases
-	clrf	EEADRH					; EEPROM BANK 0 !
-
-	movlw	d'3'					; address of first gas-1
-	movwf	EEADR
-	clrf	hi						; He part (default for all gases: 0%)
-	movlw	d'21'					; O2 part (21%)
-	rcall	reset_gas               ; saves default and current value for gas #1
-	movlw	d'21'					; O2 part (21%)
-	rcall	reset_gas               ; saves default and current value for gas #2
-	movlw	d'21'					; O2 part (21%)
-	rcall	reset_gas               ; saves default and current value for gas #3
-	movlw	d'21'					; O2 part (21%)
-	rcall	reset_gas               ; saves default and current value for gas #4
-	movlw	d'21'					; O2 part (21%)
-	rcall	reset_gas               ; saves default and current value for gas #5
-	movlw	d'21'					; O2 part (21%)
-	rcall	reset_gas               ; saves default and current value for gas #6
+	rcall	reset_gases
 
 reset_all_cf:
 	movlw	d'1'
@@ -434,14 +418,44 @@
 ;call	reset_external_eeprom	; delete profile memory
 	goto	restart					; all reset, quit to surfmode
 
+reset_gases:
+	clrf	EEADRH					; EEPROM BANK 0 !
+
+	movlw	d'3'					; address of first gas-1
+	movwf	EEADR
+	clrf	hi						; He part (default for all gases: 0%)
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves current value for gas #1
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves default value for gas #1
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves current value for gas #2
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves default value for gas #2
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves current value for gas #3
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves default value for gas #3
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves current value for gas #4
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves default value for gas #4
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves current value for gas #5
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves default value for gas #5
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves current value for gas #6
+	return
+
 ; Write WREG:lo twice, w/o any type clearing, pre-incrementing EEADR
 reset_gas:
     movwf   lo
 	incf	EEADR,F
-	movff	lo, EEDATA				; Lowbyte Default value
+	movff	lo, EEDATA				; O2 Default value
 	call	write_eeprom
 	incf	EEADR,F
-	movff	hi, EEDATA				; Highbyte default value
+	movff	hi, EEDATA				; He default value
 	call    write_eeprom
 	return
 
--- a/code_part1/OSTC_code_asm_part1/start.asm	Tue Sep 27 22:23:12 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/start.asm	Sun Oct 02 17:54:30 2011 +0200
@@ -142,6 +142,9 @@
 	write_int_eeprom	d'193'
 	write_int_eeprom	d'194'		; Reset Default and Current Value to zero
 	clrf	EEADRH
+
+; reset gases (Bug in 2.0 stable)
+	call	reset_gases
 ;	goto	reset_all_cf			; resets all custom functions bank0 and bank1 and jumps to "restart"
 			
 restart:
@@ -395,8 +398,9 @@
 	bra		start3					; continue with normal start
 
 init:						
-	movlw	OSCCON_VALUE
+	movlw	b'01101100'		; 4MHz (x4 PLL)
 	movwf	OSCCON
+
 	movlw	b'00010001'		; I/O Ports
 	movwf	TRISA
 	clrf	PORTA
@@ -416,7 +420,7 @@
 	movlw	b'01000000'		; Bit6: PPL enable
 	movwf	OSCTUNE
 
-	movlw	T0CON_VALUE		; Timer0
+	movlw	b'00011111'		; Timer0
 	movwf	T0CON
 
 	movlw	b'00000111'		; Timer1
@@ -448,8 +452,7 @@
 	movwf	SSPCON1
 	movlw	b'00000000'
 	movwf	SSPCON2
-
-	movlw	SSPADD_VALUE	; I²C Speed
+	movlw	d'8'			; 400kHz I2C clock @ 16MHz Fcy
 	movwf	SSPADD
 
 	clrf	CCP1CON			; PWM Module off
@@ -468,8 +471,7 @@
 	movlw	b'00001000'
 	movwf	BAUDCON
 	clrf	SPBRGH
-
-	movlw	SPBRG_VALUE
+	movlw	d'34'
 	movwf	SPBRG
 	clrf	RCREG
 	clrf	PIR1