Quantcast
Channel: MSP low-power microcontrollers
Viewing all articles
Browse latest Browse all 62309

Forum Post: RE: problem using i2c from MSP-EXP430FR5994_Software_Examples

$
0
0
Thank you for your advice! I have changed the slave address to the address to the MCP9808's address (0x18) and I have hooked up my system to the oscilloscope. Unfortunately I aam still encountering errors. Firstly it appears that no data is being transmitted on the I2C bus. The scope remains flat on both the SDA and SCL lines, there is no indication the the Address code or the read/write bit are being transmitted at all, let alone acknowledged. I have tried both reading and writing over the bus to no avail. Both the SDA and SCL pins are outputting a solid ~5V. I am trying to read a temperature, and convert it to a voltage that will be written to a MCP4725 DAC. I believe my error lies within the software setup of the I2C bus: #include #include #include #include #include #include "i2c_driver.h" double convertHexToTemp(uint8_t *tempData); uint8_t* convertTempToVolt(double Temp); int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer initI2C(); printf("I2C initialized!\n"); const uint8_t tempSensorAddress = 0x18; const uint8_t tempSensorRegistery = 0x05; const uint8_t DACAddress = 0x62; while(true) { uint8_t * TempData = malloc(sizeof(uint8_t) * 2); readI2C(tempSensorAddress, tempSensorRegistery, TempData, 0x02); printf("Data transmission complete\n"); double Temperature = convertHexToTemp(TempData); printf("This is the Temp! %f \n" , Temperature); uint8_t * voltCode = convertTempToVolt(Temperature); writeI2C(DACAddress, voltCode[0], voltCode + 1, 0x01); printf("Temperature written\n"); } }

Viewing all articles
Browse latest Browse all 62309

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>