|
Re: problem with using a loop
The SW in the robot runs in a loop (the main loop). About 38 times a second it reads all the inputs, executes your code, then sets all the outputs to there new values.
If you stick a WHILE or FOR loop in you code, then this main loop is stopped until your loop completes. This means no more inputs will be read, no more outputs will be updated.
For this reason, you cannot use WHILE or FOR loops in your code.
There is also a second processor handling the Inputs and Outputs on a higher level. When it sees your code has stopped updating the outputs every 26mS, it assumes your code has crashed, and it shuts down the controller.
EDITED FOR CORRECT TIMING: The communication loop runs about 38 times a second, every 26.2 milliseconds. (thanks Alan :^)
Last edited by KenWittlief : 03-02-2006 at 13:33.
|