Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

visa serial read and usb 6008 read simultaneously

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? 

0 Kudos
Message 11 of 22
(1,398 Views)

completely right.

greetings from the Netherlands
0 Kudos
Message 12 of 22
(1,375 Views)

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? 

0 Kudos
Message 13 of 22
(1,372 Views)

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.

strings and bytes

attached is the vi also in 2011, but you get the same if you place the snippet into an empty vi.

greetings from the Netherlands
0 Kudos
Message 14 of 22
(1,366 Views)

Thanks. It is really helpful.

0 Kudos
Message 15 of 22
(1,353 Views)

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?

0 Kudos
Message 16 of 22
(1,333 Views)

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?

------------------------------
Bill E. | Applications Engineer | National Instruments
0 Kudos
Message 17 of 22
(1,302 Views)

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?

0 Kudos
Message 18 of 22
(1,291 Views)

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).

------------------------------
Bill E. | Applications Engineer | National Instruments
0 Kudos
Message 19 of 22
(1,273 Views)

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? 

0 Kudos
Message 20 of 22
(1,267 Views)