Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

uart output problem...

Status
Not open for further replies.
Joined
Feb 22, 2012
Messages
82
Helped
25
Reputation
50
Reaction score
25
Trophy points
1,298
Activity points
0
Hi friends...

i am using pic18f46j11. i am doing serial communication and transmitting HIREN. but output gives noise symbol.
ðððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððð

this symbol is displayed on hercules...

my program is given below...
Code:
#include "p18f46j11.inc"

ORG 0

		
        MOVLW B'00100000' ; 8-BIT ASYNCHRONOUS TX ENABLE.
		MOVWF TXSTA1
		MOVLW D'31'		   ; FOR 9600 BAUD RATE @ 20mhz
		MOVWF SPBRG
    	BCF TRISC,TX1
     	BSF RCSTA1,SPEN
		CLRF TRISD
		CLRF PORTD
L2	    MOVLW A'H'
		MOVWF PORTD
		CALL L1
		MOVLW A'I'
		MOVWF PORTD
		CALL L1
		MOVLW A'R'
		MOVWF PORTD
 		CALL L1
		MOVLW A'E'
		MOVWF PORTD
 		CALL L1
		MOVLW A'N'
		MOVWF PORTD
		CALL L1
 		BRA L2


L1

        BTFSS PIR1,TX1IF
		BRA L1
		MOVWF TXREG1
		RETURN

END



help me to solve this problem...
 

hello,

What is your Configuration bits ?

is TX1 affected to UART function ?
i don't know this Pic, some times Analog input are affected to PortC register by default value

Configuration bits can modifie the clock used by UART
normaly BRGH=0 and SPBRG=31 (or 32) is OK for 20Mhz & 9600 bauds

Your program start from Org=0 and pass trough area reserved for interrup vectors.
Is not a good rule

Org 0
goto Start

Org 0x08
interrupt high vector
..


Org 0x18
;interrupt low vector
....


Start
; begin of program


you are testing TX1IF instead of TRMT ?
in call L1..
but with no interrupt treatment, never RAZ of the flag !
 
hello,

What is your Configuration bits ?

is TX1 affected to UART function ?
i don't know this Pic, some times Analog input are affected to PortC register by default value

Configuration bits can modifie the clock used by UART
normaly BRGH=0 and SPBRG=31 (or 32) is OK for 20Mhz & 9600 bauds

Your program start from Org=0 and pass trough area reserved for interrup vectors.
Is not a good rule

Org 0
goto Start

Org 0x08
interrupt high vector
..


Org 0x18
;interrupt low vector
....


Start
; begin of program


you are testing TX1IF instead of TRMT ?
in call L1..
but with no interrupt treatment, never RAZ of the flag !



Hi....
thanks for your help....

I am using oscillator (hs). and othe parameters off.
yes tx1 affected to uart function.
one fact that my program was working previously but not working now even hardware is ok...
 

hello

because duration of TX1IF is very short ( 1 cycle !) it's difficult to get it by pooling
and you are not using Interrupt !
you better had to test with the TRMT flag of TXSTA1
see figure 19-4 EUSART Asynchronous transmission

this part of code is used in a bootloader program!

Code:
L1 
   btfss TXSTA1,TRMT
   goto $-2
   movwf TXREG1
  return
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top