# Nothing seen on hyperterminal

I am using a PIC16F877A and am reading its ADC value and sending it to the serial port. I am blinking an LED with it so that I can determine whether or not the program is stuck. Unfortunately, I cannot see any data on the port via Hyperterminal. However, if I test my code in Proteus, I see data on the virtual terminal. I know the hardware is designed correctly because it is a commercial testing kit.

I think there is a problem with the crystal settings.

I have also confirmed that the cable is working, because I use the same one for my programmer and this hardware. I am using the Mikro C pic compiler, with the frequency set to 4MHz. I tried to edit my project and set the oscillator to HS as well as XT, but the results are the same. What is wrong?

char text[7];

void main() {

UART1_Init(9600);               // Initialize UART module at 9600 bps
Delay_ms(100);                  // Wait for UART module to stabilize

TRISA = 0xFF;               // PORTA is input
TRISC  = 0;                 // PORTC is output
TRISB  = 0;                 // PORTB is output

PORTB = 0;
UART1_Write_Text("Start");

Delay_ms(100);
do
{
PORTB.B3 = ~PORTB.B3;

UART1_Write(10);
UART1_Write(0x90);
UART1_Write_Text(text);
UART1_Write_Text("\r\n");
Delay_us(200);
// PORTB = adc_value;         // Send lower 8 bits to PORTB
PORTC = adc_value >> 8;    // Send 2 most significant bits to RC1, RC0

Delay_ms(100);
} while(1);
}

• What kind of oscillator is in use? Is it the internal oscillator, or an external crystal or what? – Majenko Jun 21 '11 at 20:34
• I suggest you get an oscilloscope trace to check clock error, actual sending of data, logic levels, polarity, etc. Your code looks fine to a cursory reading. Also, move the PORTB.B3 = ~PORTB.B3; to the very end of the while loop so you know your code isn't merely resetting your processor to blink the LED. – Kevin Vermeer Jun 21 '11 at 21:05