I am trying to make a PIC (18f4550) talk to a PC via hyperterminal. I can get data to the PC no problem, but when i try to receive data at the PIC from the PC. i get nothing. Here is my code.
#include <p18f4550.h>
#include <delays.h>
#include <stdlib.h>
#include <timers.h>
#include <usart.h>
#pragma config USBDIV = 2
#pragma config FOSC = HS //PLL_HS
#pragma config FCMEN = OFF
#pragma config IESO = OFF
#pragma config PWRT = OFF // PWRT enabled
#pragma config BOR = OFF // disabled
#pragma config BORV = 3
#pragma config VREGEN = ON
#pragma config WDT = OFF // WDT disabled
#pragma config MCLRE = OFF // disabled
#pragma config LPT1OSC = OFF
#pragma config PBADEN = OFF
#pragma config CCP2MX = OFF
#pragma config LVP = OFF // LVP disabled
#pragma config DEBUG = OFF // disabled
#define LEDPin LATBbits.LATB0
#define LEDTris TRISBbits.TRISB0
void main(void)
{
char ch;
TRISC = 0b11000000;
OpenUSART( USART_TX_INT_OFF &
USART_RX_INT_OFF &
USART_ASYNCH_MODE &
USART_EIGHT_BIT &
USART_CONT_RX &
USART_BRGH_HIGH,
64 );
putrsUSART((const far rom char *)"NBLY");
while(1)
{
while(!DataRdyUSART());
ch = ReadUSART();
putcUSART(ch);
}
}
The idea is to get a char from the USART, the redisplay it. I've serached everywhere, and have tried most if not all the suggestions (clear the overrun flag, different clock speeds etc...) It almost seems like the real problem is my terminal program in that it's not sendind the characters.
any help some one can provide would be greatly appreciated.
thanks!
#include <p18f4550.h>
#include <delays.h>
#include <stdlib.h>
#include <timers.h>
#include <usart.h>
#pragma config USBDIV = 2
#pragma config FOSC = HS //PLL_HS
#pragma config FCMEN = OFF
#pragma config IESO = OFF
#pragma config PWRT = OFF // PWRT enabled
#pragma config BOR = OFF // disabled
#pragma config BORV = 3
#pragma config VREGEN = ON
#pragma config WDT = OFF // WDT disabled
#pragma config MCLRE = OFF // disabled
#pragma config LPT1OSC = OFF
#pragma config PBADEN = OFF
#pragma config CCP2MX = OFF
#pragma config LVP = OFF // LVP disabled
#pragma config DEBUG = OFF // disabled
#define LEDPin LATBbits.LATB0
#define LEDTris TRISBbits.TRISB0
void main(void)
{
char ch;
TRISC = 0b11000000;
OpenUSART( USART_TX_INT_OFF &
USART_RX_INT_OFF &
USART_ASYNCH_MODE &
USART_EIGHT_BIT &
USART_CONT_RX &
USART_BRGH_HIGH,
64 );
putrsUSART((const far rom char *)"NBLY");
while(1)
{
while(!DataRdyUSART());
ch = ReadUSART();
putcUSART(ch);
}
}
The idea is to get a char from the USART, the redisplay it. I've serached everywhere, and have tried most if not all the suggestions (clear the overrun flag, different clock speeds etc...) It almost seems like the real problem is my terminal program in that it's not sendind the characters.
any help some one can provide would be greatly appreciated.
thanks!
Last edited: