Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Software Timed Loops

Hi all
implement a small program to calcualte the time a certain operation needs to perform and when I used it to check My previous GPIB capture , it always gives me different values , is the GPIB duration process for a same block digram not  always the same " or in other words , is the time to perform some tasks in GPIB constant or variable , when I cheked the duration that my GPIB code  takes it was variable
Help me plz
 
0 Kudos
Message 1 of 14
(4,224 Views)
Are you talking about variations of several msec or seconds? Even the VI you posted shows a couple of msec differences and I don't have much running on this pc. The timer in windows in not all that accurate in the first place and if the OS decides to do something in the background, that will cause some additional delays. You also didn't post the GPIB code so it's hard to say what the instrument might be doing. The actual time to send a specific command is going to be pretty constant and the time to transfer data will be as well, but maybe the instrument takes a bit longer to trigger or something similar. You really need to provide some more details and if timing is really important, you should try the timed loop and if it's really, really important, you may have to move to LabVIEW Real-Time.
Message 2 of 14
(4,215 Views)

Dear Denis

thnaks for your help , would u  please give me some examples on using timed loops , thnaks alot, I will try using timed loops may be this will be better for more accurate results regrading timing

Maple

0 Kudos
Message 3 of 14
(4,200 Views)
Look at what I posted for a similar question at http://forums.ni.com/ni/board/message?board.id=170&message.id=203339. You never said what kind of variation you are seeing and what you can tolerate. That's important in deciding what can be done.
Message 4 of 14
(4,190 Views)

Dear Denis

Thanks for your help , I am sorry I am lating in replying , I have traveled and gave myself a break.

I have decided to use timed loop, I have read the application note and understand it very well , it advices to use timed loop when u want to develop applications with precise timing

 

we can configure timed loops by setting the period each loop takes and the time between each loop .it says sometimes the elapsed time of the loop is not precise due to some inturrepts by the OS .

can I know for each iteration what is the actual time spent and  write it to a text file

 

Thanks 

0 Kudos
Message 5 of 14
(4,086 Views)

Hi maple72,

You should be able to monitor the Actual End [i-1] to determine the amount of time the previous iteration took to execute and then write to the value to a text file.

Regards,

Steve B.

Message 6 of 14
(4,056 Views)
Hi Basset
How could  I do that could u give me an examplee please
regrads
0 Kudos
Message 7 of 14
(4,045 Views)

Hi maple72,

Sure. The VI is very simple and I did not try and format the data.  I have attached the VI below.  It loops at a rate of 1kHz.  Note that the data it generates is the end time relative to the start time of the Loop (i.e. it starts at 0 and then every loop it ends 1000 ms later since we loop at 1 kHz )

Regards,

Steve B.

Message 8 of 14
(4,024 Views)

Hi Bassat

Thanks for the file , I dont have LabVIEW 8.2 , the file u sent me doesnt open with LabVIEW 8 I have , could u do it on 8 please or send me  JPG file

Thanks alot

Wadah

0 Kudos
Message 9 of 14
(4,016 Views)
Hi, i think that if you are using Windows like SO it's probably that time for operations in your VI change between two or more run. This happens because Windows isn't a Deterministic SO. During excecution of VI Windows does other operations for the pc, like management of keyboard or mouse events. The differences, i think, are little in time. If you want more precision you have to use Real Time SO and techniques.
Message 10 of 14
(4,009 Views)