Help me to write down I2C parameters

Help me to write down I2C parameters

Postby HKPhysicist » Wed Feb 24, 2021 6:57 pm

Hello all PIC experts,
I am developing a small project on the Curiosity LPC Board:
https://www.microchip.com/DevelopmentTools/ProductDetails/PartNO/DM164137

I add a MCP9808 temperature sensor to my code through MPLAB Code Configurator. The code asks me to set the I2C parameters:

Code: Select all
int8_t MCP9808_MODULE_Initialize(MCP9808_i2c_params i2cParams) {
.
.
.
}

typedef struct _MCP9808_i2c_params {
    uint8_t i2cAddress;
    uint8_t i2cBusID;   // parameter used only by "i2c classic lib"
} MCP9808_i2c_params;



It is what I find from the Board definition:
Code: Select all
void I2C1_Initialize()
{
    SSP1STAT = 0x00;
    SSP1CON1 = 0x28;
    SSP1CON2 = 0x00;
    SSP1ADD  = 0x03;
    SSP1CON1bits.SSPEN = 0;
}


Can anyone tell me what should be the value of i2cParams?


Thanks for your valuable opinions. :)
User avatar
HKPhysicist
 
Posts: 16
Joined: Wed Feb 24, 2021 5:53 am

Re: Help me to write down I2C parameters

Postby HKPhysicist » Mon Mar 01, 2021 8:06 pm

I solved it myself. I found the structure record in its macro definitions. :D
User avatar
HKPhysicist
 
Posts: 16
Joined: Wed Feb 24, 2021 5:53 am


Return to SSP (IIC, SPI)

Who is online

Users browsing this forum: No registered users and 15 guests

cron