Since 3days I try to set up an interface between a PIC18F452 and a digital temperature sensor (TC72 or TC77, I have tested both).
I can send the commands to configure the config register but it still with the POR values.
First, I send 0x80 (to write the config register), then I send 0x04 (to set continuous temperature conversion).
Can you help me ? Do the commands I send are right ?
This is my code :
And two screenshots :
1° : my card : **broken link removed**
2° : my signals : **broken link removed**
green : CLK
red : SDO of the pic
blue : SS (chip enable)
At power-up, the SHDN bit is set to ‘1’. Thus, the TC72
is in the shutdown operating mode at startup. The Continuous
Temperature Conversion mode is selected by
writing a ‘0’ to the SHDN bit of the Control register.
...
The One-Shot mode is selected by writing a ‘1’ into bit
4 of the Control register.
To start continous temperature conversion write 0x00 to 0x80. This clears all bits.
To do a one shot temperature reading write 0x10 to 0x80. This sets bit 4.
It is easy to get the bit numbers mixed up with the bit values. For example the value of bit 4 is 0x10. Rather then just using these values read the data sheet till they make sense. (Hey I could have muffed it).
I think that the TC77 is better suited for bit-banged SPI. If you have or want to use the MSSP of the PIC, the TC72 is a better choice because it has a true SPI interface.
EDIT: I've noticed the 'tcc' spec (CE to SCK Setup) in the datasheet of the TC72; at high clock frequencies (>10 MHz) you might try adding a short delay after setting the CE bit?