diff code_part1/OSTC_code_asm_part1/ms5535.asm @ 469:f53aa96ff2f4

SPI for sensor in 32MHz
author heinrichsweikamp
date Thu, 06 Oct 2011 23:30:47 +0200
parents 2144f19fa1eb
children 422b9eeace4f
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/ms5535.asm	Mon Oct 03 09:38:20 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/ms5535.asm	Thu Oct 06 23:30:47 2011 +0200
@@ -430,8 +430,8 @@
 	nop
 	nop
 	nop
-	nop
-	nop
+	btfsc	OSCCON,4			; 32MHz Mode?
+	rcall	MS5535A_extra_wait	; Yes
 	bcf		sensor_CLK	
 	return	
 
@@ -443,11 +443,19 @@
 	nop
 	nop
 	nop
-	nop
-	nop
+	btfsc	OSCCON,4			; 32MHz Mode?
+	rcall	MS5535A_extra_wait	; Yes
 	bcf		sensor_CLK	
 	return	
 
+MS5535A_extra_wait:
+	nop
+	nop
+	nop
+	nop
+	nop
+	return
+	
 reset_MS5535A:
 	rcall	reset_MS5535A_one			;0
 	rcall	reset_MS5535A_zero
@@ -487,8 +495,8 @@
 	nop
 	nop
 	nop
-	nop
-	nop
+	btfsc	OSCCON,4			; 32MHz Mode?
+	rcall	MS5535A_extra_wait	; Yes
 	bcf		sensor_CLK	
 	return
 
@@ -498,8 +506,8 @@
 	nop
 	nop
 	nop
-	nop
-	nop
+	btfsc	OSCCON,4			; 32MHz Mode?
+	rcall	MS5535A_extra_wait	; Yes
 	bcf		sensor_CLK	
 	btfss	sensor_SDI	;MSB first
 	bcf		STATUS,C
@@ -521,39 +529,39 @@
 	nop
 	nop
 	nop
-	nop
-	nop
+	btfsc	OSCCON,4			; 32MHz Mode?
+	rcall	MS5535A_extra_wait	; Yes
 	bcf		sensor_CLK	
 	nop
 	nop
 	nop
 	nop
-	nop
-	nop
+	btfsc	OSCCON,4			; 32MHz Mode?
+	rcall	MS5535A_extra_wait	; Yes
 	bsf		sensor_CLK	
 	nop
 	nop
 	nop
 	nop
-	nop
-	nop
+	btfsc	OSCCON,4			; 32MHz Mode?
+	rcall	MS5535A_extra_wait	; Yes
 	bcf		sensor_CLK	
 	nop
 	nop
 	nop
 	nop
-	nop
-	nop
+	btfsc	OSCCON,4			; 32MHz Mode?
+	rcall	MS5535A_extra_wait	; Yes
 	bsf		sensor_CLK	
 	nop
 	nop
 	nop
 	nop
-	nop
-	nop
+	btfsc	OSCCON,4			; 32MHz Mode?
+	rcall	MS5535A_extra_wait	; Yes
 	bcf		sensor_CLK	
 	; now send 8 bytes from isr_temp1 and fill-up with zeros
-datenbits:
+databits:
 	btfss	isr1_temp,7	;MSB first
 	bcf		sensor_SDO
 	btfsc	isr1_temp,7	;MSB first
@@ -566,10 +574,10 @@
 	nop
 	nop
 	nop
-	nop
-	nop
+	btfsc	OSCCON,4			; 32MHz Mode?
+	rcall	MS5535A_extra_wait	; Yes
 	bcf		sensor_CLK	
 
 	decfsz	clock_count,F
-	bra		datenbits
+	bra		databits
 	return