Hello everyone. I'm having difficulty trying to get the PIC18F2420 to receive the messages that I send it using the Arduino terminal. I can get the PIC to send messages to the terminal fine, but it seems like it cannot receive anything.
The above code should just print hello and the character you type in the display. However, whenever I type the message, I don't even see the message.
Rich (BB code):
/* Includes */
#include <p18F2420.h>
#include <delays.h>
#include <portb.h>
#include <usart.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/* PIC Configuratings */
#pragma config OSC = HS
#pragma config WDT = OFF
#pragma config PBADEN = OFF
#pragma config LVP = OFF
#pragma config PWRT = ON
#pragma config DEBUG= OFF
//#pragma config BOREN = OFF
char data;
char message[100];
void main(void)
{
OpenUSART(USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE &USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_HIGH, 10);
while(1)
{
if(DataRdyUSART())
{
data=ReadUSART();
sprintf(message,"Hello %c \r\n",data);
putsUSART(message);
while(BusyUSART());
}
}
CloseUSART();
}