LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 to USB communication

Hello, 

I have a device to run the pressure test with the RS232 port which is connected to the labtop through USB adapter. 

the device is manually start testing by pushing a button and will stop sending data after the test stop

i tried to save the out put to the notepad file using the Visa read to file command, the date will update but no result are saved in the file. 

Also the output format is in txt, how can i copy and paste it in the excel?

please see the program below:

 

 

Thanks

 

0 Kudos
Message 1 of 3
(3,967 Views)

First, don't do a VISA Open within the while loop, that should be done before the loop starts.  And don't forget to do a VISA close when the loop is done.

Are you sure your communication settings are correct?  I would use VISA  Configure Serial Port instead of VISA open as that sets the baud rate and other serial settings for you.

 

I have never used VISA Write to File.  I would use a regular VISA Read.  Then open a file, and write the data you got into that.  If you use Write to Spreadsheet File, or Write to Delimited File as it is now called, you can create a text file that can be easily imported into Excel.

0 Kudos
Message 2 of 3
(3,939 Views)

Hi Armik96,

 

Couple things to add.  I have always found the "Basic Serial Write and Read.vi" very useful for testing an RS232/USB connections.  This can be found under Help -> Find Examples.  You can move the VISA configure and close outside the for loop as Raven's Fan suggested.

 

If you create a text file named *.csv that is comma delimited and each line is terminated by a carriage return and or line feed (CR or LF).  Excel will open this file directly (see attached).

 

As always break the problem into pieces and solve each piece separately then combine for the final solution.

 

Do you have a sample output you can share?  You may be able to format it properly first before saving it using the "Write to Spreadsheet file".

(To get the "write to spreadsheet file" or "Write to Text File" use command+spacebar in LabVIEW and search it from Quick drop or from the File I/O palette)

 

Good luck,

-SS



0 Kudos
Message 3 of 3
(3,909 Views)