Page 1 of 1

Help me to write down I2C parameters

PostPosted: Wed Feb 24, 2021 6:57 pm
by HKPhysicist
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. :)

Re: Help me to write down I2C parameters

PostPosted: Mon Mar 01, 2021 8:06 pm
by HKPhysicist
I solved it myself. I found the structure record in its macro definitions. :D