Max frecuency reading micro maestro

Hello,

I have a question about how fast you can read the commands, GET_MOVING_STATE GET_ERRORS and GET_POSITION.

because when i try to do the follow pseudo code, sometimes micromaestro returns me bad data.

SET_TARGET(servo, position) -> servo moves.
while (GET_MOVING_STATE==1){sleep(ustime)} -> we waiting to servo stop
GET_POSITION(servo) -> returns servo position.

So, when i run my program almost always works fine, but sometimes the rutine GET_POSITION only give me one byte instead of two bytes.
Then i need to rerun my program again.

Is there any time that i need to wait before to read a command?

Thank you

Hello,
There should be no limit to the speed that you can send commands, as long as you wait for all of the bytes to arrive before continuing. I would suspect that your code still has problems reading the bytes. Can you simplify it as much as possible (this program should be able to get down to 40 or 50 lines) and, if it still does not work, post the code here?

-Paul