LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Read function

Hi everyone,

 

In my application i communicate with a device with USB UART , i send a command that returns a 48 caractere string, but the READ function return only 7 caracters, what i have to do so the READ function returns all the 48 caracters 

 

Best regards

0 Kudos
Message 1 of 11
(3,961 Views)

Hi Brainiac,

 

without knowing your device and your VI we can only guess…

 

Suggestions:

- disable the TermChar

- read exactly 48 bytes from port

- increase the timeout

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(3,953 Views)

Either you do:

1. Read(7) - bad configuration

2. Bytes at port connected to Read without any wait - this shouldn't be used in this case

3.  Have a Terminate character that's included in the answer - bad configuration.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 11
(3,951 Views)

Hi 

 

 

0 Kudos
Message 4 of 11
(3,943 Views)

hi

 

this is the VI

0 Kudos
Message 5 of 11
(3,938 Views)

I bet the command that you wrote is only 7 characters long.

 

Why did you wire the Bytes Written from the VISA Write to the Bytes to read for the VISA Read?  I don't think there is a case where that would ever make sense.

 

You need a constant of 48 wired into the VISA Read.

0 Kudos
Message 6 of 11
(3,926 Views)

Hi 

Download All
0 Kudos
Message 7 of 11
(3,900 Views)

It sounds like your device is not returning the 48 characters that you expect it to.  How many did it actually return this time?

 

Give an example of what the returned message should look like.  Is it ASCII, human readable?  And if so, does it have a termination character?  Or is it binary data?

0 Kudos
Message 8 of 11
(3,890 Views)

Hi Brainiac,

 

does your device receive anything? Can you check that? Does your device indicate it receive data?

Does the communication work correctly when using any other tool like HTerm or similar?

Which command did you use in your VI? Does your device expect any TermChar for commands?

 

Again: We don't know anything about your device. You need to debug on your own!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 11
(3,886 Views)

What are you trying to communicate with?  With a make and model, we can look up the command protocol and give you a lot better advice.

 

But a complete shot in the dark: Your instrument is expecting a termination character to state when the command is complete.  You are not sending it.  Assuming that is the case, then you need to append the termination character, or make VISA do it for you.  Also with this assumption, the instrument should be sending a termination character.  So I tell the VISA Read to read more bytes than I expect and let the termination character stop the read.


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 10 of 11
(3,875 Views)