Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

visa delay

hi 

I am using visa to receive some data from a microcontroller (AVR) , but between send a string by AVR and receive it by Labview have a very big delay. (sending of data by AVR === no delay  &   receiving by Labview ==== very big delay) . what is the problem???

thanks

   

0 Kudos
Message 1 of 7
(2,863 Views)

What is the format of your data?  In 99.9% of applications, you should NOT be using the Bytes At Port in order to figure how many bytes to read.  It can cause weird race conditions.  There are likely better ways, but it depends on the data format.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 7
(2,851 Views)

my data type is a string (length about 6-10 character)  what I can use instead of "byte at port" ???

thanks    

0 Kudos
Message 3 of 7
(2,844 Views)

@tehrancontrol.com wrote:

my data type is a string (length about 6-10 character)  what I can use instead of "byte at port" ???


Coming from VISA it is a string.  What I was asking was how is your actual data stored inside of that string and then sent.  Is it an ASCII string so you can understand it when you open it up in a text editor?  Does the message always end with a termination character, typically a Line Feed (0xA, LF)?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 7
(2,831 Views)

No , it don't finish with line feed .

String that I receive with Labview is " = 1020 "   Or   " = 198 " 

0 Kudos
Message 5 of 7
(2,815 Views)

Do you have the ability to change the instrument?  Because that is a really stupid way to send the data.  How is somebody supposed to know the whole message was received unless there is a character to state that the message is complete?  Or is the message always the same number of bytes?  This would be an acceptable alternative.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 7
(2,797 Views)

I would also recommend a line feed at the end of each message. This makes your communication protocol much more expandable.

 

Additionally, you could test the serial line using the simple serial example:

Help>>Find Examples...  -->  Hardware Input and Output>>Serial>>Simple Serial.vi

 

If that program is also communicating slowly, the issue is likely coming from your MC, PC, etc. and not LabVIEW. If it's not, then the delay is probably coming from something in your LabVIEW code.

Bill B.
National Instruments
0 Kudos
Message 7 of 7
(2,788 Views)