syeda amna
Full Member level 4
- Joined
- Jun 1, 2010
- Messages
- 222
- Helped
- 24
- Reputation
- 48
- Reaction score
- 22
- Trophy points
- 1,308
- Location
- Pakistan
- Activity points
- 2,551
I m trying to interface TC72 temperature sensor with PIC. I m using CCS compiler. The problem is SCK and SDO pins are in idle state.
Code:
#include <18F452.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#fuses XT //for crystal
#use delay (clock=4000000)
#include <flex_for_test_lcd.c> //LCD driver
void main()
{
int i;
int value;
output_low(PIN_E2);
lcd_init();
//SPI//
setup_spi(SPI_SLAVE | SPI_H_TO_L);
output_bit( PIN_C0, 1); //Chip Enable
printf(lcd_putc, "%u" i);
spi_write(0x02); //For normal mode
spi_write(0x80); //Control Register Addr
i=spi_read(0x02); //Reading value from MSB
printf(lcd_putc, "%u" i);
}