From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error with data sent with VISA communication

Solved!
Go to solution
Solution
Accepted by topic author GoviRe

@PatanGova wrote:

Hi Omar,

I observed these with the vi you posted

Replytime  MaxReplytime LoopCount

4006              4006                    1

4018              4022                    2

4011              4022                   3

4016              4022                   4

4050              4050                   5

4144              4144                   6

And the Readbuffer values are being updated(changing) after 30seconds(around).


4 seconds for a read?  There's part of your problem.  But let's break this up some more.  Added benchmarking for the VISA Write as well.  Also created an indicator so we can make sure the loop is iterating.  I also removed the parsing of the data since this issue seems to be around the communications.


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
Message 41 of 46
(578 Views)

It's taking over 4 sec for your device to reply to your message request.

Either there is a problem with the message request that you are sending or there is a problem with your device.

Maybe your device is too busy doing other higher priority things and will address low level stuff every 4 sec.

Did you write the code on your device?

 

Does the reply string look EXACTLY like what you expect?

 

Any Errors or Warnings?

I would expect this one

VISA: (Hex 0x3FFF0006)
The number of bytes transferred is equal to the requested input count.
More data might be available.

Omar
0 Kudos
Message 42 of 46
(577 Views)

Going all the way back to the beginning and re-reading your posts,I think we might have a missing 0xFF

 

From your very first post, first line your wrote

"I am trying communicate with a microcontroller that needs this data 0x01 0x2A 0xFF 0xFF 0xFF 0xFF 0xFF 0x0D to start transmitting data back."

 

But the VI is only sending 0x01 0x2A 0xFF 0xFF 0xFF 0xFF 0x0D. Add a 0xFF element to the array

 

Right click on the array Data Operations/Insert Element Before and add a 0xFF

Omar
0 Kudos
Message 43 of 46
(572 Views)

Hi crossrulz,

I tired your posted vi and the following observations were made

1) After 30 seconds

Iterations=14020 ReplyTime=2 Write Time=0 ,Max Replytime=4,MaxWriteTime=1

2) After 30 seconds(when restarted the vi again)

Iterations=14252 ReplyTime=2 Write Time=0 ,Max Replytime=5,MaxWriteTime=4

3) After 20 seconds(when restarted the vi again)

Iterations=9550 ReplyTime=2 Write Time=0 ,Max Replytime=5,MaxWriteTime=1

The Values in the “readbuffer” are changing very fast(seems like they the samples are getting).

Thanks.

 

0 Kudos
Message 44 of 46
(571 Views)

Hi Omar,

No, by mistake I wrote it as  0x01 0x2A 0xFF 0xFF 0xFF 0xFF 0xFF 0x0D  in the first post but it should be 0x01 0x2A 0xFF 0xFF 0xFF 0xFF 0x0D the one we are using is correct.

Thanks.

0 Kudos
Message 45 of 46
(565 Views)

Also, you may wish to flush your read buffer before sending your request to make sure you are getting 'clean' data and not bytes left over from an incomplete read. This will synchronize your read with your writes. 

 

Since you seems to have it working, add back in the data parsing stuff.

 

A note about Windows timing, it seems you should be able to loop well under 10 ms per loop, but every now and then Windows will step in and go off for 30 ms or so to take care of other stuff. Try this to see what your loop time is and what the Max loop time is after letting it run for 60 sec or so.

Omar
Message 46 of 46
(549 Views)