LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timed loop

How do I go about setting up a timed loop? I want the loop to run every 0.1 s?What should I hook up to the source name? I tried to hook up a Get Date/Time in seconds.vi to seconds to date time.vi to get fractional seconds, but when I attached this to the source and put 0.1 as dt, it didnt run, nbo errors, just nothing happend?

 

Cheers,

Sam 

0 Kudos
Message 1 of 13
(4,440 Views)

Sam,

 

a timed loop can create it's clocksource on its own. So if you don't need access to the clocksource somewhere else and if you don't need external clocking, i'd go for that.

In order to configure the clock, double click the left box on the loop and select the settings. The settings for instance can be Source Type 1kHz Clock and Period 100 ms.

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 2 of 13
(4,435 Views)

If you don't wire anything it will default to the built-in 1 ms clock.

 

If you have a hardware device you can use it for the timing source.

 

For what you are doing the hardware clock should not be required.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 13
(4,434 Views)

Im using a DAQ assistant to read from accelerometers, how do I get this to be the clocksource?

 

Cheers 

0 Kudos
Message 4 of 13
(4,403 Views)

Im tring to run the a loop of 0.1secs in which data is written to a file, however,when I do this off the timed loops clock source, the time for each result is 0.1s but only to 1 decimal place. How do I fix this?

 

Cheers 

0 Kudos
Message 5 of 13
(4,382 Views)

Sam,

 

as far as i know, you cannot use a task configured in the assistant as clock source of a timed loop. But i doubt that this is necessary at all.

In order to make sure that my proposition is correct, i ask you to describe what your application should do.

 

thanks,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 13
(4,380 Views)

Well my program reads 3 values from an anemometer via a serial port, reads 3 values from accelerometers connected via an A/D board, and then write these vales to a file with the time (including fractional seconds) all within the loop. However I need the program to have a frequency of 10Hz, or a loop time of 0.1 seconds. However when I use a timed loop, with a dt of 100 ms, the time values written to the file are not exactly 0.1s apart. e.g. the first value could have a time of 9.1507855 seconds but then the next time would have a time of 9.26897778,its only exact to 1 decimal place. Im also unsure, as to which time is correct?I have tried to use the 'Profile Performance and Memory' tool to work out the delay between values being read and a the 'get date/time vi' assigning a time, but the results it gives are well confusing.

 

Cheers 

0 Kudos
Message 7 of 13
(4,377 Views)

The anemometers via serial are not deterministic.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 13
(4,372 Views)
What does that mean?
0 Kudos
Message 9 of 13
(4,369 Views)

The anemometers use serial which breaks up a reading into multiple data bytes and transmits one after the other which in turn have to be framed by the hardware and transfered via interupts servie routines and Winows shared memory buffers before they are availabel to any app. That long string of uncontrolled events add up to an un-determined amount of time. So anything we get from serial is always "history" and how old can only be determined by using AI hardware to analyze the data packets on the wire after the fact.

 

THe anemometers I have used (WindMaster) are NOT periodic.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 13
(4,362 Views)