Quantcast
Channel: Instrument Control (GPIB, Serial, VISA, IVI) topics
Viewing all articles
Browse latest Browse all 5663

inconsistent visa read

$
0
0

Hey I'm using an Arduino Uno and have 4 thermocouples connected. The code I have seems to work fine but every ~15 readings, at random intervals the program returns 0 for two or three of the thermocouples. I added a delay to this program because it wasn't working without it, but could it also be the source of the problem? I have a 3 second delay programmed to the Arduino and a 1 second delay to the LabView code. 

Thanks!

 

Arduino 1.0.5 code:

 

 

#include "Adafruit_MAX31855.h"

int thermoDO = 3;
int thermoCS1 = 4;
int thermoCS2 = 4;
int thermoCS3 = 4;
int thermoCS4 = 4;
int thermoCLK = 5;

//Adafruit_MAX31855 thermocouple(thermoCLK, thermoCS, thermoDO);
Adafruit_MAX31855 thermocouple1(thermoCLK, thermoCS1, thermoDO);
Adafruit_MAX31855 thermocouple2(thermoCLK, thermoCS2, thermoDO);
Adafruit_MAX31855 thermocouple3(thermoCLK, thermoCS3, thermoDO);
Adafruit_MAX31855 thermocouple4(thermoCLK, thermoCS4, thermoDO);
//Adafruit+MAX31855 thermocouple5(thermoCLK, thermoCS5, thermoDO);
void setup() {
Serial.begin(9600);

Serial.println("MAX31855 test");
// wait for MAX chip to stabilize
delay(500);
}

void loop() {
// basic readout test, just print the current temp
//Serial.print("Internal Temp = ");
//Serial.println(thermocouple.readInternal());


double c1 = thermocouple1.readCelsius();
double c2 = thermocouple2.readCelsius();
double c3 = thermocouple3.readCelsius();
double c4 = thermocouple4.readCelsius();

if (isnan(c1)) {
Serial.println("Something wrong with thermocouple!");
} else {
Serial.println(c1);
Serial.println(c2);
Serial.println(c3);
Serial.println(c4);

}

delay(3000);
}


Viewing all articles
Browse latest Browse all 5663

Trending Articles