Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] TC72 interfacing with PIC18F452

Status
Not open for further replies.

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.

LCD.JPG

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);

}
 

I don't believe that the processor should be setup as a SPI slave. But it explains pretty well why you don't see any bus activity. I would try master mode.
 

FvM TC72 operates as a slave. I configured processor as a master. plzz help me.
 

I configured processor as a master.
Not in the code shown in post #1.
Code:
setup_spi(SPI_SLAVE | SPI_H_TO_L);
The setup is wrong in two regards: Setting slave mode and SPI mode 2. TC72 however expects mode 1 or 3. This setup should work:
Code:
setup_spi(SPI_MASTER);
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top