From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

cvi timer help

hi all

 

can anyone help

 

task-to start my program inside the timer with the start of Start_buttom press.  

 

i have a question, i have a CVICALLBACK: call "Start_button" how can i put the timer control inside this function? 

 

my timer can be found on CVI software under ,,,,,, Create>>Timer>>Timer

 

is there a advice or simple program/note for my reference?

 

Thanks alots 

0 Kudos
Message 1 of 4
(4,824 Views)

If you want to activate the timer inside a start button callback you can manipulate the enabled state of the timer using ATTR_ENABLED attribute with SetCtrlAttribute

If this is not suitable for your situation, please explain in more details your application schema and the expected behaviour.



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 2 of 4
(4,815 Views)

i think this is what i want, but can you show me a simple porgram on how to write? cos i new to CVI Thanks   

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

Well, supposing you have a start button and a timer control on the same panel, inside the button callback you can do the following:

 

int CVICALLBACK StartCallback (int panel, int control, int event,
		void *callbackData, int eventData1, int eventData2)
{
	if (event != EVENT_COMMIT) return 0;

	SetCtrlAttribute (panel, PANEL_TIMER, ATTR_ENABLED, 1);

	return 0;
}

 

If you are new to CVI you should consider spending some time through Getting Started manual and the exercises included in it, or at least stadying the examples supplied with the product: this will save you some headaches as you gradually get more involved in programming.



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
(4,804 Views)