10-24-2011 08:11 PM
I have several timers and am having problems with one that I have enabled and set the time interval to 60.0 s. I was trying to change the time interval and couldn't get that to work, so decided to interrogate it for the enabled status and the time interval status. This is the code snippet:
printf("MFC enCheck: %d\n", GetCtrlAttribute (panel, PANEL_TIMER_MFC_DATA_ACQ, ATTR_ENABLED, &enValue));
printf("MFC timerCheck: %d\n", GetCtrlAttribute (panel, PANEL_TIMER_MFC_DATA_ACQ, ATTR_INTERVAL, &mfcTimerValue));
printf("MFC enValue: %d\n", enValue);
printf("MFC mfcTimerValue: %d\n", mfcTimerValue);
Although the timer appears to be running, I'm getting zeros for all the printf's except for enValue in
GetCtrlAttribute (panel, PANEL_TIMER_MFC_DATA_ACQ, ATTR_ENABLED, &enValue)
which is showing 1,078,853,632 and I can't understand where this strange value is coming from and can't understand why I'm getting zeros for the other values. All the values are int's: enCheck, enValue, timerCheck and mfcTimerValue. Any ideas?
Thanks,
John
Solved! Go to Solution.
10-24-2011 11:35 PM - edited 10-24-2011 11:36 PM
John, you are getting 0s as a return vlaue from GetCtrlVal which means the functions have found no error.
On the other hand, as you can see here, timer interval is a double value and you should get an error while trying to read it into an int, which you aren't. This is strange!
I suggest you to double check all inputs to the functions, particularly 'panel' variable: this must be the handle of the panel the timer is on. A wrong value in this variable could explain why you seem unable to change timer interval.
10-25-2011 12:14 PM
Good golly, you're right Roberto. I forgot about the double. Thanks very much! Your suggestion also led me to correct other mistakes, with SetCtrlAttribute and with SetComTime on the same serial port. So your suggestion was incredibly helpful. ![]()
John
10-25-2011 03:50 PM
You're welcome! ![]()