Jump to content

front panel indicator lag


Recommended Posts

I am working on a project that requires alignment of a light source. There is two light meters sitting 45 degrees from one another and when they both see the same amount of light the fixture is aligned. I have a sub-vi that reads the light meters with approx 70ms execution time but when i put them in a loop and read continuously to a set of graduated bars there is considerable lag (more than a second). I put a tick counter to determine loop time which is around 170ms. any ideas on why the long lag?

FrontPanel

BlockDiagram

Link to comment

The way you've written your timing code does not guarantee accuracy - use a flat sequence structure with three frames instead and don't both with a shift register just make a call to Get Tick Count immediately prior and after the payload code.

70ms * 2 = 140ms, 162ms (from your screenshot) - 140ms = 22ms of lag. Does your device have to multiplex in order to read one meter or the other? If it does, settling time maybe a factor. Does the manufacturer specify response time? What is the baud rate of the device?

Additionally, is your 70ms for the individual read a looped benchmark or a one-up? The device may not be able to churn out data quickly. Again, baud rate may be relevant.

Two unrelated things:

1) You can replace your "read until buffer is empty" loop with a call to VISA Flush. As you have it written, it would be slightly faster/cleaner to test for a string length of zero.

2) If you change the mechanical action of Init to any kind of latch ("latch when released" is default), you won't need to reset its value with a local.

Link to comment

Thanks for the response,

First the easy questions...the baud rate is 9600, the 70 ms is added between a visa write and a visa read in my subvi. As far as multiplexing I don't think that is necessary as I specify an address when I "visa write". Then when I read the buffer the only thing there is the reading from that address. I don't think there is a "read all" command.

I determined the read time from multiple reads of all 5 sensors that i have into an array, ie. write to address 1, read ->to array; write to adress 2, read->to array; etc. when i ran that 100 times i got 500 readings and when i averaged it I still got ballpark of 170ms.

I am not trying to split hairs here, a 500ms delay would be fine but when constantly reading the two sensors and displaying on the front panel you can cover a sensor and count... one-mississippi-two-mississippi then the bar drops.

I am starting to suspect that the delay is in the meter itself before it sends the data to me. I will do some more experimenting today and let you know.

regardless, thanks for the info and especially the "unrelated things" I am always open for suggestions on how to clean up my code :) !

Link to comment

update: the LCD on the front of the meter responds with a 2 second delay, so apparently the lag is inherent in the system, i can read it every 170ms but the data shown is always 2 seconds behind ;(

thanks again for the info ASBO

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.