LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timer Interrupt.

Solved!
Go to solution

Hello.

 

I want to simulate a timer interrupt. For this purpose I have two parallel while loops.

 

The first one has an event structure.

The second one has an "Elapsed Time" vi.

 

I am feeding the "Time has elapsed" output of the "Elapsed Time' vi in the events that trigger the event structure but it does not seem to work.

 

Please see the attached vi.

 

Any suggestions?

 

Thank you very much.

 

Vasilis.

0 Kudos
Message 1 of 13
(6,416 Views)

Hello Vakost,

 

The easiest way to do a timer you can interupt is to build a FGV. You can also use a producer / consumer loop with queues.

 

BR

Vincent

0 Kudos
Message 2 of 13
(6,403 Views)

Hello.

 

So, the reason that this vi is not working is because the Time has elapsed is not a global variable and it cannot feed the event structure?

 

I don't exactly understand, I am confused :(.

 

Thanks,

Vasileios.

0 Kudos
Message 3 of 13
(6,380 Views)
Solution
Accepted by vakost

Hi Vasileios,

 

no, ElapsedTime is no "global variable".

It's a VI - and it acts local in each instance you place on the BD! (That's called reentrancy in LabVIEW.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 13
(6,372 Views)

Hi,

 

Where can I found the "Create Timer Interrupt VI" on the Labview palette? 

http://zone.ni.com/reference/en-XX/help/373925B-01/myrioreference/myrioref_create_timer_irq/#Input1

 

Thanks

Hamid

0 Kudos
Message 5 of 13
(5,935 Views)

Hi Hamid,

 

as can be seen on the page you linked to this function is part of the myRIO toolkit:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 13
(5,931 Views)

Thank you GerdW,

 

If I can call a VI by PC timer interrupt then it should be very accurate timming. I've already used the PC timer interrupt in the C programing to do a task every 1ms, but I'm not sure that VI can do that? Also, I couldn't find  the "Create Timer Interrupt VI" on the Labview palette. I installed the Rio toolkit too. It's on the help file, but once I click on the find it on the palette then it pops up an error.

0 Kudos
Message 7 of 13
(5,929 Views)

Hi Hamid,

 

If I can call a VI by PC timer interrupt then it should be very accurate timming. I've already used the PC timer interrupt in the C programing to do a task every 1ms, but I'm not sure that VI can do that?

Generic answer: Use a timed while loop…

Detailed answer: on a Windows PC the OS/taskmanager is determining, which program will currently run and for how long it will run. You will not get an accurate 1ms execution order in your VI. Use a simple while loop with a 1ms wait in it…

 

Also, I couldn't find  the "Create Timer Interrupt VI" on the Labview palette. I installed the Rio toolkit too. It's on the help file, but once I click on the find it on the palette then it pops up an error.

Some functions are filtered according to the target they can run on.

Examples:

- On FPGA many functions from standard palettes are missing.

- You can use Watchdog functions on RIO targets, but not on Windows PC.

I guess this InterruptTimer is also very platform-specific and only available on your myRIO.

Btw. WHICH error do you get?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 13
(5,926 Views)

Thank you GerdW, I got it.

0 Kudos
Message 9 of 13
(5,906 Views)

I could make my GUI to be almost real-time. It's sending the messages every 20ms and very rarely every 21 ms. This webpage could help me:

https://www.winemantech.com/blog/the-ui-thread-root-loop-and-labview-what-you-need-to-know/

Also, I used a "Timed Loop" instead of while loop for sending the periodic message to the interface( with setting of high priority and 1kHz absolutetime and dt=0.0002 or 0 )

Also, calling the dlls should be set on "Run in any thread"

0 Kudos
Message 10 of 13
(5,874 Views)