USART Transmit Issue

Hi All,

I am facing an issue with the USART Transmit. My code is as show below......

#include #include void main( void ) { char group[10]="Microchip "; int i; OpenUSART( USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_HIGH,

129 ); while( 1 ) { for(i=0; i
Reply to
elamaranv
Loading thread data ...

Perhaps the UART TxD pin was not in an idle condition before it got enabled ?

If so, the first character would not have a clear start bit, and would be garbled in the receiver.

Try adding a delay (e.g. 10 bit times) between enabling the UART and sending the first data.

Reply to
Arlet

You might want to try a delay between initialising the USART and starting to write to it. The fact that it is outputting the string correctly after the first character suggests that the busyUART() wait is working correctly.

TW

Reply to
Ted

As pointed by Arlet that you got to provide a decent time for initialization. And another quick fix would be adding/sending a dummy single char that will do the initialization for sure.

ali

Reply to
Ali

Will it need such a time between initalizing and starting to write ? Strange :(:( What could be the possible reasons ? Any ideas ?

Accepted .

Karthik Balaguru

Reply to
karthikbalaguru

Well, at a guess the USART HW is being clocked much slower than the processor clock, and may take a while to initialise. So you need to wait for it.

TW

Reply to
Ted

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.