简体   繁体   中英

importing flow meter reading to excel via serial communication port

I'll be getting readings from an flow meter to serial port via serial communication.

I need to automatically collect incoming flow rate readings at 1 minute intervals for every hour.

Then i need to automatically calculate an average for each hour.

The hourly averages are calculated using the readings collected at 1 minute intervals.

The averages should then be displayed in MS excel.

  1. Can i use Visual basic for applications and excel or should i use NI lab view?
  2. Should i use another method?

What is the best proven way to perform this?

I will be suggesting to use NI LabVIEW to connect to RS trough VISA. There are build in and additional libs to work with RS there. To export to excel you can use write to spreadsheet .vi or to do it professionally go with NI Report Generation Toolkit for LabVIEW.

Please let me know if you need more info.

There are many ways of achieving this, but if you have access to LabVIEW and you have details of the data format used by your flowmeter then LabVIEW is a good choice.

Use the serial functions in the Instrument I/O>Serial palette to read the data - look at the examples provided with LabVIEW to learn how to do this. You may want to use Scan from String to interpret the flowmeter's output and convert it into a number, then you'll probably want to put that code inside a While loop to accumulate the numbers into an array, and calculate the average once you have collected the required number of points.

To write the data to Excel you can use Write To Spreadsheet File to save it in tab- or comma-separated format, or Express>Output>Write to Measurement File which can save as .xslx.

If you don't yet have access to the hardware, you can use a case structure or conditional disable structure to either perform the serial I/O or to return simulated data to the rest of your program. Or (better) if you have two serial ports on your computer, you could physically connect the two ports with a null modem cable and either use a terminal program to send simulated data or write a second LabVIEW VI to emulate the flowmeter on the second serial port - LabVIEW should have no problem running the two VIs simultaneously.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM