LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading from CO2 sensor connected to the PC

Solved!
Go to solution

Hi Gerd

 

Sorry for not being completely clear on what I am dealing with. I have attached the error I am getting when I connect the string from VISA Read to the Scan From String and run the VI. 

 

Greetings 

DP

0 Kudos
Message 31 of 63
(1,538 Views)

Hi DP,

 

I have attached the error I am getting when I connect the string from VISA Read to the Scan From String and run the VI.

This error has NOTHING to do with your chart - why do you think so?

It's an error in the ScanFromString function and it has been discussed before.

Did you follow all the suggestion you got so far?

What is the string you want to parse? Which string content does enforce this error message? Why do you receive this string content?

Why is there no error handling after ScanFromString?

Please read your whole thread and follow all those suggestion you got!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 32 of 63
(1,535 Views)

Hi Gerd

I know the chart is not what is causing an error. The reason I called it error chart is becausing the chart is what I am trying get to work.

Yes I followed all the suggestions. I even tried putting in trim whitespace etc. I just probed and I am not receiving any data from the VISA Read? Give me a minute I am gonna attach a screen of the probe window. 

 

Greetings 

DP

 

0 Kudos
Message 33 of 63
(1,530 Views)

Here it is

0 Kudos
Message 34 of 63
(1,514 Views)

I made a mistake read from the wrong com port. Oh man I might be a little bit out of my self today. Well I am not getting an error now and it is reading data but nothing is being displayed on the chart. 

 

Greetings 

DP

Download All
0 Kudos
Message 35 of 63
(1,511 Views)

Hi DP,

 

it seems (as I can tell from your image, where important parts are hidden) you STILL try to parse the very first line of your string, which does NOT suit to your format string!

 

The first line just reads "number z number" while you scan for "Z number z number"!

 

You have been told NOT to collect all data in a big string by concatenating - but you still do!

You have been told to get rid of the very first line in the string - but you still don't follow this advice!

 

I repeat:

Read the whole thread and follow the suggestions given to you!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 36 of 63
(1,502 Views)

Hi Gerd

 

Is this how it should be wired up? I also removed the shift registers as suggested by Raven earlier.

I have noticed that the first line is not being read correctly but I do not know how to remove the first line. Now I am not getting an error but the chart is still not responding. 

 

Greetings 

DP

Download All
0 Kudos
Message 37 of 63
(1,497 Views)

When I run just the part of your code where it takes the string and feeds it through the scan from string, and I type in what I see on your Repsonse indicator, your code runs just fine for me.  See the image below.

 

One question I have is that you are writing the command "*IDN?" which is the kind of thing you send to a device to query it for identifcation information, but you are getting back your Z data.  Does that seem correct?

 

Are there other things coming into that response string that we can't see.  Try displaying that response string with \codes display.

 

 

On your previous front panel screen shot, you had Enable Termination character turned off.  Why did you do that?  I think that is why you got multiple lines in one message.  This time you enabled the termination character and got a single line.  How fast is this device sending data?  Is it sending one line of data every time you send the *IDN? command?

0 Kudos
Message 38 of 63
(1,494 Views)

Hi Raven

 

The command IDN was already in the example in labview and that is why I just left it there. I actually did not know what it did until you just explained it. So what should I replace it with? 

The reason why I disabled the termination character was just to see what difference it would make. Not any really good reason 🙂

 

Greetings 

DP

 

 

Download All
0 Kudos
Message 39 of 63
(1,489 Views)
Solution
Accepted by DP123

@DP123 wrote:

The reason why I disabled the termination character was just to see what difference it would make. Not any really good reason 🙂


The termination character allows the VISA Read to stop when that character is read.  Since your data always ends with a 0x0D0A combination, you really want the termination character to be turned on and with the 0xA as the termination character.

 


@DP123 wrote:

The command IDN was already in the example in labview and that is why I just left it there. I actually did not know what it did until you just explained it. So what should I replace it with?


Since it looks like your instrument just sends you data at a periodic rate, I would just get rid of the writing part.

 

Something you should probably do is add a read before your loop.  You can just throw that data away.  The point of this read is to remove any partial messages and synch up to the start of the messages.

 

One more thing I just noticed: your messages start with a space as well.  So you need to add a space before that Z in your format string.


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 40 of 63
(1,485 Views)