From MPLAB To EASY C PRO

All,

We have been using MPLAB and have made the move to EASY C.
I am personally much more comfortable in MPLAB, but using EASY C will allow us to include more people in the coding process.

Here’s my question: Can someone explain how loops work in Easy C? In MPLAB it seems pretty obvious to me between the get data and put data… I would never put an infinite loop. In EasyC there are all sorts of infinite loops. I don’t understand this…

For example in the kickoff demo code… in SeekLight it says while(!done). But I cannot find any change to done… Similarly the While(1) in autonomous as well as the While(1) stump where the writer suggests you “put tube delivery code here”

HELP!

I’m trying to make the camera seek the light when it does not see any light and I am stuck understanding these loops.

Thank you all very much.

-354 programmer

Lots of stuff done in the background for you in EasyC.

The getdata/putdata are down in the background. You can still check to see if or when new data arrives.

The autonomous() routine is automatically ended in EasyC when the robot comes out of autonomous mode.

easyC there is no fast and slow loop. The code just loops as fast as it can in the user processor. If you don’t loop the code it will just stop. For every loop easyC checks the status of the inputs. You should check out the help file tutorials real quick and you should get a handle on it especially with previous C experience.

How does it work with the infinite loops in Easy C?
When should I use an infinite loop?
Can’t I assume that any code I write will be read once every process cycle like in MPLAB? Why do we need infinite loops in Easy C?
Thanks
-354

In operator control you should do a infinte loop and thats it. The rest of the time any loops are optional. If you break out of the infinite loop in operator control the robot will just stop moving.

People like using timers in autonomous mode or ending the auto program once the sequnce has been completed. This is what Neil did in the code your are talking about. If you set done = 1 then code would end. Because ! = not so
while( !done) means while ( (not)done).