//u8ErrorIndication means //0th bit - Open Load Error for channel 1 //1st bit - Open Load Error for channel 2 //2nd bit - Over Temp Error for channel 1 //3rd bit - Over Temp Error for channel 2 // 1 means error present // 0 means error absent uint8 u8ErrorIndication=0; void CheckError (uint8 u8ReadingValue) { //Here ReadingValue is a copy of last reading //of pin no 3,5 and 4 //0th bit is INPWM 1 //1st bit is INPWM 2 //2nd bit is Status1/2 //this is used to indicate first Try static uint8 u8FirstTry=0; //Possible error state means //0 - No Error //1 - Open Load Channel 1 //2 - Open Load Channel 2 //3 - Open Load Channel 2, Open Load Channel 1 //4 - Open Load Channel 2 //6 - Over Temprature Channel 1,Open Load Channel 2 //8 - Over Temprature Channel 2 //9 - Over Temprature Channel 2, Open Load Channel 1 //12 - Over Temprature Channel 2, Over Temprature Channel 1 //used as Posible error state for inputs uint8 u8PossibleErrorState[8][5] = {{1,2,3,6,9}, {2,3,4,6,12}, {1,3,8,9,12}, {4,6,8,9,12}, {0,4,8,12}, {0,1,8,9}, {0,2,4,6}, {0,1,2,3}}; //this is used as raw length of look up table for //possible error state uint8 u8LenghOfPossibleError[8] = {5,5,5,5,4,4,4,4}; //this is used curret possible error state static uint8 u8CurrentPosibleError[5]; //this is used for temp copy of error state uint8 u8CurrentPosibleError_Temp[5]; //this is used for Current Possible Error Length static uint8 u8GetLenght; //this is used for temp copy Current Possible Error Length uint8 u8GetLenght_Temp; //this is used to store Last copy of reading value static uint8 u8LastReading; //this is used for Index uint8 u8Index0,u8Index1; if(u8FirstTry==0) { //in first try we just take possible error copies for reading values for(u8Index0=0; u8Index0