changeset 284:908d0013727e

115200 baud bootloader tested and debugged
author heinrichsweikamp
date Tue, 19 Apr 2011 21:48:34 +0200
parents 4ec488f046f4
children 8874b6cd8f36
files code_part1/OSTC_code_asm_part1/eeprom_rs232.asm
diffstat 1 files changed, 19 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/eeprom_rs232.asm	Tue Apr 19 19:31:16 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/eeprom_rs232.asm	Tue Apr 19 21:48:34 2011 +0200
@@ -201,18 +201,30 @@
 
 uart_115k_bootloader:
 	bcf		PIE1,RCIE				; disable interrupt for RS232
-	bcf		RCSTA,CREN				; Clear receiver status
-	bsf		RCSTA,CREN
-	bcf		PIR1,RCIF				; clear flag
+;	bcf		PIR1,RCIF				; clear flag
 	call	PLED_ClearScreen		; Clear screen
 	movlw	color_red
     call	PLED_set_color			; Set to Red
 	DISPLAYTEXTH	d'302'			; Bootloader
-	WAITMS	d'250'
+	movlw	d'4'					; one second
+	movwf	uart1_temp
+uart_115k_bootloader0:
+	btfsc	PIR1,RCIF				; New byte in UART?
+	bra		uart_115k_bootloader1	; Yes, Check if 0xC1
 	WAITMS	d'250'
-	WAITMS	d'50'
-	btfss	PIR1,RCIF				; New byte in UART?
-	bra		uart_115k_bootloader2	; No, Abort	
+	decfsz	uart1_temp,F
+	bra		uart_115k_bootloader0
+uart_115k_bootloader2:
+	DISPLAYTEXTH	d'304'			; Aborted!
+	movlw	d'8'					; Two seconds
+	movwf	uart1_temp
+uart_115k_bootloader3:
+	WAITMS	d'250'
+	decfsz	uart1_temp,F
+	bra		uart_115k_bootloader3
+	goto	restart
+	
+uart_115k_bootloader1:
 	movlw	0xC1
 	cpfseq	RCREG					; 115200Baud Bootloader request?
 	bra		uart_115k_bootloader2	; No, Abort	
@@ -220,16 +232,3 @@
 	clrf	INTCON					; Interrupts disabled
 	bcf		PIR1,RCIF				; clear flag
 	goto	0x17F56					; Enter straight into bootloader. Good luck!
-uart_115k_bootloader2:
-	DISPLAYTEXTH	d'304'			; Aborted!
-	WAITMS	d'250'
-	WAITMS	d'250'
-	WAITMS	d'250'
-	WAITMS	d'250'
-	WAITMS	d'250'
-	WAITMS	d'250'
-	WAITMS	d'250'
-	WAITMS	d'250'
-	goto	restart
-	
-	
\ No newline at end of file