USART Transmit Issue

Started by Maran November 28, 2007
Hi All,

I am facing an issue with the USART Transmit. My code is as shown
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<10; i++)
{
while (BusyUSART());
putcUSART(group [ i ] );
}
}
CloseUSART( );
}

The above program gets compiled successfully.

But the result is as follows when checked in the Hyperterminal.......

icrochip Microchip Microchip Microchip Microchip Microchip Microchip
Microchip Microchip

The first character 'M' doesn't gets transmitted on to the
Hyperterminal, but in the rest of the sequence the word 'Microchip '
gets transmitted fine.

Any idea why the first character 'M' doesn't get transmitted on to the
hyperterminal?

I am using the MPLAB version 8, C18 compiler Version 3.14, PIC18F4523
Microcontroller.

I gave approx 3 seconds of delay before transmitting.
It sounds like a power up problem.

It could be the transmit pin is at a zero before the first byte is sent
causing a recieve error at the PC.

Might be worth putting a pullup on the TX pin.
I hit this problem as well. My problem turned out to be that I had not disabled
the watchdog timer feature. The ASCII sequence would start up fine, then go to
gibberish and start over.

The watchdog was timing out and resetting the processor over and over. I didn't
see it right away and wasted a lot of time on debugging.

I disabled the WDT in the config registers and the chip happily sent the ASCII
sequence to my terminal session at 9600 baud with no problems at all.

Mike Harpe, N4PLE
Sellersburg, IN
I'm a little confused and haven't looked thru all this message tree.
Is there a reason the watchdog timer interferes with the USART chip.
We're using a 18F2685 in our project, we will use sleep mode, and low
voltage reset.
Don't think we need the watchdog timer... , but I do seem to
remember reading something in the 18F2685 chip manual about a
watchdog timer issue.

Thanks,
;<)
--- In p..., Michael Harpe wrote:
>
> I hit this problem as well. My problem turned out to be that I had
not disabled
> the watchdog timer feature. The ASCII sequence would start up fine,
then go to
> gibberish and start over.
>
> The watchdog was timing out and resetting the processor over and
over. I didn't
> see it right away and wasted a lot of time on debugging.
>
> I disabled the WDT in the config registers and the chip happily
sent the ASCII
> sequence to my terminal session at 9600 baud with no problems at
all.
>
> Mike Harpe, N4PLE
> Sellersburg, IN
>