Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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: 136
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top