LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA read always returns blank

Solved!
Go to solution

Please see the attached code screen shot . Its a VISA session trying to communicate with a CAN to BlueTooth convertor. In the area marked red, I dont read any data at all. This despite the fact the "Bytes at Port" property node reading a value of 27 ! So where are the bytes gone ?? And it is not that all the reads are like this. - in the previous state I have a query for Version no as " V<CR> " for which the VISA read is "CANgine BT Version xxxx" . I am not sure why t his read alone returns a blank always. ?? I have tried the while loop with delays from 10 to 200ms and nothing wrong with the commands also - they work as expected on Hyper Terminal.  And even in this code I am able to read the number of bytes as 27. So whay dont they show up ?? Does LV2012 have a new data type : INVISIBLE ??? Smiley Very Happy

VISA_Blank Read Buffer_1.png

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 1 of 32
(6,181 Views)

Hi Raghunathan,

 

without seeing all the code:

Is it possible you selected a termchar for your VISA connection? Maybe the first char in the buffer is this termchar and so VISA-Read will give you an empty output string...

Best regards,
GerdW


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

Yes I do have a Termination Charatcter selected and it is <CR> .

 

But my problem is not due to this ( or so I guess ) as the "Bytes in Read Buffer" property node  shows 27 bytes or some other finite number of bytes based on  the command. But why am i not able to see these in the indicator connected to the Read vi ? ( Incidentally I have also tried to read without the TermChar but still no improvement )

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 3 of 32
(6,163 Views)

Have you checked the errror going into the read? If there is an error on the error wire the read will return immediately without reading any data.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 32
(6,141 Views)

How many kudos does anyone care to wager that the device is terminating transmissions with a CRLF? leaving (of course) a LF in the buffer.  subsequent reads then start with a single "blank" line and the rest of the text is hidden on a line below that is not displayed?

 

Try a trim whitespace function. 


"Should be" isn't "Is" -Jay
Message 5 of 32
(6,126 Views)

@JÞB wrote:

How many kudos does anyone care to wager that the device is terminating transmissions with a CRLF? leaving (of course) a LF in the buffer.  subsequent reads then start with a single "blank" line and the rest of the text is hidden on a line below that is not displayed?

 

Try a trim whitespace function. 


If that's true, I would change the termination character to a LF as well as using the Trim Whitespace.


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 32
(6,116 Views)

Thanks for the tips. My device does not accept a LF as termination character.

 

I have tried with a white space and also checked for any errors. Still no luck . As you can see from  the image below, there is 47 bytes at the Read buffer, excpet that it is hoidden from me - I still dont read it in the indicator named Read Buffer.

StripWhiteSpaces.png

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 7 of 32
(6,093 Views)

Have you tried changing the string indicator display format to look for non-printable characters? Right click on the string indicator and set the format to "\ codes display" or "Hex display". Perhaps those 47 bytes are all non-printables.

0 Kudos
Message 8 of 32
(6,091 Views)
Someone who is not on a mobile device as limited as mine.

please post an ASCII tutorial link.

(Slightly embarrassed) the op may not know LF is otherwise represented by seven bits

"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 32
(6,079 Views)

This looks like a decent tutorial on ASCII http://blob.perl.org/books/beginning-perl/3145_AppF.pdf.

 

I recommend that he wire an indicator on the "Return Count" connector of the VISA read.  While there may be 47 bytes at the port, this indicator will show how many bytes are actually returned with the VISA Read.  By his definition,  "always returns blank" would show zero bytes returned from the VISA read.  I don't see any way that could be happening.

 

Another recommendation.  Put an indicator directly at the output of the VISA read.  Run the VI once.  Then choose Edit >> Make Current Values default.  Save the VI and post it here.  That way we can see what is actually being returned from his device.

Message 10 of 32
(6,059 Views)