Raptor, T43, Dynamic Change GT.Timer Interval, .NETMF 4.3

I have implemented most of the proper code to dynamically update a GT.Timer interval from a touch screen keyboard input. On StartProgram() the timer is not running. The first time i update the interval from the screen the timer starts and blinks the DebugLED at the proper rate and I can carryout other tasks in the overall program.

However, when I update the timer interval again from the screen, the Debug LED then starts to blink sporadically. Almost as if the timer is confused about what the interval really is and it is stepping on itself.

Is there something that I have to reset dealing with this timer?

portions of the Code Below:

 //input the delay time from a keyboard
            UpDelayTime = (TextBox)ManualWindow.GetChildByName("UpDelayTime");
            UpDelayTime.TapEvent += new OnTap(Glide.OpenKeyboard);
             UpDelayTime.ValueChangedEvent += new    OnValueChanged(UpDelayTime_ValueChangedEvent);

 //This portion of the code will change the delay interval and accept input
 //TopDelayTime is changed and sent to the timer_interval write portion
        void UpDelayTime_ValueChangedEvent(object sender)
            TopDelayTime = int.Parse(UpDelayTime.Text);////milliseconds
            //Debug.Print("" + TopDelayTime);   

            if (OldTopDelayTime != TopDelayTime)
                OldTopDelayTime = TopDelayTime;

//Accept the new interval and write to the timer and start timer
        void Set_Wait_at_top_Timer_Interval(int NewInterval)
            TopDelayTime = NewInterval;
            TimeSpan interval = new TimeSpan(0, 0, 0, 0, TopDelayTime*1000);
            GT.Timer Wait_at_top_Timer = new GT.Timer(interval);
            Wait_at_top_Timer.Tick += new GT.Timer.TickEventHandler(Wait_at_top_Timer_Tick);
            if (Wait_at_top_Timer.IsRunning)
                Wait_at_top_Timer.Interval = interval;

//timer call
        void Wait_at_top_Timer_Tick(GT.Timer Timer3)

Let me know if you need any further information.


Can you please edit your post and wrap the code using [ code=cs ] [ / code ] tags (remove the spaces)?

Ahh…yes… I see what you are saying. I am basically creating a new GT.Timer instance every single time that I update the interval. That makes sense as to why I am seeing random timer events after the first time I update.

I will try going global with the timer and only changing the interval.

I will repost the results tonight and updated code if I can get it to work.

Thanks for the help…for now.


I was able to get this solved with the global timer. Lots of other changes in the codeshare link that outlines the use of limit switches on digital inputs to the raptor, T43 HMI inputs and controls , and timers to run an automated hoist (up and down) testing sequence.

Codeshare link to the project as of 12NOV:

The biggest thing I have learned from this is to use the timers to monitor changes in the state of digital inputs as a substitute for the button.buttonpressed application.

Those changes in state, activate delay timers and switch load module outputs.

There are also HMI manual controls to operate the hoist.

Screen calibration in the project also works well. (I “borrowed” that). All the resources needed are included in the zip file on the Code Share link.


1 Like