Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple Serial.vi changing command string to string-type shared variable

Solved!
Go to solution

Hi, 

 

I am trying to communicate with VISA Serial instruments and I did it with example - Simple Serial.vi. However, I would like to use network-published shared variable (string type) to send command to the instruments by replacing the string command (*IDN?\n) to the shared variable with same command loaded into the variable. Figure below shows the Simple Serial.vi added into a .lvproj file and a shared variable "READ" is preloaded with exactly same command. 

 

May I know how to make it work as I am unable to communicate with the instrument once I changed the string command to shared variable? 

Thank you. 

Best regards, 

Wing 

 

wing98_0-1609735121301.png

 

0 Kudos
Message 1 of 5
(1,170 Views)

Attached with the zip file for the Simple Serial.lvproj 

0 Kudos
Message 2 of 5
(1,142 Views)

First I will state that I advise against Network Published Shared Variables.  They are slow, unsecure (anybody on the network can update the value), and often have weird race conditions.  What what is it that you are actually trying to accomplish?  There are likely better ways.

 

On the serial side, we need to know the device and its command structure in order to help at all here.  Again, I advise against using the NI example.  You might want to have a look at this: VIWeek 2020/Proper way to communicate over serial


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 3 of 5
(1,132 Views)

Hi 

 

 

0 Kudos
Message 4 of 5
(1,104 Views)
Solution
Accepted by topic author wing98

Hi all, 

 

I solved the NPSV problem by removing the termination characters in variables and adding Term Char manually to write into the machine and it works fine with my three different instruments. 

 

Thank you all for your replies. 

 

Best regards, 
Wing

0 Kudos
Message 5 of 5
(1,076 Views)