LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Sanchez's answer to Keli's question

Yes, I am using Labwindows to do PID control. How can I eliminate timer or count control function inside the loop and get the whole processor speed from my computer? I also use LabView. There is an example in LabView for hardware timed control (Analog IO Control Loop(hardware timed)). Is there a similar example for LabWindows? Could you send me a simple Labwindows example that can make a loop execute at a specified time interval at a fast rate? I don't need those fancy interface, just basic codes. Thanks. Keli
0 Kudos
Message 1 of 3
(2,837 Views)
Keli

Right now we do not have an example program like the Analog IO Control Loop in CVI. To be able to have a loop execute at a specified time interval you can put a delay in the loop using the Delay function. The resolution of that function is normally 1 millisecond. You can verify the time of the loop by using the Timer function.

I hope this information is helpful.

Brian
0 Kudos
Message 2 of 3
(2,837 Views)
I had the same problem. I don't use the timers because I needed complete control the processing time. This is how I set up my code to get around using the timers. I cut pieces of my code to show you so it might not be exact but it will give you the ideal.


int main (int argc, char *argv[])
{
int error;
int wasOtherInstance;

// initial program load panel ect.

MainLoop();

// cleanup code close things
return 0;
}

void MainLoop(void)
{
while (ProgramRunning)
{
ProcessSystemEvents();

// main body of code
// this runs until the exit button is pressed
// I usaully call a function here that contains the main code

Process();
}

}


int Process(void)
{
int Value;
int Start;
int IgnOk
;

CurrentTime = clock();
CurrentTime = CurrentTime / CLOCKS_PER_SEC;

return 0;

}

void CVICALLBACK MenuExitCallback(int menubar, int menuItem, void *callbackData, int panel)
{
int Value;

switch (menuItem)
{
case MENU_EXIT_QUIT :
{
ProgramRunning =0;
}
}
}
0 Kudos
Message 3 of 3
(2,837 Views)