LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

timer problem, GetCtrlAttribute gives weird results

Solved!
Go to solution

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

0 Kudos
Message 1 of 4
(3,436 Views)
Solution
Accepted by topic author OnJay

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 4
(3,435 Views)

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. Smiley Happy

 

John

0 Kudos
Message 3 of 4
(3,414 Views)

You're welcome! Smiley Happy



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 4
(3,400 Views)