I am trying to check the position of a motor through the serial port. I am building array that corrolates actual motor position with a seperate optical readout. I need to send a command to the motor controller to "ask" for current position, then "read" the response back through the serial port. To read back, currently I am checking for bytes at the serial port, and then reading if there are bytes. I run that check in a while loop that needs at least a 25ms wait or the system hangs.
This 25ms accuracy is not good enough. Is there a way for the serial port to tell when it has bytes waiting rather than having a very fast loop continually checking it?
thanks a ton
ben