LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

execution of program without highlight mode in labview in real time

Highlighted

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.

0 Kudos
Message 1 of 7
(1,515 Views)
Highlighted

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

 

 

Palanivel Thiruvenkadam,
CLA|| CTD
0 Kudos
Message 2 of 7
(1,508 Views)
Highlighted

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>   ---'

0 Kudos
Message 3 of 7
(1,486 Views)
Highlighted

@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:

  1. Enable Termination Char in the VISA Serial setup
  2. Set the term char to match the term char you are sending from the Arduino
  3. Set your VISA read to read more bytes than you expect
  4. Set your VISA timeout to a proper value
  5. Now the VISA read will read until it receives the termination character or times out
  6. Check the error cluster for a timeout error and ignore it or better yet deal with it properly
-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
0 Kudos
Message 4 of 7
(1,473 Views)
Highlighted
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
0 Kudos
Message 5 of 7
(1,462 Views)
Highlighted

@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. 

 

 

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
0 Kudos
Message 6 of 7
(1,457 Views)
Highlighted

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 7 of 7
(1,440 Views)