Reply
Posts: 13
Registered: ‎05-05-2017
Accepted Solution

C8051F996 UART problem about UART consecutive transmission.

Hi I used UART interrupt function to send a byte data. But UART port always consecutive transmit data. I can not stop this transmission. my ISR code as follow if(TI0==1){ TI0 = 0; SBUF0 = Byte; TX_Ready=1; } . How come the UART transmission did not stop .
Posts: 2,312
Registered: ‎10-14-2014

Re: C8051F996 UART problem about UART consecutive transmission.

@KevinHK

Do you have a chance to have a look at the example provided by Silabs?

If you install Silicon labs IDE you could get the example code in folder:

C:\SiLabs\MCU\Examples\C8051F96x\UART

For Simplicity Studio you could get the example like below folder:

C:\SiliconLabs\SimplicityStudio\v4\developer\sdks\8051\v4.0.3\examples\C8051F996DK\UART

WeiguoLu
Posts: 13
Registered: ‎05-05-2017

Re: C8051F996 UART problem about UART consecutive transmission.

Hi I refer to a example C:\SiLabs\MCU\Examples\C8051F99x_98x\UART F99x_UART0_Interrupt.C I see my SFR SCON0 = 54. but UART port did not stop.
Posts: 8,134
Registered: ‎08-13-2003

Re: C8051F996 UART problem about UART consecutive transmission.

what does TX_Ready=1 do?

erik
Posts: 13
Registered: ‎05-05-2017

Re: C8051F996 UART problem about UART consecutive transmission.

Hi 

 Tx_Ready  indicate transmission complete.

Posts: 8,134
Registered: ‎08-13-2003

Re: C8051F996 UART problem about UART consecutive transmission.

I could figure that out.  what does it do elsewhere?

erik
Posts: 13
Registered: ‎05-05-2017

Re: C8051F996 UART problem about UART consecutive transmission.

I will check Tx_Ready that  indicated UART transmit complete in main loop .

Posts: 332
Registered: ‎09-22-2009

Re: C8051F996 UART problem about UART consecutive transmission.

Take a closer look at the Silabs example code interrupt. You are going to get another interrupt after the transfer is complete. So when TI = 1, your interrupt has to keep track of whether or not to load more data into SBUF0 or set TX_Ready. You should not do both of those things in the same iteration of the interrupt since TX isn't ready if you just loaded data into SBUF0. 

Highlighted
Posts: 11
Registered: ‎08-28-2017

Re: C8051F996 UART problem about UART consecutive transmission.

my ISR code as follow if(TI0==1){ TI0 = 0; SBUF0 = Byte; TX_Ready=1; }

 

Once transfer complete, the again interrupt generated and calls your ISR - checks your TI0 flag it is set - sends again the byte.

 

if you want to send the only single byte, you could do it other than ISR, or add some additional logic like counter to come out of the recursive ISR