Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

MAX6675 and 24LC256 conflict
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

MAX6675 and 24LC256 conflict

by Volkemon on Mon Aug 16, 2010 1:24 pm

LOVE the 6675 breakout boards. Just what I needed for a project .

Have two running on a duemilanove, reporting temperature to the serial monitor. Works fine:

Code: Select all | TOGGLE FULL SIZE
// this example is public domain. enjoy!
//

#include "max6675.h"

int thermoDO = 2;
int thermoCS = 4;
int thermoCLK = 3;



 
void setup() {
  Serial.begin(9600);
 

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

void loop() {
  // basic readout test, just print the current temp
 
   MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
   delay(500);
   
   Serial.print("  Sensor "); Serial.print(thermoCS - 3);
   Serial.print("  F = ");
   Serial.print(thermocouple.readFarenheit());
   
   thermoCS ++;
   if (thermoCS > 5 ){
    thermoCS = 4;
    Serial.println(" ");
   }
 
   
}



DO for both to Digital Pin 2, CLK for both on Digital Pin 3, CS for each on pins 4 and 5.

Now, if I add the code to write the data to a 24LC256, it freezes at the "Wire.endTransmission();" command.

Code: Select all | TOGGLE FULL SIZE
// this example is public domain. enjoy!
//

#include "max6675.h"
#include <Wire.h>
int thermoDO = 2;
int thermoCS = 4;
int thermoCLK = 3;
int Ftemp = 0;

char chipAdress=0x50;

 
void setup() {
  Serial.begin(9600);
  int Ftemp = 0;
 

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



void loop() {
  // basic readout test, just print the current temp
 
   MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
   delay(500);

   Serial.print("  Sensor "); Serial.print(thermoCS - 3);
   Serial.print("  F = ");
   Ftemp = (thermocouple.readFarenheit());
   Serial.print(Ftemp);
   DataSend(); 
   
   thermoCS ++;
   if (thermoCS > 5 ){
    thermoCS = 4;
    Serial.println(" ");
   }
 
   
}

void DataSend() {
   Wire.beginTransmission(chipAdress);
                     //Set up the chip Internal Address Pointer to the desired location
   Wire.send(0x00);  //First  7 bits of the address
   Wire.send(0x00);  //Second 8 bits of the address
   Wire.send(thermoCS - 3);
   Wire.send(",");
   Wire.send(Ftemp);
   Wire.send(",");
   Wire.endTransmission();      // comment this out to stop program from freezing up



I had the void DataSend() code in the main loop before, I isolated it here to try to eliminate the conflict. (Worked to solve a DS1307/24LC256 conflict I had before)

Running this code without commenting out "Wire.endTransmission();" and it returns one temperature reading on the serial monitor, then freezes. Commenting it out, and it runs normally on the serial monitor, and writes nothing to the 24LC256.

I read the MAX6675 libraries, and noted in max6675.cpp "#include <Wire.h>" is commented out, but nothing else obvious to me on why this doesn't work.


Thanks for reading.
Livin' , learnin' , lovin' and laffin'. Thanks for the help!
Image
User avatar
Volkemon
 
Posts: 127
Joined: Mon May 10, 2010 8:24 pm
Location: Melbourne FL USA

Re: MAX6675 and 24LC256 conflict

by Volkemon on Mon Aug 16, 2010 1:59 pm

D'OH!!!

Remembering to put Wire.begin(); in the setup sure cured that....

I saw it moments after posting.
Livin' , learnin' , lovin' and laffin'. Thanks for the help!
Image
User avatar
Volkemon
 
Posts: 127
Joined: Mon May 10, 2010 8:24 pm
Location: Melbourne FL USA

Please be positive and constructive with your questions and comments.