Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to have visa to write to text file

Solved!
Go to solution

I am trying to get my RS-232 to read data from a strain gauge and then write it to a text file. I think it is reading the data but not writing it to a text file. The VI is attached below 

0 Kudos
Message 1 of 21
(228 Views)

1. DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (still not enough emphasis)

 

Most instruments have a termination character that you can use.  You already have it enabled.  So just tell the VISA Read to read more bytes than you ever expect in a message.  I generally use 50 or 100.

 

2. You need to create the file before the loop, close it after the loop, and then you can write to the file all you want inside of the loop.

 

3. Why do you have a 10000 second timeout?  Perhaps you should talk more about your device and how often it is pushing out data.

 

See if this code helps.

EDIT: I just realized I forgot to set the "operation" input of the Open/Create/Replace File to "create or replace".


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
Download All
0 Kudos
Message 2 of 21
(209 Views)

I am getting this now. -1073807339 Visa Read in Tension code .vi. The timeout was just from what I created when adding a constant to it. I also changed the VI to the one you recommended. 

0 Kudos
Message 3 of 21
(189 Views)

@Stephenyoung wrote:

I am getting this now. -1073807339 Visa Read in Tension code .vi. The timeout was just from what I created when adding a constant to it. I also changed the VI to the one you recommended. 


So at this point, we need a lot more information on what device you are trying to read from.  How often is the data sent?  What is the exact format of the messages?

 

For more ideas of what we might need (and communicating over serial), you should probably go watch this video: 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
Message 4 of 21
(183 Views)

It is a strain gauge that is then being sent to a TS621 amplifier that is then sent to an RS232 then sent to my computer. I am going to assume that it is sending a stream of data because I will have it setup to a machine and need it to run until I stop it. I would also like for it to be outputted to a graph but am unsure of how to set that up as well. I am not sure how the data is formatted.

0 Kudos
Message 5 of 21
(175 Views)

How are you sending the output of the RS621 amplfier to an RS232?

 

RS621's output is either voltage or current, so the question is how are you converting this voltage or current into a digital signal that you then sent to a serial port?

0 Kudos
Message 6 of 21
(159 Views)

It is just ran directly from the TS621 to the RS232. I didn't build the machine. It was given to me and told to connect it to labVIEW for historical tracking of data. 

0 Kudos
Message 7 of 21
(145 Views)

The TS621 does not have RS232 communications, just analog output(s):

https://honigmann.com/i14/Tensiotron-TS621-Strain-gage-amplifier.html&lang=2#dld

 

You would need to use a DAQ card instead to measure voltage

 

-AK2DM

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 8 of 21
(137 Views)

I believe it does have a DAQ card installed. My problem is that it keeps throwing out  error -1073807253 at VISA Serial Read  

0 Kudos
Message 9 of 21
(133 Views)

DAQ cards don't use VISA but rather the DAQmx (or plain DAQ if it is a really old DAQ card) driver.

 

Perhaps there is another piece of equipment in your setup that uses serial communications?

 

-AK2DM

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 10 of 21
(127 Views)