This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Prob while getting data from keyboard

Hi i m using nrf24E1 board when i flashed the prog i cant get the result porperly while the i got the result on serial window 1 of keil .sometime board can get data from keyboard and most time it just display the data and cant get from keyboard, My serial port and baud rate are correct , i m using tera term.

pre
#include <Nordic\reg24e1.h>
#include <stdio.h>
void Init(void){


TH1 = 243; // 19200@16MHz (when T1M=1 and SMOD=1)
CKCON |= 0x10; // T1M=1 (/4 timer clock)
PCON = 0x80; // SMOD=1 (double baud rate)
SCON = 0x52; // Serial mode1, enable receiver
TMOD = 0x20; // Timer1 8bit auto reload
TR1 = 1; // Start timer1
P0_DIR |= 0x02; // P0.1 (RxD) is an input
P0_ALT |= 0x06; // Select alternate functions on pins P0.1 and P0.2

EA=1;
}


/*------------------------------------------------
------------------------------------------------*/
char putchar (char c)
{
while (!TI);
TI = 0;
SBUF = c;



return (c);
}

/*------------------------------------------------
------------------------------------------------*/
char getchar (void)
{
char c;


while (!RI);
c = SBUF;
RI = 0;



return (c);
}





main(void){
char c;
Init();
while (1) {



printf("Press a key: ");
c = getchar ();
printf("\r\nYou pressed %c\r\n", c);


}

}
/pre

0