LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Easy? Array Build and Unbuild (Lv5.1)

Highlighted
I am trying to write a sub-vi that can accept N numbers from a data
source build an N element array for processing and then output N
numbers. With no processing added the thing would work like a simple
wire.

I have an instrument that outputs a string to a serial port every 500
msec, and randomly the serial port seems to get a bad string. Instead
of 2.90e-7 it gets 2.90e-0 or something else properly formatted but
wrong. Use of the Median Filter vi works quite well with arrays built
from this input but with very long recording sessions the array size
gets out of hand. That is why I would like to use a sub-vi like the one
described above to handle the job in chunks of 10 or 20 readings.

Bill Lubarsky
0 Kudos
Message 1 of 8
(1,578 Views)
Highlighted
Do you want the input of the VI to be a string with N numbers, or do you want it to be N numerics. Also, is N going to be variable or is it fixed? Innitially, it sounds like you're just looking for the "Build Array" function.
0 Kudos
Message 2 of 8
(1,578 Views)
Highlighted
Aaron.

Every 500 msec the instrument sends a string to the serial port on it's
own. Communication is strictly one way through the serial port. The
string is converted into number. I want the numbers to go into the
sub-vi one at a time and come out the same way. In between I want to
build an array of N numbers so I can use one filter or another (mostly
the medial filter) and then send the elements on their way out of the
vi.

I built something that almost works but is a total kluge! I would think
that with all the array handling functions and auto indexing that the
problem could be handled with a couple of loops; one to build the array,
one to unbuild the array, with the filter vi between them.

Bill Lubarsky


Aaron Marks wrote:
>
> Do you want the inpu
t of the VI to be a string with N numbers, or do
> you want it to be N numerics. Also, is N going to be variable or is
> it fixed? Innitially, it sounds like you're just looking for the
> "Build Array" function.
0 Kudos
Message 5 of 8
(1,578 Views)
Highlighted
A couple things: First, regarding your instrument it seems strange for an instrument to make the type of error described--though heaven knows not impossible. One thing to check is the actual string being sent back. I did a little experiment. Assuming the string coming back is "2.90e-7" but the last character gets truncated, the string being converted is "2.90e-" which LV will dutifully convert to 2.90e0--hence your problem. First thing is check your serial io code to make sure that you are getting back the entire string every time. Where did you get the serial io drivers you're using? If you post them I will take a look at them for you. Also, is there a delimiter that the instrument sends at the end of every response, like a carraige return or a line-feed?

Bu
t my feeling is very much that the problem is with your serial io and that adding the filtering you mention is simply patching over it.

Mike...

PS: If tweaking the serial io doesn't help, I do have a median filter routine that should do what you are needing, and I'll send that to you.

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 8
(1,578 Views)
Highlighted
Mike.

I am quite sure it isn't entirely the instrument's fault. The problem
will occur on some desktop PC's and not others, almost all laptops and
it seems to depend on which com port I am using. The bottom line is that
with this particular instrument type I have problems. The original vi
that I used came from the manufacturer: International Light, They call
the vi a Virtual Radiometer; It reads the output from the IL-700 digital
radiometer. I only used the sub vi that actually gets the strings from
the meter. You can find it on their web site: www.intl-light.com. I long
ago replaced it with a visa type serial vi that doesn't do any better.

mikeporter wrote:
>
> A couple things: First, regarding your instrument it seems strange for
> an instrument to m
ake the type of error described--though heaven knows
> not impossible. One thing to check is the actual string being sent
> back. I did a little experiment. Assuming the string coming back is
> "2.90e-7" but the last character gets truncated, the string being
> converted is "2.90e-" which LV will dutifully convert to 2.90e0--hence
> your problem. First thing is check your serial io code to make sure
> that you are getting back the entire string every time. Where did you
> get the serial io drivers you're using? If you post them I will take a
> look at them for you. Also, is there a delimiter that the instrument
> sends at the end of every response, like a carraige return or a
> line-feed?
>
> But my feeling is very much that the problem is with your serial io
> and that adding the filtering you mention is simply patching over it.
>
> Mike...
>
> PS: If tweaking the serial io doesn't help, I do have a median filter
> routine that should do what you are needing, and I'll send that to

> you.
0 Kudos
Message 4 of 8
(1,578 Views)
Highlighted
First of all, I'm sure that the problem is not inherently with the meter itself. My concern is with the drivers. In my experience it is a very common mistake to create a driver that truncates messages--especially if the instrument doesn't stream its response all in one chunk.

And yes, I would be very suprised if simply moving to VISA would fix the problem. The fact that it only happens on some computers is to me a strong indication of a timing problem in the driver itself.

I've downloaded the drivers and will look them over.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 8
(1,578 Views)
Highlighted
Mike.

Now that I am back at work I would like to send you my version of the
driver.
Should it go to your email address or other?

Bill

mikeporter wrote:

> First of all, I'm sure that the problem is not inherently with the
> meter itself. My concern is with the drivers. In my experience it is a
> very common mistake to create a driver that truncates
> messages--especially if the instrument doesn't stream its response all
> in one chunk.
>
> And yes, I would be very suprised if simply moving to VISA would fix
> the problem. The fact that it only happens on some computers is to me
> a strong indication of a timing problem in the driver itself.
>
> I've downloaded the drivers and will look them over.
>
> Mike...
0 Kudos
Message 7 of 8
(1,578 Views)
Highlighted
Send it to mporter@arielcorp.com

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 8 of 8
(1,578 Views)