apexcode
Jun 01, 2009, 12:02 AM
hello all,
i'm able to transmit from PIC TO PC and view text on hyperterm but what i type in Hyperterm is not received at PIC
please help...
what i'm trying to do is ... what i type at hyperterm is sent back to PC from PIC when received at PIC.........
below is the code ive tried.... and ive attached a screen shot too... which shows the o/p as soon as i s/w on PIC...... after that whatver i type in hyperterm nothing happens...
IMG]http://www.microchip.com/forums/upfiles.aspx/55927/9D57F8C2084B49A2B553D697607BA7D8.JPG[/IMG]
code:
void main (void)
{
//char rx[8]="Null\n\r";
char rx1='k';
int key;
//init();
TRISB = 0;
PORTB = 0;
TRISD = 0;
PORTD = 0;
OpenUSART( USART_TX_INT_OFF &
USART_RX_INT_OFF &
USART_ASYNCH_MODE &
USART_EIGHT_BIT &
USART_CONT_RX &
USART_BRGH_HIGH,25 );
//initLCD();
while (1)
{
if (DataRdyUSART())
{
if(RCSTAbits.OERR)
{
RCSTAbits.CREN=0;
Nop();
RCSTAbits.CREN=1;
printf("\n\r OERR");
}
if(RCSTAbits.FERR)
{
printf("\n\r FERR");
while(!DataRdyUSART())
{
printf("\n\r FERRin");
rx1=RCREG;
}
}
rx1=RCREG;
printf("\n\rkey detected:");
while(!BusyUSART());
WriteUSART(rx1);
} //end if
}//end while
}//end main
i'm able to transmit from PIC TO PC and view text on hyperterm but what i type in Hyperterm is not received at PIC
please help...
what i'm trying to do is ... what i type at hyperterm is sent back to PC from PIC when received at PIC.........
below is the code ive tried.... and ive attached a screen shot too... which shows the o/p as soon as i s/w on PIC...... after that whatver i type in hyperterm nothing happens...
IMG]http://www.microchip.com/forums/upfiles.aspx/55927/9D57F8C2084B49A2B553D697607BA7D8.JPG[/IMG]
code:
void main (void)
{
//char rx[8]="Null\n\r";
char rx1='k';
int key;
//init();
TRISB = 0;
PORTB = 0;
TRISD = 0;
PORTD = 0;
OpenUSART( USART_TX_INT_OFF &
USART_RX_INT_OFF &
USART_ASYNCH_MODE &
USART_EIGHT_BIT &
USART_CONT_RX &
USART_BRGH_HIGH,25 );
//initLCD();
while (1)
{
if (DataRdyUSART())
{
if(RCSTAbits.OERR)
{
RCSTAbits.CREN=0;
Nop();
RCSTAbits.CREN=1;
printf("\n\r OERR");
}
if(RCSTAbits.FERR)
{
printf("\n\r FERR");
while(!DataRdyUSART())
{
printf("\n\r FERRin");
rx1=RCREG;
}
}
rx1=RCREG;
printf("\n\rkey detected:");
while(!BusyUSART());
WriteUSART(rx1);
} //end if
}//end while
}//end main