LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA read to array/graph

Solved!
Go to solution

@RavensFan wrote:

Interesting.

 

Then how do you print a literal backslash and "t"?

 

Why would this behave differently than other text based languages?


Isn't it quite common to interpret \t as tab, and \\ for Writing a backslash? C# uses it that way.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 11 of 15
(862 Views)
Solution
Accepted by topic author jmed87

@jmed87 wrote:

I was able to change the code to read by tab but I'm not really sure where to go from there when you say to read all of the sensor data and put it in variables or how to put it into code exactly?


Ok, let's simplify things some.  Get rid of the printTemperature function entirely.  Then change your loop routine to be like below.  This will create a line of tab delimited values that your LabVIEW code can very easily read.  Do note that sensor 5 is using the Serial.PrintLn.  This appends the termination character for you.  You then use Spreadsheet String To Array to turn the read string into an array of temperatures in C.  You can convert to F from here if you really want to.

void loop(void)
{ 
  delay(2000);
  sensors.requestTemperatures();

  Serial.print(sensors.getTempC(Sensor01));
  Serial.print("\t");
  Serial.print(sensors.getTempC(Sensor02));
  Serial.print("\t");
  Serial.print(sensors.getTempC(Sensor03));
  Serial.print("\t");
  Serial.print(sensors.getTempC(Sensor04));
  Serial.print("\t");
  Serial.println(sensors.getTempC(Sensor05));
}

So to put all of this another way, your format of the data over the serial port is way too complicated.  The serial data should just have the values and no fluff.  Any error checks and unit conversions can easily be done by the LabVIEW code on the PC before displaying the data.


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 12 of 15
(855 Views)

Thank you so much crossrulz for being patient with me and taking your time to explain and help with the code.  Really means a lot since I am trying to learn a variety of new things at once on my research team (not just programming but bacterial fermentation as well).  It all makes sense now.

 

Thanks again,

Josh

Message 13 of 15
(848 Views)

I was on Vacation last week, but I'm back now.  I created a text file by typing in the values from your screen shot and read that file in and I think this would be a good example for you to learn from.

Download All
0 Kudos
Message 14 of 15
(806 Views)

Converted to LabVIEW 2010.

0 Kudos
Message 15 of 15
(803 Views)