Track My Order
Frequently Asked Questions
International Shipping Info
Mon-Fri, 9am to 12pm and
1pm to 5pm U.S. Mountain Time:
Chat With Us
October 18, 2013
about 3 years ago
Am a newbie in PIC programming. I recently purchase this tmp102 breakout board for my school project. Am trying to read the temperature register with PIC16F877A using CCS Compiler. I connect the SDA and SCL to the SDA and SCL pins of the PIC respectively and ADD0 to ground. The tmp102 is powered with 3.3vcc. Everything went weird as what am getting is 255(0xFF) and 255(0xFF) for the MSB and LSB respectively.
This might not be the appropriate place to post this challenge, but has any one done something related to this or can link me to other resources?
Here is the code am using in CCS C
// tmp102 code
#FUSES NOLVP, PUT
#use i2c(Master, sda=PIN_C4,scl=PIN_C3) // Configure Device as Master
#use rs232(baud=4800,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,stream=UART, ERRORS)
#define TMP_RD 0x72
#define TEMP_REG 0x00
fprintf(UART,"TMP102 Example \r\n");
unsigned int8 msb, lsb;
i2c_write(TMP_RD); // Read from this I2C address, R/*W Set
i2c_write(TEMP_REG); //Set pointer regster to temperature register
msb= i2c_read(1); //Read the MSB data
lsb = i2c_read(0); //Read the LSB data
printf(" %u ", msb); // check
printf(" %u ", lsb); // check
No public wish lists :(
Forgot your password?
No account? Register one!