diff code_part1/OSTC_code_asm_part1/interface.asm @ 350:7250ca7c8d24 64kByte Logbook

64kByte logbook (Still incompatible to existing PC software)
author heinrichsweikamp
date Tue, 31 May 2011 19:43:29 +0200
parents 85ea09d3b9d8
children 5c186a72cb5d
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/interface.asm	Mon May 30 19:28:59 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/interface.asm	Tue May 31 19:43:29 2011 +0200
@@ -219,7 +219,59 @@
 menu_interface4:
 	bsf			SSPCON2, PEN				; Stop
 	call		WaitMSSP	
+
+
+	clrf		uart1_temp					; low address counter
+	clrf		uart2_temp					; high address counter
+
+menu_interface5:		;Send another 32kB from Block2....
+	bsf		SSPCON2,SEN					; Start condition
+	call		WaitMSSP
+
+	movlw		b'10101110'					; Bit0=0: WRITE, Bit0=1: READ
+	movwf		SSPBUF					; control byte
+	call		WaitMSSP	
+	btfsc		SSPCON2,ACKSTAT
+	bra		menu_interface5				; No Ack, try again!
 	
+	movff		eeprom_address+1,SSPBUF			; High Address byte
+	call		WaitMSSP	
+	call		I2C_WaitforACK
+	movff		eeprom_address+0,SSPBUF			; Low Address byte
+	call		WaitMSSP	
+	call		I2C_WaitforACK
+	bsf		SSPCON2,RSEN				; Start condition
+	call		WaitMSSP
+
+	movlw		b'10101111'					; Bit0=0: WRITE, Bit0=1: READ
+	movwf		SSPBUF					; control byte
+	call		WaitMSSP	
+	call		I2C_WaitforACK
+
+menu_interface6:
+	call		rs232_wait_tx				; wait for UART
+
+	bsf			SSPCON2, RCEN				; Enable recieve mode
+	call		WaitMSSP	
+
+	movff		SSPBUF, TXREG
+
+	movlw		d'1'
+	addwf		uart1_temp,F
+	movlw		d'0'
+	addwfc		uart2_temp,F
+
+	btfsc		uart2_temp,7				; 32KB done?
+	bra			menu_interface7				; Yes
+	
+	bsf			SSPCON2, ACKEN				; Ack
+	call		WaitMSSP	
+	bra			menu_interface6				; go on
+
+menu_interface7:
+	bsf			SSPCON2, PEN				; Stop
+	call		WaitMSSP	
+
 	DISPLAYTEXT	.20						; Done.
 
 	WAITMS	d'250'