Thermocouple IC (MAX31856) & digital Pot (MCP4261) not getting along...

Hi everyone,

I've been trying to use a thermocouple IC (using a SEN-30005 from playingwithfusion.com which embeds a MAX31856) in order to read a Type-J probe and then replicate it with a digital POT (MCP4261, the bare IC this time) in order to emulate a classical variable resistance type temperature probe.

Both modules are hard-wired with one CS on the pin#2 and the other one on the pin#3, they of course share the SPI bus.

It actually works with the two different example sketches I found but when I try to merge them, it just doesn't work...

One of my lead is that one sketch uses the spi.h library while the other doesn't (and does it in soft? just not sure how it works).

So anyway, both sketches are attached (MAX31856 & TESTMCP4161) and the "result" sketch is also there (TEST_POT_TJ).

Would any of you guys be able to point me in the right direction?
Where do I start to troubleshoot this SPI (I think) problem?

Thanks by advance,

Marc

max31856.ino (2.06 KB)

TESTMCP4161.ino (4.32 KB)

TEST_POT_TJ.ino (3.85 KB)

Please post the programs here rather than attaching them to avoid the need to download them to get them into the IDE or an editor. Use code tags when you do.

  digitalPotWrite(wiper0writeAddr, 0); // Set wiper 0 to 200
  digitalPotWrite(wiper1writeAddr, 0); // Set wiper 1 to 200
  delay(lung);

  digitalPotWrite(wiper0writeAddr, 0); // Set wiper 0 to 200
  digitalPotWrite(wiper1writeAddr, 255); // Set wiper 1 to 200
  delay(lung);

  digitalPotWrite(wiper0writeAddr, 255); // Set wiper 0 to 200
  digitalPotWrite(wiper1writeAddr, 255); // Set wiper 1 to 200
  delay(lung);

  digitalPotWrite(wiper0writeAddr, 255); // Set wiper 0 to 200
  digitalPotWrite(wiper1writeAddr, 0); // Set wiper 1 to 200

Those comments can't all be right. Incorrect comments are worse than no comments.

The combined code does something, no matter how useless. You expect the code to do something, no matter how incorrect the comments are. "It doesn't work" doesn't cut it, in terms of telling us what the code actually does, and how that differs from what you want.

Hi Guys,

Sorry about the attachments, in some other posts people gave me a hard time for including code in quotes and now for not including it... :slight_smile:

Regarding the comments, they are only from the sketches I used (they're not mine)...

Sorry about that,

I'll try to pinpoint the problem a bit more before I ask you guys back for some help.

Marc

marc426:
Hi Guys,

Sorry about the attachments, in some other posts people gave me a hard time for including code in quotes and now for not including it... :

So don't use quote tags, use code tags