Searching \ for '[PIC]: USART first (dummy) byte problem' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=usart
Search entire site for: 'USART first (dummy) byte problem'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: USART first (dummy) byte problem'
2000\07\21@120118 by John Gerthoffer

flavicon
face
Hello all,

I am using a 16F873 and have a working interrupt driven asynchronous 1/2
duplex USART with one problem.  I preload the TXREG with FFh as a dummy
character.  When TXEN is set and the PIC transmits the FFh, I get an error
in the receiving device.  It appears on the scope as if the baud rate
changes during the transmission of the first character.

I have used a W9x app to receive the dummy char as well as another embedded
(HC12) product.  I have loaded TXSTA with a literal word as well as set bits
individually as shown below with no difference.

Has anyone seen this situation before?


;TXREG preloaded with FFh

init_serial:
       BSF     STATUS, RP0     ;Select bank 1

       ;Using XTAL of 10.0000 MHz, BRGH=1:
       movlw   Baud38400       ;Select baud rate
       movwf   SPBRG           ;       /
       BSF     TXSTA,BRGH      ;High speed

       BSF     RCSTA,SPEN      ;Serial port enable

       BSF     STATUS, RP0     ;Select bank 1
       BSF     PIE1,RCIE       ;Enable receive interrupt

       BCF     STATUS, RP0     ;Select bank 0
       BSF     RCSTA,CREN      ;Enable Continuous Receiving

       BSF     STATUS, RP0     ;Select bank 1
       BSF     TXSTA,TXEN      ;enable transmit in serial port



John Gerthoffer
Software Engineer
American Auto-Matrix, Inc.
Smart Building Solutions
724/733-2000 x342

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\07\23@171505 by Tony Nixon

flavicon
picon face
John Gerthoffer wrote:
>
> Hello all,
>
> I am using a 16F873 and have a working interrupt driven asynchronous 1/2
> duplex USART with one problem.  I preload the TXREG with FFh as a dummy
> character.  When TXEN is set and the PIC transmits the FFh, I get an error
> in the receiving device.  It appears on the scope as if the baud rate
> changes during the transmission of the first character.

I don't know if this is the case in your code but...

Don't try enabling the serial port and immediately send a byte when
powering up the chip. I have had many errors if it is done this way.

Try placing a small power up delay loop in your code before and after
enabling the serial port. Sometimes it takes a little while for the port
pins to stabilise.


--
Best regards

Tony

ICmicro's
http://www.picnpoke.com
spam_OUTsalesTakeThisOuTspampicnpoke.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...