Proper order of IME function in EasyC V4

What is the proper sequence of IME functions in EasyC V4?
For example, currently in my overal initialize function, the PID functions go in the following order:
Initilize PID
Preset IME (to 0)
Define IME PID

Does the order of these functions matter and if so what is the correct form?

Also, does having the Initialize PID inside of the overall Initialize function present problems since it is ran before autonomous and before operator-control?

The reason I am asking is because my robot is having a problem. It can run operator-control perfectly fine and it can run autonomous perfectly fine, but transitioning between the two following the field control order seems to cause some major problem. Every motor on the robot acts erratically forcing me to turn it off to prevent damage.

I have the robot with me at home and will be working on it tonight. I will update with any info i find.

When you say every motor behaves erratically do you means the motors which are not under PID control as well?

There are a couple of things you can do.

  1. Perhaps Stop the PID controller before initializing the IMEs to 0.

  2. Use global data (the GlobalData array) so that you only run this code in initialize once.

perhaps something like this (untested)

#include "Main.h"

void Initialize ( void )
      // GlobalData is initialized to 0 (?) or NVRAM contents if it exists (don't ask!)
      if ( GlobalData(1) == 1 )
          StopIntegratedMotorEncoderPID ( 1 ) ;
      // next time around we will call StopIntegratedMotorEncoderPID
      GlobalData(1) = 1;

      InitIntegratedMotorEncoders ( ) ;
      PresetIntegratedMotorEncoder ( 1 , 0 ) ;
      DefineIntegratedMotorEncoderPID ( 1 , 0.5 , 0  , 0.3  , 36  ) ;
      StartIntegratedMotorEncoderPID ( 1 , 0 ) ;

Thank you for the help jpearman!
To begin with, all the motors are controlled by IME’s (two pairs of motors have y cables)
Prior to your reply I had tried the above to no avail. In the process however, I commented out a piece of code in the initialize function and the robot started to work fine.
The piece I commented out starts an LCD and uses it to pick the autonomous routine. It initializes the LCD, starts the button watcher and then picks gets the buttons to add/subtract from a counter that dictates the routine. The latter part is within an !IsEnabled() while loop.

I discovered that adding a Stop Buttons Watcher function after this loop fixed the problem. It appears that having the Start Buttons Watcher function run twice (during initialize before autonomous and before operator-control) without stopping it in between was causing the problem. Is this a known issue?

The button watcher function was known to be buggy in, see point 5 in the post below. I don’t use EasyC enough to know what the latest is but expect it has not changed.

Thanks for the info!
I am using EasyC V4 version
1 - 5 are all issued I have encounter with this version of EasyC.
Just figured I may save you some time from retesting each of those in the new version.
I have no experience with the speaker what so ever, so I can not vouch for point number 6.