Please bear with me, I am new to Embedded c.
We are using a ADUC848 Microcontroller that has an 8051 based core. We are using Keil uVision 3.
What we need to do is send a #TST# string out from the Microcontroller, which we are accomplishing using a printf("!&#TST#&\n"); command.
The Microcontroller is connected to a PC via USB, but a PC isn't always used, so the embedded software will run with or without it.
If the computer sees the #TST# string it will send a signal to the Microcontroller, telling it to start running a test.
If the Microcontroller does not see the signal from the computer, it will send the #TST# string a couple more times.
If it still doesn't see it, the Microcontroller will begin running the test.
We want to do this in about 5 seconds.
The embedded C software has already been written and it works fine, but i'm trying to add this functionality, because when they are using a PC, we want to make sure that they see each other properly.
My problem:
I've been trying to use the Getkey command to get the character from the computer. It works, but the problem is the getkey command halts execution and won't start again until it gets a key
Basically, what i'm asking is, is there anyway we can have the getkey run for 5 seconds, if it doesn't find anything, then it will just continue.
OR
Any suggestions on an alternative way to do this?
Any help, is appreciated, thank you.