PIC USART Problems

Thread Starter

crazyengineer

Joined Dec 29, 2010
156
Hello everyone. I'm trying to write hello world to a serial program. However, when I ran the following code

Rich (BB code):
#include <p18F2420.h>
#include <delays.h>
#include <usart.h>
#pragma config OSC = INTIO67
#pragma config WDT = OFF
#pragma config PBADEN = OFF
#pragma config LVP = OFF 




void main()
{
	TRISC=0x00;
	OpenUSART(USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE &USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_HIGH, 51);
	while(1)
	{
		while(BusyUSART());
		putrsUSART("Hello");
 	}

}


Keep in mid I'm using the internal osc of the PIC18F2420.
I see nothing displayed in the serial program, but the cursor moves
 

MrChips

Joined Oct 2, 2009
19,273
Have you made certain that the two baud rates are the same?
Try using an external xtal instead of the internal oscillator.
 

Thread Starter

crazyengineer

Joined Dec 29, 2010
156
Works perfectly now. Just the confusion of the internal clock was messing me up. I switched to an external 20MHZ clock the whole thing works marvelously!
 
Last edited:
Top