LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read buffer contains more than what I need

Hi,

Normally, this not the first time I use serial connection to control instrument.Strangely, this time I found that the read buffer contains as much byte as I spend time.I mean:if I put 1 second betwween write and read collect 200 bytes,if I put 3s I collect maybe 550 bytes.As you see in the VI, the read buffer contain the needed information(here the temperature) but among a lot of other information.If I change to true the enable termination char, I get just a troncated part of the buffer and always does not contain the desired information.

How can I fix this problem.I thought about taking a subset of the buffer string but this requires to know the first and the last position. In my case, it is not easy as this depend on the time of read ( more I spend time to read more I get information).

Thanks,

0 Kudos
Message 1 of 6
(2,380 Views)

Are you going to get just one temperature point each time you read the instrument and everything else is just numeric? If so, just use a regular expression to extract your temperature string:

 

RegEx.png

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 2 of 6
(2,359 Views)

The problem is that it not just a temperature, according to the command, I collect several data in the same time: viscosity, density, date...

0 Kudos
Message 3 of 6
(2,354 Views)

If your temperature string is formatted like you show in your upload, and it is the only string that is formatted in that way, the regex should work fine.

 

Cameron

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 4 of 6
(2,347 Views)

The upload is just a sample of commande and as I said the buffer read can be much more complicated with dates, table, unites, error messages...

0 Kudos
Message 5 of 6
(2,339 Views)

I don't see the problem here if the other data is not formatted exactly like the temperature data you illustrated. If other data were formatted exactly the same, how could you tell it is not temperature data? Might your temperature data be formatted some other way occasionally? If so, you have not given us the whole problem.

 

What is your difficulty here?

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 6 of 6
(2,326 Views)