on7nh
Joined: 05 Jun 2006 Posts: 41 Location: Belgium
|
30f4013 and TC74A5 (SOLVED) |
Posted: Wed Apr 16, 2008 3:52 am |
|
|
Hello ,
i have a strange problem
I make a I2C connection to a TC74
the loop is working, bu i receive always a "0"
what could be wrong ?
Code: |
#include <30f4013.h>
#device adc=10
#FUSES NOWDT // Watch Dog Timer
#FUSES EC
#FUSES PR //Promiary Oscillator
#FUSES NOCKSFSM //Clock Switching is disabled, fail Safe clock monitor is disabled
#FUSES BROWNOUT //Reset when brownout detected
#FUSES MCLR //Master Clear pin enabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOCOE //Device will reset into operational mode
#FUSES ICS0 //ICD communication channel 0
#FUSES RESERVED //Used to set the reserved FUSE bits
#define XTAL_FREQUENCY 10000000
#use delay(clock=XTAL_FREQUENCY)
#use i2c(MASTER, SDA=PIN_F2, SCL=PIN_F3, FORCE_HW,slow)
#use rs232(stream = RS232, baud=115200,parity=N,xmit=PIN_F5,rcv=PIN_F4,bits=8)
int data;
int ack;
int fahr;
Void main()
{
set_tris_b(0xFFFF);
While(1)
{
i2c_start();
ack = i2c_write(0x9A);
ack = i2c_write(0x00);
/* send start again */
i2c_start();
ack = i2c_write(0x9B);
data = i2c_read(0);
i2c_stop();
printf("temp %D\r\n",data);
delay_ms(200);
}
}
|
Thanks
Carl
(edit)
Cleared Force_HW in the I2C(master settings.... |
|