03-03-2016 12:15 AM
Hello!
We are working on a project where the sensors data is given as an input to labview using Arduino Fio.In Labview, the data is monitored continously.But the data in labview is not varying though the sensors values varies.We have also come across errors like -1073807339.and also the labview program works only in highlight mode not in a normal mode.Can u please help us with this.
The labview program has been attached with this post.
03-04-2016 08:33 AM
Hi
I have Modified the code and also included a loop delay of 50ms , if your requirement dont have tim constraint and still problem exist you can change 50ms as 100ms
not sure the version of LabVIEW you use ,i have modified in 2014
03-04-2016 09:10 AM - edited 03-04-2016 09:12 AM
You receive a timeout error ( -1073807339) because the VISA Read timed out before data came in from your instrument. This isn't necessarily a bad thing.
You're seeing this error because you're requesting 1000 bytes and not all 1000 bytes came in before the default 10 second timeout. You should add functionality to filter out this specific error and continue reading again because chances are this is okay. You should really change your "1000" to actually what you expect to get out.
The above reply that adds a 50ms delay is one way to do it, but will only work if your byte count value is reasonable, otherwise your code will hang on the Read.
Now here's the interesting part. You code only works with Highlight Execution? That means you do have a timing issue. What happens if you don't have it turned on? Do you get a different error? I bet this means you need to add a small Wait between where you initialize your VISA port and when you start looping.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
03-04-2016 10:42 AM
@honey07 wrote:Hello!
We are working on a project where the sensors data is given as an input to labview using Arduino Fio.In Labview, the data is monitored continously.But the data in labview is not varying though the sensors values varies.We have also come across errors like -1073807339.and also the labview program works only in highlight mode not in a normal mode.Can u please help us with this.
The labview program has been attached with this post.
Since you are using an Arduino here then you can change the Arduino sketch, right?
So you can add a termination character to the serial data if there is not one already
The best method for receiving serial data is:
03-04-2016 10:50 AM
03-04-2016 11:10 AM
@palanivel wrote:
Hi
In My previous post I failed to handle number of bytes at serial port instead of giving 1000 as my number of bytes to read which makes more scalable visa read.
Usually I prepare to create a visa driver with configure read write close options
Using "bytes at port" rarely works reliably, the "read until termination character or timeout" I posted above is by far the most reliable and accepted method.
03-04-2016 12:52 PM
@palanivel wrote:
In My previous post I failed to handle number of bytes at serial port instead of giving 1000 as my number of bytes to read which makes more scalable visa read.
I would not say that. The problem with the Bytes At Port is that you run yourself into constant race conditions with the bus. Take this scenario as an all-to-often issue with the Bytes At Port:
1. You send a command to your instrument
2. You wait for the instrument to send data back
3. You read the Bytes At Port and read that number of bytes
4. You get an error because you only got part of your message.
5. With you next read, you get the other part of your message and throw errors due to a bad message.
Yes, that happens ALL THE TIME. Most instruments will send out a Line Feed (0xA, 10) byte when the message is complete. Use this to your advantage. Let the VISA Read read the data until it finds that termination character and then you know you have all of your message and you can process it however you need to.
Now what I will often do with the Bytes At Port is to check to see if at least the start of a message has come in (Bytes At Port is Greater Than 0). If TRUE, read the message using a "large" number of bytes to read so that the termination character takes care of when to stop the read.