yosh1426459906 0 Posted January 28, 2013 Share Posted January 28, 2013 Hello everybody, I'm totally new to microcontroller programming, so please excuse my question ;-) I am planning to build up a thermocouple reader for 4 thermoelements. The stellaris datasheet states, that there are four SPIs available. I would like to use these, to connect four MAX31855 thermocouple ICs on seperate "lines", so that the four MAX31855 do not have to share a single channel. According to some reading in the net, a single temperature reading needs about 100ms of time, so I could make 10 readings a second. Is it possible to make 10 readings a second on all four MAX in parallel, so that I get 4 x 10 readings a second? I would like to use Energia for programming, but I'm not sure how to achive the "parallism" - my guess is, that if one reading needs 100ms, I could only get 2,5 reading per second per MAX31855 if I use four of them, since the temperature reading functions have to be called from inside the loop()-Function and the code examples I saw used delay(100)-calls!? Kind regards, yosh Quote Link to post Share on other sites
bluehash 1,581 Posted January 28, 2013 Share Posted January 28, 2013 You could read them one after another on the same SPI port, but different select lines. They would be off by a few ms this way. Quote Link to post Share on other sites
yosh1426459906 0 Posted January 28, 2013 Author Share Posted January 28, 2013 Hi bluehash, thanks for your reply. The problem is not, that the readings of the four thermocouples could "be off by a few ms". The problem is, that I want 10 readings/sec on each thermocouple, so 40 readings total per second. So from my understanding this could only be done, if I use four seperate SPI ports - or am I wrong? The 100ms delay in the code examples confuses me ;-) Or do you think it would be sufficent to make the 4 "readTemperature"-calls and then wait the suggested 100ms? Kind regards, yosh Quote Link to post Share on other sites
bluehash 1,581 Posted January 28, 2013 Share Posted January 28, 2013 I would do it this way: - Setup all 4 sensors on one SPI port, with differetn chip select lines. - Setup a timer to interrupt every 100ms. - Once the timer interrupts, poll sensor 1, then 2, then 3 and then 4. - done. Repeat when timer interrupts. Quote Link to post Share on other sites
hvontres 22 Posted January 28, 2013 Share Posted January 28, 2013 Also, one other thing to keep in mind is that one of the configurations for the SPI pins confilicts with the pins used for the on-board RGB LED. So in order to use all four SPI ports, you would need to remove some 0-ohm resistors. bluehash 1 Quote Link to post Share on other sites
yosh1426459906 0 Posted January 29, 2013 Author Share Posted January 29, 2013 Thanks for the replies, @bluehash: ok, I'll try it this way - I think I was on the false track regarding the 100ms. Your suggestion makes sense, since the 100ms are only needed for the MAX to "settle down", but a single reading of course will be shorter than this time. So after four polls all sensors have the mentioned 100ms until next reading. @hvontres: Thanks for the hint, I will keep this in mind, e.g. when wiring a SPI-LCD. Kind regards yosh Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.