yeah I am getting the chip id and communication is built with BME688. now I am facing the New issue that tha parametre are not changing or its not updating.
This sensor we are using in Air conditioner project to measure the AQI value so please help as fast as possible.
we cannot use your library due to controller issue.
and here we will get the gas resistance value so please provide the formula to Calculate the Aqi value.
Here is code,
/* Start user code for global. Do not edit comment generated here */
#define EEPROM_Address 0xEC
uint8_t u8bmedataaddress[17]={0x1D,20,45,33,55,44,66,77,88,89,11,34,45,23,34,45,56};
uint8_t u8bmedatareceive[42];
//uint8_t Data_Address1[17]={16,11,22,33,44,55,66,77,88,99,12,23,34,45,56,67,78};
//uint8_t Data_Address3[17]={32,11,22,33,44,55,66,77,88,99,12,23,34,45,56,67,78};
uint8_t gu8Reset[2]={0xE0,182};
uint8_t gu8Filteraddndata[2]={0x75,8};
uint8_t gu8Modensampling[5]={0x71,32,1,0,85};
uint8_t gu8Gaswait[2]={0x6D,89};
uint8_t gu8Par_t[1]={0x8A};
uint8_t gu8Par_tempdatareceive[3];
uint8_t gu8Par_t1[1]={0xE9};
uint8_t gu8Par_tempdatareceive1[2];
uint8_t gu8Tempadcaddress[1]={0x22};
uint8_t gu8Tempadc[2];
uint8_t send = 0;
uint8_t Receive = 0;
uint16_t u16Counter=0;
uint16_t counter=0;
uint8_t flag = 0;
uint16_t gu16Part1,gu16Part2;
uint8_t gu8Part3;
uint16_t gu16Tempadc;
uint32_t gu16Tvar1, gu16Tvar2,gu16Tvar3,gu16T_fine, gu16T_comp;
void main(void)
{
R_MAIN_UserInit();
/* Start user code. Do not edit comment generated here */
R_IICA0_Create();
R_TAU0_Channel0_Start();
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
send =0;
R_IICA0_Master_Send(EEPROM_Address, &gu8Filteraddndata , 2 ,((uint8_t)100));
while(0==send);
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
R_IICA0_StopCondition();
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
send =0;
R_IICA0_Master_Send(EEPROM_Address, &gu8Modensampling , 5 ,((uint8_t)100));
while(0==send);
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
R_IICA0_StopCondition();
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
R_IICA0_StopCondition();
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
send = 0;
R_IICA0_Master_Send(EEPROM_Address, &gu8Gaswait, 2 ,((uint8_t)100));
while(0==send);
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
R_IICA0_StopCondition();
while (1U)
{
if(1==flag)
{
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
send =0;
R_IICA0_Master_Send(EEPROM_Address, &gu8Reset , 2 ,((uint8_t)100));
while(0==send);
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
R_IICA0_StopCondition();
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
send = 0;
R_IICA0_Master_Send(EEPROM_Address, &gu8Par_t , 1 ,((uint8_t)100));
while(0==send);
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
R_IICA0_StopCondition();
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
Receive = 0;
R_IICA0_Master_Receive(EEPROM_Address+1,&gu8Par_tempdatareceive ,3 ,100);
while(0==Receive);
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
R_IICA0_StopCondition();
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
send = 0;
R_IICA0_Master_Send(EEPROM_Address, &gu8Par_t1 , 1 ,((uint8_t)100));
while(0==send);
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
R_IICA0_StopCondition();
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
Receive = 0;
R_IICA0_Master_Receive(EEPROM_Address+1,&gu8Par_tempdatareceive1 ,2 ,100);
while(0==Receive);
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
R_IICA0_StopCondition();
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
send = 0;
R_IICA0_Master_Send(EEPROM_Address, &gu8Tempadcaddress , 1 ,((uint8_t)100));
while(0==send);
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
R_IICA0_StopCondition();
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
Receive = 0;
R_IICA0_Master_Receive(EEPROM_Address+1,&gu8Tempadc ,2 ,100);
while(0==Receive);
for(u16Counter=0;u16Counter<4000;u16Counter++)
{
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
NOP();NOP();NOP();
}
R_IICA0_StopCondition();
gu16Part2 = gu8Par_tempdatareceive[1]<<8 | gu8Par_tempdatareceive[0];
gu16Part1 = gu8Par_tempdatareceive1[1]<<8 | gu8Par_tempdatareceive[0];
gu8Part3 = gu8Par_tempdatareceive[2];
gu16Tempadc = gu8Tempadc[0]<<8 | gu8Tempadc[1];
gu16Tvar1 = ((gu16Tempadc>>3) - (gu16Part1<<1));
gu16Tvar2 = (gu16Tvar1*gu16Part2)>>11;
gu16Tvar3 = ((((gu16Tvar1>>1)*(gu16Tvar1>>1))>>12)*(gu8Part3<<4))>>14;
gu16T_fine = gu16Tvar2+gu16Tvar3;
gu16T_comp = ((gu16T_fine*5)+128)>>8;
}
}
}
below is the output of the program, so in this code i am claculating the temperature but the reading are not coming accurate. it not even changing while pressing.