01-31-2017 07:54 AM
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
01-31-2017 08:08 AM
01-31-2017 08:11 AM
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
01-31-2017 08:21 AM
01-31-2017 08:27 AM - edited 01-31-2017 08:27 AM
01-31-2017 08:38 AM
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.
01-31-2017 08:51 AM
Hi RavensFan,
I raised the timeout to 30000 , and i wired the byte to read nmber to a 48 constant , attached the vi after the modifications and the result
01-31-2017 09:05 AM
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?
01-31-2017 09:07 AM
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!
01-31-2017 09:18 AM - edited 01-31-2017 09:18 AM
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.