void ic_update_lcd(i_charger *ic) { //first line of 1602 given to charger... lcd_cursor(0,0); if(ic->i_stage == STOP){ lcd_puts("END"); short x = 1000*ic->voltage; print10(x); info("TOP"); x =1000*ic->top_voltage; print10(x); }else{ lcd_puts("PWM"); print10(pwm_getduty()); lcd_puts(" "); } }
static uint8_t func_19(int8_t p_20, uint32_t p_21, int32_t p_22) { uint32_t l_27 = 0x90F3BD79L; int32_t l_28 = -3L; for (g_13 = print9(28, 89); g_13 == (-24); g_13--) { uint8_t l_26 = 255UL; if (l_26) break; l_28 = print10((((((l_27 = print11(g_14[4][0], 94)) ^ 0x9E6A0122L) || p_20) >= g_13) & 0UL) >= 0x6AC1L, 94); } g_29[0][7] = print12(0x077FEFB6L, 96); return p_20; }
void charging_mode(i_charger *ic) { /* enum charger_stage i_stage; enum Cell_type cell_type; unsigned char cell_pack; float current; float voltage; float top_voltage; char delta_times; float charging_Amp; float ir; float abs_voltage; */ float deltaV = 0.010; if( (ic->voltage <= 0.100 /*V*/) || (ic->voltage >= 11.90) ){ //cell pull out init_ic(ic); } if(ic->i_stage != CHARCHING) /*not start charging*/ return; if( ic->abs_voltage < (NICD_FAST_VOLTAGE*ic->cell_pack)){ ic->charging_Amp = NICD_PRE_CHAGE_MA; if(ic->cell_pack == 7) { ic->charging_Amp = V9_PRE_CHAGE_MA; } ic->charging_mode = PRE; ic->abs_voltage = adc_V() - 0.15*ic->charging_Amp; //assume Ir is 0.15R }else if(ic->charging_mode != FAST) { ic->charging_Amp = NICD_FAST_CHAGE_MA; if(ic->cell_pack == 7) { ic->charging_Amp = V9_FAST_CHAGE_MA; } ic->charging_mode = FAST; adj_current(ic); } /*adjust current if need*/ if(ic->charging_mode != FAST) if( (ic->current>(ic->charging_Amp+0.03)) || (ic->current<(ic->charging_Amp-0.03)) ) adj_current(ic); /* -DeltaV detect*/ if(ic->charging_mode != FAST) return; if(ic->voltage > ic->top_voltage){ ic->top_voltage = ic->voltage; info("TOP"); short x =1000*ic->top_voltage; print10(x); ic->delta_times=0; } if (ic->cell_pack >2) deltaV = 0.015; /*reduce -dV, that's cell pack, because not all cell reach full at same time, so, -dv became small..*/ if( ic->top_voltage > (ic->voltage+deltaV) ){ ic->delta_times++; infon(" -dV:",ic->delta_times); delay(HZ/4); if(ic->delta_times >3){ ic->i_stage = STOP; /*STOP and update abs voltage*/ pwm_setduty(0); } } }