/////////////////////////////////////////////////////////////////////// //TWI initializing void twi_init(){ TWBR = 100; TWSR = (0< signalize that a error occur } /////////////////////////////////////////////////////////////////////// //TWI test TWINT flag with avoiding infinite loop void twi_twint_flag(){ uint16_t tmpx; for(tmpx= 0;tmpx<5000;tmpx++){ if((TWCR & (1< only one byte is read via TWI communication goto only_1ByteData;} TWCR = (1<2){ LP1_logic_tmp = 0x00; count_tmp2TM = 0x00; } } if((full_tmp1_safety | full_tmp2_safety) != 0){ count_tmp2TM++; if(count_tmp2TM >2){ LP1_logic_tmp = 0xFF; count_tmp2TM = 0x00;} } } twi_read_Byte(0x16,0x48,2); if(twi_error_tmp == 0x00){ empty_tmp_chargeAL = DataByte2_receive_twi & (1<0){ LP1_logic_tmp = 0x00; count_tmp3TM = 0x00;} } if(full_tmp_chargeAL != 0){ count_tmp3TM++; if(count_tmp3TM >0){ LP1_logic_tmp = 0xFF; count_tmp3TM = 0x00;} } } }