Go Down

Topic: SPI Pins (Read 5181 times) previous topic - next topic


Wow that is quite a lot do digest. In my case the MAX6675 only sends data.

From the data sheet.

The Typical Application Circuit shows the MAX6675
interfaced with a microcontroller. In this example, the
MAX6675 processes the reading from the thermocouple
and transmits the data through a serial interface.
Force CS low and apply a clock signal at SCK to read
the results at SO. Forcing CS low immediately stops
any conversion process. Initiate a new conversion
process by forcing CS high.
Force CS low to output the first bit on the SO pin. A
complete serial interface read requires 16 clock cycles.
Read the 16 output bits on the falling edge of the clock.
The first bit, D15, is a dummy sign bit and is always
zero. Bits D14-D3 contain the converted temperature in
the order of MSB to LSB. Bit D2 is normally low and
goes high when the thermocouple input is open. D1 is
low to provide a device ID for the MAX6675 and bit D0
is three-state.

So for the MAX6675 my setup might be like this if I understand correctly. Darn the page for SPI.setDataMode() doesn't tell you what each mode is and gives you a link to a wiki page... so I'm guessing that SPI_MODE1 is the one I want.

Searching the data sheet I find "Serial Clock Frequency max 4.3 MHz". On the SPISetClockDivider page I find this "Sets the SPI clock divider relative to the system clock. The dividers available are 2, 4, 8, 16, 32, 64, or 128. The default setting is SPI_CLOCK_DIV4, which sets the SPI clock to one-quarter the frequency of the system clock. " I'm coming up blank on the system clock speed for the Uno...

Code: [Select]
// Initialize Serial-Parallel Interface:
        pinMode(pinSPI_SS, OUTPUT); // Set the slave/chip select pin to output.
        SPI.setBitOrder(MSBFIRST); // Send most significant bit first when transferring a byte.
        SPI.setDataMode(SPI_MODE1); // Base value of clock is 1, data is captured on clock's falling edge.
        SPI.setClockDivider(SPI_CLOCK_DIV4); // Set SPI data rate to 16mhz/4. IE: 4mhz.



Ok, I finally found it the system clock speed for the Uno is 16MHz so


should be ok for the MAX6675


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131