Uart not function as i intended pic16f877a

Status
Not open for further replies.

Glatius

New Member
Intserv movwf tempw
movf status,w;
clrf status
movwf tempstatus
movf pclath,w
movwf tempclath
clrf pclath
movf fsr,w
movwf tempfsr
bank0
btfsc pir1,rcif
bank1
btfss pie1,rcie
goto intexit
bank0 ;receiving
btfsc rcsta,oerr
goto overerr
btfsc rcsta,ferr
goto frameerr
movf rcreg,w
call recept ;input data from rs232
clrf errorflag
goto intexit
overerr bsf errorflag,0
bcf rcsta,cren
bsf rcsta,cren
goto intexit
frameerr
bsf errorflag,1
movf rcreg,w

intexit bank0
movf tempfsr,w
movwf fsr
movf tempclath,w
movwf pclath
movf tempstatus,w
movwf status
swapf tempw,f
swapf tempw,w
retfie
end
 
If you expect anyone to help then you need to post complete code that will assemble. So repost your code with the include and config sections added. Also when posting code type [code] before it and [/code] after it and then it will keep its formating like this,
Code:
Intserv		movwf	tempw
		movf	status,w	;
		clrf	status
		movwf	tempstatus
		movf	pclath,w
		movwf	tempclath
		clrf	pclath
		movf	fsr,w
		movwf	tempfsr
		bank0
		btfsc	pir1,rcif
		bank1
		btfss	pie1,rcie
		goto	intexit
		bank0			;receiving  
		btfsc	rcsta,oerr
		goto	overerr
		btfsc	rcsta,ferr
		goto	frameerr
		movf	rcreg,w
		call	recept		;input data from rs232
		clrf	errorflag
		goto	intexit
overerr		bsf	errorflag,0
		bcf	rcsta,cren
		bsf	rcsta,cren
		goto	intexit
frameerr		 
		bsf	errorflag,1
		movf	rcreg,w

intexit		bank0
		movf	tempfsr,w
		movwf	fsr
		movf	tempclath,w
		movwf	pclath
		movf	tempstatus,w
		movwf	status
		swapf	tempw,f
		swapf	tempw,w
		retfie	 
		end

Mike.
 
Last edited:
is working now my UART maybe the bug

THIS IS THE WHOLE PROGRAM, THE PROGRAM IS FOR A POV LED DISPLAY, WHERE A MOTOR SPINS A ROW OF LEDS to generate images using rs232.
 

Attachments

  • RS.asm
    37.5 KB · Views: 138
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…