NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » thermocouple amplifier serial communication

August 18, 2012
by Akeshish
Akeshish's Avatar

Hello everyone, I recently bought a

http://www.adafruit.com/products/269

and have know idea how to Communicate serially with the micro controller. Also, I'm not sure how to extract the information produced by the amplifier. Meaning , how many bits, and the timing.

Can anyone point me in the right direction.

Thank you very much

August 18, 2012
by Ralphxyz
Ralphxyz's Avatar

Well the adfruit info is not much help.

I googled MAX31855

This article at least gives you some details.

They show the MAX31855 communicating directly with a micro:

With this line on communications:

The data is output in a signed 14-bit, SPIā„¢-compatible, read-only format.

So assuming (since adafruit doesn't say) that the communications protocol is still SPI just search the Nerdkits forum for SPI.

Now after you have read all of the threads get back to us with any questions :-)

Seriously SPI is a common serial communications protocol reading the threads should get you started.

Ralph

August 18, 2012
by Finis
Finis's Avatar

first set up spi

/*Set MOSI,SS and SCK to be output, MISO to be input, and all others are output*/
DDRB= 0xbf; // DDRB=0b10111111
/*Enable SPI,Master*/
SPCR=(1<<SPE) | (1<<MSTR);
/*Set clcok rate fck/2*/
SPSR=(1<<SPI2X);

then you must send out data to receive data

/*Start transmission*/
SPDR=0x00;                        //0x00 will be shifted out from MOSI pin, the data will be shifted
                                  // into SPDR register
/*wait for complete*/
while (!(SPSR&(1<<SPIF)));
data=SPDR;                   // save the high 8-bit data
data<<=8;                   // left * the data

/*Continue transmission*/
SPDR=0x00;                     // transmit low 6-bit data

while (!(SPSR&(1<<SPIF)));
data +=SPDR;              // combine the data
data >>=2;                // right shift the data

now you should have your 14bit data...

Post a Reply

Please log in to post a reply.

Did you know that you can connect digital calipers to a microcontroller? Learn more...