LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Read Timeout and VISA Write not working

I'm writing a program that sets a triangle wave pattern voltage (using Triangle Wave VI) to a DC power source (GWInstek PST-3202) through a RS-232 connection.  I know my instrument parameters are set up correctly because I've been able to control this power source using a different VI with the same parameters.  I also know I am connected to the power source because I can talk to it using MAX.  I have a string indicator before my VISA Write statement that shows me the command being sent to VISA Write.  It shows the correct syntax for setting a voltage on this instrument.  However, when I run the VI, the voltage is not changed on my instrument, even though the correct command is sent to the instrument.  After the VISA Write operation I have inserted a VISA Read function in order to read the newly set voltage from both a numeric and a waveform indicator.  Using the Error Out cluster I am able to see that there is a timeout error from VISA Read.  I thought perhaps I needed to clear or flush the buffer after each Read statement, but that didn't work either.  I'm stumped as to why VISA Write isn't writing to the device.  I have included my VI below, as well as the initialization subVI for the power supply.  

Download All
0 Kudos
Message 1 of 5
(3,238 Views)

I am going to go out on a limb here and suggest you might need some sort of flow control in your serial settings.

 

Have you turned on the trace to see where the error is first occurring?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 5
(3,225 Views)

I don't see anyplace where you are appending a termination character to your write. Why don't you attach the code that works?

Message 3 of 5
(3,220 Views)

I have attached a code that works.  I will look into the termination character issue.

0 Kudos
Message 4 of 5
(3,213 Views)

Yep, you need to append the End of Line character to the end of your command.  And for your read to work properly, you need to request the data.  That requires a querry command to be sent.  Look closely at the differences in command and communication structures between your working VI and your mod.


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
Message 5 of 5
(3,183 Views)