Hello,
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)
Thanks
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 :
Code:
#include <p18f452.h>
#include <delays.h>
#include <spi.h>
#define SS PORTAbits.RA2
void init_pic(void);
void init_spi(void);
char i=1;
void init_pic(void)
{
TRISA=0b00000000;
TRISB=0b00000000;
TRISC=0x10;
ADCON1=0x06;
}
void init_spi(void)
{
SSPSTAT=0b01000000;
SSPCON1=0b00110001;
}
void main(void)
{
init_pic();
init_spi();
SS=1;
SSPBUF=0x80;
while(!PIR1bits.SSPIF);
SSPBUF=0x94;
while(!PIR1bits.SSPIF);
PORTB=SSPBUF;
SS=0;
while(1);
}
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)
Thanks