05-17-2012 02:18 PM
To confirm what I understood, whatever format VISA delivers data to LabVIEW, LabVIEW through VISA read function will return in one and ONLY format, that is 'String' . By using different LabVIEW string functions, the received data can be arranged and organized to represent the orignal input data structure. Is that right?
05-18-2012 06:06 AM
05-18-2012 06:26 AM
Another senario, I transfer a number, say 12 as BINARY DATA, so VISA will receive this bianary data as byte. Now VISA reads and returns something that is a string. My question is what will this string looks like when it is returned by VISA? If it is not the string '12', what string will VISA return when it is transferred as BINARY DATA? I need to know if I want to re-organize the data.
What if i want to transfer data like 12,13, 14 as BINARY DATA, what can I expect VISA will return?
05-18-2012 10:00 AM
I don't know which version of LabVIEW you are using but below is a small example of looking at data and "converting" it by telling the compiler that you want to look differently to the data.
starting with a string You see the chars with the value 1 and 2 making the string "12"
later I add the value 12 (ascii formfeed) to this string.
attached is the vi also in 2011, but you get the same if you place the snippet into an empty vi.
05-18-2012 03:41 PM
Thanks. It is really helpful.
05-31-2012 11:43 AM
I am now experiencing a problem when I send data with the format as 'DX' followed by 18 bytes repeat; DX followed by 18 bytes of data. By using VISA in LabVIEW, I cannot receive the same data structure. When I concatenated the string. It doesn't look right. How can I correct this?
06-03-2012 05:22 PM
Hi him,
How are you formatting your data to write, could you post your simplified code so we could see what we are working with?
06-04-2012 12:04 PM
Hi Bill, thanks for wanting to help. I solved the problem by putting the VISA WRITE function in the while loop. However, would you share with me some of your thoughts in improving serial data transfer speed in general?
06-05-2012 06:27 PM
Glad to hear that the problem was solved. In general, increasing the baud rate that the serial port is using will allow for quicker communication; however, this is highly dependent on the device you are using and the device you are connecting to as there are “standard” rates that are used based on the device.
Also, make sure the code that is reading from the port is in a separate loop (i.e. use a consumer/producer design pattern).
06-06-2012 12:38 AM
Hi Bill,
You said: Make sure the code that is reading from the port is in a separate loop (i.e. use a consumer/producer design pattern)
Can you give me a simple example in coding the VI?