We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi. I'm using an eval board with C1610 (Phytec KC161). I know that KEIL doesn't have the function kbhit(). But I need somthing like that function, is it posible to make one? If does anyone know, please give me ideeas, or, the body of he function, even it is for over device. Thank you.
Well, what I want in my aplication: For exemple the device (C161) is executing something(doesn't metter), also it is connected frough serial interface to one serial port to the PC, and use Hyper terminal. If had typed a string, I want C161 to execute what I entered from PC keyboard, else the device will execute the rest code whithout entering the body of if(kbhit()){...}
void main(){ //.... declarations of variables //... P3 |= 0x0400; /* SET PORT 3.10 OUTPUT LATCH (TXD) */ DP3 |= 0x0400; /* SET PORT 3.10 DIRECTION CONTROL (TXD OUTPUT) */ DP3 &= 0xF7FF; /* RESET PORT 3.11 DIRECTION CONTROL (RXD INPUT) */ S0TIC = 0x80; /* SET TRANSMIT INTERRUPT FLAG */ S0RIC = 0x00; /* DELETE RECEIVE INTERRUPT FLAG */ S0BG = 0x19; /* SET BAUDRATE TO 19200 BAUD AT 16MHZ */ S0CON = 0x8011; /* SET SERIAL MODE */ /* ........ */ while(1){ //....the main instructions if(kbhit()){ scanf("%s",command); if(strncmp(command,trn,3)==0){ //command 1 scanf("%d", &nr); //.... } } }