please dont rip this site

PIC RS232 routine

Sameer Sathe of sameerksathe shares this code:

This is the code to actually enter the code into mcu via USART , it will only accept the code unless & until u only press capital 'S'. Without using any Interrupt , its a poleing type code

;--------------------------------------------------------------------------------------		
USART_REC

		BANKSEL PIR1
		btfss	PIR1,RCIF				; Test for received data flag
		GOTO USART_REC_returns
		BTFSC RCSTA,OERR
		goto overerror                   ; check for over run error
		BTFSC RCSTA,FERR
		GOTO frameerror                  ; CHECK FOR FRAMING ERROR
		movf	RCREG,W					; Store data in W
		MOVWF	HAULT_KEY
	    goto HAULT_DECIDE
	

overerror
	bcf	rcsta,cren	;pulse cren off...
	movf	rcreg,w		;flush fifo
	movf	rcreg,w		; all three elements.
	movf	rcreg,w
	bsf	rcsta,cren	;turn cren back on.
					;this pulsing of cren
					;will clear the oerr flag.
					;enable interrupts.
	goto	USART_REC		;try again...	

frameerror
	movf	rcreg,w		;reading rcreg clears ferr flag.
	bsf	intcon,gie	;enable interrupts.
	goto	USART_REC		;try again...	
		
		
;--------------------------------------------------------------------------------------------
HAULT_DECIDE                        ; CHECK IF THE KEY PRESSED ID 'S' OR RESUME NORMAL SEND DATA FUNCTION
	MOVLW 0X53   ; capital S
	SUBWF HAULT_KEY
	BTFSS STATUS,C
	goto USART_REC_returns
	BTFSS STATUS,Z
	goto USART_REC_returns
	continue to key enter routine
+
file: /Techref/microchip/serial-sameer.htm, 1KB, , updated: 2016/11/15 11:17, local time: 2024/11/25 17:43,
TOP NEW HELP FIND: 
3.21.21.209:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://techref.massmind.org/Techref/microchip/serial-sameer.htm"> PIC RS232 routine</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to techref.massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .