I believe Wait(
n) is in EasyC, not in mplab. The two operate much differently in this respect.
In mplab you don't want a command like wait 3 seconds inside your code. The code needs to do it's own paperwork every loop. You can use a counter variable like
i_am_samus suggests. Here's my note to myself in the code:
Code:
// timer notes:
//
// The autonomous code functions are called by the controller
// every 26.2 mS (milliseconds), or 38.17 times each second.
// For calculations we will use 38 times per second.
// The total length of Autonomous Mode is 15 seconds,
// or 570 counts total (or exactly 572.55 counts).
(I'm willing to be corrected if this isn't right.)
As I recall from other places here at CD, the counter variable method isn't exact but is close enough.