3-Wire Serial SPI Temperature Sensor (MAX6629) with an Arduino Uno


hi,

i have brought max6629 spi sensor found here:

https://datasheets.maximintegrated.com/en/ds/max6629-max6632.pdf

i have hooked vcc, gnd, miso (arduino) (max6629), pin 10 (arduino) cs, , sck.

the code have uploaded arduino uno shown below. not getting out? if take @ datasheet, can see 16 bits used, code reading right?

code: [select]

#include <spi.h>

double readcelsius(uint8_t cs) {
    uint16_t v;

    digitalwrite(cs, low);
    v = spi.transfer(0x00);
    v <<= 8;
    v |= spi.transfer(0x00);
    digitalwrite(cs, high);

    if (v & 0x4) {
        return nan;
    }

    v >>= 3;

    return v*0.25;
}

void setup() {
    spi.begin();
    pinmode(10, output);
    digitalwrite(10, high);
    serial.begin(115200);
}

void loop() {
    serial.print(readcelcius(10));
    serial.print(" ");
    delay(1000);
}


thanks!

quote
i have hooked vcc, gnd, miso (arduino) (max6629), pin 10 (arduino) cs, , sck.
just clarify: sck means pin 13 on arduino side, doesn't it?

quote
however not getting out?
does mean nothing or 0 output?

quote
if take @ datasheet, can see 16 bits used, code reading right?
with exception use unsigned integer instead of signed 1 code looks ok.


Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > 3-Wire Serial SPI Temperature Sensor (MAX6629) with an Arduino Uno


arduino

Comments

Popular posts from this blog

Installation database is corrupt

Nogen der kender et simpelt hvidt template med topmenu kun - Joomla! Forum - community, help and support

Error compiling for board Arduino/Genuino Uno.