annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

RS232 communication with LabView

Hello, I'm about to start working with LabView for semiconductor electrical validation, so far I'm completely novice in LabView.
I'm assined to perform certain validation tests that require synchronization with hardware events by means of serial communication with the external hardware on which measureemnts are conducted. The communication is to be handled by means of RS232 port message reception, parsing and decoding.
I understand LabView is able to communicate with measurement equipment by several ways, including RS232, so I though to employ this method in my approach. We will have our hardware connected to PC via COM and the hardware will sent text messages (such as text lines in TXT file) to the PC where they would be picked by LabView. The parsing needs to be performed on these text lines to fetch out only those that correspond to our required measurement tasks (these text lines are flags to start particular measurements). As soon as the text message is accepted and parsed, given it is recognized as relevant one by LabView, certain decoding is necessary to be performed on these message in favor of further test report and then the necessary measurement is to be triggered.
I guess I'll have to write my own code of text message parser and decoder.
Once the measurement is initiated, the samples stream (to be compiled into Excel tables) must be synchronized in time as much as possible with the following text messages received through COM that are relevant to the test. I.e. each text message that is relevant contains a running unique time stamp marker, so the measurement samples are need to be somehow synchronized to these messages by means of these time stamps.

I hope experienced users out there will be able to hint me whether the said above is viable and realisable in LabView without some without some heavy coding overhead ?

Thanks in advance, Alex
0 Kudos
Messaggio 1 di 43
12.126Visualizzazioni
This sounds like a fairly common use of LabVIEW and you should certainly be able to do it. There are shipping examples for serial communication (i.e. Basic Serial Write and Read) that can help you get started with that. The parsing of the response can be done with the Scan From String. A simple shipping example is called Parse String. the majority of the instrument drivers at the Instrument Driver Network involve string parsing in one way or another so there are additional VIs there that you can look at. You might also want to look there to see if drivers already exist for the instruments you plan on using. I would recomend you use GPIB or Ethernet based instruments instead of serial though. The communication is more robust and faster. Getting a timestamp just requires you to call the Get Date/time In Seconds whenever you do a serial read. This data can be combined with the serial read and written to a text file in spreadsheet format with Write to Spreadhseet File. If you want to write directly to Excel, I would recomend the Report Generation Toolkit as the easiest way to do that.
Messaggio 2 di 43
12.114Visualizzazioni
I agree with Denis. Infact a good starting point will be to look at examples in LabVIEW Examples directory. I have programmed such applications and the best way to go about it is to use Hyperterminal in conjunction with LabVIEW while developing the code. You can post here if you get in trouble, but for most part I would say it should be straightforward.
0 Kudos
Messaggio 3 di 43
12.096Visualizzazioni

Hi spider_1112002,

 

I am working with RS232 communication using Labview. I have thermocouple input module connected to the PC through a RS232 serial port. I am using the labview example file Basic serial read and write to communicate to it. I am able to configure the module using the Write string and reading the output from the module in read string.

 

The output it shows in read string is something like this, A25\r here, A refers to the header, 25 the temperature I am reading and \r the carriage return.

Intend to operate the thermocouple input module in a continuous fashion at different frequency and I would like to get this output (either in the form of string (A25\r) or just the temperature value (25)) in a text file.

 

I tried using the "write to measurement file" but it doesn't write the value displayed in the read string to the output text file. Also I tried using write to text file option and it writes only one data (such as A25) to my output text file.

 

Can you help me get over this problem. Appreciate your help.

 

If I had posted this in an inappropriate section please direct me to the right place.

 

Thank you,


vzv

 

0 Kudos
Messaggio 4 di 43
11.251Visualizzazioni

Hi spider_1112002,

 

I am working with RS232 communication using Labview. I have thermocouple input module connected to the PC through a RS232 serial port. I am using the labview example file Basic serial read and write to communicate to it. I am able to configure the module using the Write string and reading the output from the module in read string.

 

The output it shows in read string is something like this, A25\r here, A refers to the header, 25 the temperature I am reading and \r the carriage return.

Intend to operate the thermocouple input module in a continuous fashion at different frequency and I would like to get this output (either in the form of string (A25\r) or just the temperature value (25)) in a text file.

 

I tried using the "write to measurement file" but it doesn't write the value displayed in the read string to the output text file. Also I tried using write to text file option and it writes only one data (such as A25) to my output text file.

 

Can you help me get over this problem. Appreciate your help.

 

If I had posted this in an inappropriate section please direct me to the right place.

 

Thank you,


vzv

 

0 Kudos
Messaggio 5 di 43
11.250Visualizzazioni

That post was from 2006 but you're in the right place.  Sounds like your problem is NOT with RS-232 but rather writing data to a file correct?  There are many examples that show how to do this:  Help > Find Examples... Fundamentals > File I/O

 

If none of those help you, post your code.  This is usually a pretty trivial task but your problem description isn't sufficient to guess what's wrong.  Although you may want to make sure you are APPENDING to the file to avoid overwriting it each time you read data.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
Messaggio 6 di 43
11.238Visualizzazioni

Hi NIquist,

 

Appreciate your reply. I am reading the serial port and yes, my problem is with writing data into a file. The examples files were a little helpful and I have constructed a VI with that and attached with this post. I am reading the port at 500 ms frequency (delay before read)  for 5 seconds, for which I expect upto 10 values logged into the file. But I see only one ('A25'). I am operating at room temperature (no fluctuations in temperature), so I am not sure whether this 'A25' is the first or the last read string from the port.

 

I am using LABVIEW 2012 SP1 (32bit)

 

Thank you,

 

vzv

 

0 Kudos
Messaggio 7 di 43
11.219Visualizzazioni

You are writing to the file, which if it wasn't opened before, will overwrite the data in the file.  Then you set the file position to the beginning, then do nothing after that.  Then your VI ends.

 

You aren't using continuous run are you?

 

If you rerun the VI, then the whole process starts over, and you still wind up with only one piece of data in the file.

Messaggio 8 di 43
11.199Visualizzazioni

I am using continuous run for my work. My intended idea was to select the text file at the beginning of each data collection (create/open existing file) such that the values from the board are stored as a list in a new text file or get appended (if it is an already used text file) during the continuous run.

 

I don't see a difference when I change the set file position between start/current/end. How do I avoid this overwriting of the data?

 

Thank you,

 

vzv

0 Kudos
Messaggio 9 di 43
11.175Visualizzazioni

@vzv wrote:

I am using continuous run for my work. My intended idea was to select the text file at the beginning of each data collection (create/open existing file) such that the values from the board are stored as a list in a new text file or get appended (if it is an already used text file) during the continuous run.

 

I don't see a difference when I change the set file position between start/current/end. How do I avoid this overwriting of the data?

 

Thank you,

 

vzv


You need to set the file position before writing to the file.  This requires opening the file first and also be sure to close it when complete.


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
Messaggio 10 di 43
11.170Visualizzazioni