I'm not too sure what else you have in your program, or what exactly you are trying to do, but here is a suggestion. If 1 ms is not letting you refresh fast enough as your wait time, try putting a (0)zero for the ms to wait. This will still work in your while loop, and you actually need it so the while loop doesn't take up a lot of your PC usage. Try 0 and see if that speeds up your refresh rate. Hope this helps. Good luck.