




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
鑒于產品使用的靈活性以及方便性的需要許多系統(tǒng)都把可充電電池作為主要的能量來源 的較典型的實現(xiàn)方法是用一個專門功能的集成電路IC 去控制充電電流/電壓的范圍用C8051F300器件設計鋰離子電池充電器鋰離子充電的算法同樣也適用于其他的化學電池充電器ADC這一點對于防止鋰離子電池應用中的過充電是非常重要的),并使充電效率和電池達到最大化片 脈寬調制提供了用一個小的外部電感實現(xiàn)快速轉換的方片上溫度傳感器為測量電池的溫度提供了一個精確穩(wěn)定的驅動電壓也可以通過靈活的模擬輸入用一個外部RTD電阻性溫度器 實現(xiàn)對電池溫度的測 TempSensor,
圖1電池的特性唯一地決定其安全性能和充電的效率電池的最佳充電方法是由電池的化學成分決定的鋰離子鎳氫鎳鎘還是SLA電池等等 盡管如此大多數(shù)充電方案都包含下面的三個階段恒壓階段/ 例 一節(jié)容量為1000mAh的電池在充電電流為1000mA時可以充電1C(電池容量的倍 也新華龍電 0755-150C20mA)或更低的電流給電池充電盡管如此這只是一個普通的低電流充電方式不適用于要現(xiàn)在使用的大多數(shù)充電器在給電池充電時都是既使用低電流充電方式又使用額定充電電流的方法即所謂的容積充電低充電電流通常使用在充電的初始階段在這一階段需要將會導致充電過程終止的在電池充電的最后階段通常充電時間的絕大部分都是消耗在這一階段可以通過監(jiān)測電流電壓或NiCd 部分電能被轉換成熱能直至電池充滿 而充滿后所有的電能將全部被轉換成熱能 此時不終止充電未電池就會被損壞或燒毀 快速充電器電池完全充滿的時間小于兩小時的充電器則可以解決這個問題因為這些充電器是使用高充電電流來縮短充電時間的因此對于鋰離子電池來說監(jiān)測它的溫度是至關重要的因為電池在過充電時會發(fā)生爆裂在所有的充電階段都應該隨時監(jiān)測溫度的變化并且在溫度超過最大設定值時立即停止充電2實現(xiàn)一個漸弱終止充電器的最經濟的方法就是用一個快速轉換器快速轉換器是一個用一個電感和/或一個變壓器需要的時候用變壓器 作為能量單元以離散的能量包的形式將能量從輸入傳輸至輸出的開關調節(jié)器反饋電路通過晶體管來調節(jié)能量的傳輸同時也作為過濾開關以確保電壓或電流在負載時保Figure2.LithiumIonChargeChargeChargeCurrentVoltage 占空比會自動增加以使電池流入的電流當VBATT<VREF時一個比較器會將開關閉合如圖3a所示電流流入電池和電容C這個電流同時也在電感L 參見圖 0755在電感中的電流迅速下降直到二極管偏置使得電感電流以度流入電池電容C在電感電流衰減后開始放電并且最后VBATT開始下降當VBATT低于VREF時,比較器再次將開關閉合并開始另一次循環(huán)在較大的范圍內如果減小占空比 縮短閉合的時間平均電壓就會下降 反之亦然因此可以通過控Figure3.Buck
VBatt<VREF
-+
VBatt>VREF
-+a)Switch b)Switch要確定快速轉換器中電感的大小首先應假定晶體管的占空比為50%高占空比由方程式1給出其中T 的周期在本例中T=10. 占空比=ton方程式1.至此就可以選擇一個 的轉換頻率如方程式2所示 的轉換頻率越大則電感的值越小也越節(jié) 我們的示例代碼配置F300的8位硬件 是使用內部24.5MHz主時鐘的256分頻來產生一個95.7kHz的轉換速率L Vi-Vsat- ton 2方程式2.現(xiàn)在我們可以計算電感的大小了假定充電電壓Vi的值為15V 飽和電壓Vsat的值為0.5V需要獲得的輸出電壓值為4.2V,并且最大輸出電流I0MAX為1500mA那么電感的值至少應選為18H需要注意的是在本電路中的電容僅僅是一個紋波衰減器 因為紋波與電容的大小成反比例關系所以電容的值越大衰減效果越好本文后面的軟件例程說明了如何使用C8051F300實現(xiàn)鋰離子電池充電器所討論的算法完全是用C寫 以使程序更容易移植關于該器件的具體說明請參考F300的為確保電壓和電流的測量值的精確性算法采用一個兩點系統(tǒng)校正方 在這個方案 假定用戶使 0755兩個已知的電壓和兩個已知的電流一個點接近于地電平另一個點接近測量值然后算法采用這兩個點為電流和電壓通道計算一個斜率和一個偏置值并將結果在FLASH中所有以后的轉換都是相對于這些斜率和偏置計算值而言的但需要注意的是 如果電流通道使用的是一個外部放大器那么該放大器同樣也需要使用一個類似的兩點校正方案進行校正以確保其精度本例的算法使用片上溫度傳感器監(jiān)測溫度溫度傳感器是沒有經過校正的但仍然可以提供充分精度的溫度測量如果需要獲得更高精度的溫度測量可以通過一點或兩點溫度校正方案來實現(xiàn)電池的充電電流是通過一個小的但精確的敏感電阻的差分電壓的值來進行的經片上的PGA將電流放大后采用片上8位ADC使用過采樣的和均值的方法來獲得16位的分辨率再通過斜率和偏置校正系數(shù)計算出相應地電流值如故想獲得更高精度的電流測量值就需要使用一個外部增益電池的電壓是通過外部的電阻進行衰減和監(jiān)測的需要注意的是本應用筆記中的例子是用電源電壓作為ADC的參考電壓為了更精確地檢測必須將檢測到的高于參考電壓的電壓值衰減如果需要更精確的參考電 可以使用外部參考并同時相應地調節(jié)分壓電阻的值 為了便于描述我們假定電池在充電開始時是處于放電狀態(tài) F30x調節(jié)電池的電流至ILOWCURRENT(典型值1/50C)直到電池的電壓達到VMINVOLTBULK需要注意的是電池的充電電流需要限VMINVOLTBULK充電就進入了第二階段在這一階段電池的算法控制通路開關以電池到達VTop(在單節(jié)充電器中的典型值為4.2V)以后,充電器算法進入第三階段在這一階段 信號反饋回來并調節(jié)電池的電壓在第三階段 電池繼續(xù)充電直到電池的充電電流到達IMINIBULKl此后電池將被額外充電30分鐘隨后充電終止充電的絕大部分時間都用在第三階段注意在大多數(shù)實際應用中比如便攜式PC機當啟動電池充電時充電狀態(tài)可能會處于三階段中的任一階段但這不會影響充電效果因為系統(tǒng)只是在監(jiān)視電池的電流狀態(tài)并在那一點啟動充電過程C8051F300實現(xiàn)鋰離子電池充電器的應用方案線性集成電路的應用ApplicationsofLinearIntegratedCircuitsEugeneHnatek,JohnWileyandSons,1975 0755AN037-LithiumIonBatteryChargerUsingFigure4.1CellBatteryCharger AN037-1.1AN037-LithiumIonBatteryChargerUsingC8051F300Figure5.1CellBuckConverterSchematic.AN037-1.1 AN037-LithiumIonBatteryChargerUsingFigure6.main()Flow ???Status=?TurnoffLED0,Status=?TurnonClearTerminationFlagsClearChargeStatus AN037-1.1AN037-LithiumIonBatteryChargerUsing??StoreVoltageOffsetandSlopeCoefficientsinFLASHMemoryStoreCurrentOffsetandSlopeCoefficientsinFLASHMemoryCalculateCurrentEraseMemoryCalculateCurrentSetupADC0'sThroughput,Gain,fornearfull-scaleCurrentcalSetupADC0'sThroughput,Gain,fornearfull-scalevoltagecalpointSetupADC0'sThroughput,Gain,fornearzero-scaleCurrentcalSetupADC0'sThroughput,Gain,fornearzero-scalevoltagecalAN037-1.1AN037-LithiumIonBatteryChargerUsingFigure8.Monitor_Battery()Flow? Charge AN037-1.1AN037-LithiumIonBatteryChargerUsingFigure9.Bulk_Charge()FlowChart(Partw/ZeroStatus=TWithin?V>?Status= ??BCADconst_CtoGreenLEDAN037-1.1 AN037-LithiumIonBatteryChargerUsingFigure10.BULKCurrent()FlowChart(PartBBCAD? ???BelowThreshold?Calculate?GreenLED&Flag&FlagRegulate AN037-1.1AN037-LithiumIonBatteryChargerUsingFigure11.LowCurrent_Charge()FlowV?PrepareFlagstoenterBulk?ChangeStatusfromconst_CtoRegulateStatus=RegulateCalculateNoERROR&??V?GreenLEDGreenLEDStatus=andflagAN037-1.1 AN037-LithiumIonBatteryChargerUsingFigure12.Turn__Off()FlowIncrement AN037-1.1AN037-LithiumIonBatteryChargerUsingFigure13.Measure()FlowSetaccumulatorandcounterivariablestozero??Incrementaccumulator+StartNewClearEndofReturn16-bitAN037-1.1 AN037-LithiumIonBatteryChargerUsingVoltage<PCAnot?Voltage>PCAnot&>VOLT_BULK? AN037-1.1AN037-LithiumIonBatteryChargerUsingFigure15.Regulate_Current()FlowCurrent<PCAnotmax?MakeDutyCycleCurrent>PCAnot0Current=?MakeDutyCycleMeasure Voltage<±?CHARGE_STATUSAN037-1.1 AN037-LithiumIonBatteryChargerUsingFigure16.PCA_OVERFLOW_ISR()FlowResetPCACounterandPCAInterrupts0=overflowvalue60=?Incrementno?60=?Increment?Turnon24=TurnOffResetResetIncrementDecrement AN037-1.1AN037-LithiumIonBatteryChargerUsing//Copyright2002CygnalIntegratedProducts,// //TargetDevice:// 11SEP//Created //Toolchain:KEILEval//Thisheaderfileisusedtodefineallpreprocessordirectives,//andglobalvariablefor//Theusershouldmodifythisheaderfilebeforeproceedingas batteryparameterlimitsareset//FunctionvoidConfig_F300(void);voidRegulate_Current(int);voidTurn_ intMonitor_Battery(unsignedchar);voidBulk_Charge(void);unsignedintMeasure(void);voidDelay_Loop(void);//UNIONs,STRUCTUREs,andtypedefunionLONG{ //byte-addressableLONGlongl;unsignedchar}typedefunionINT{ //byte-addressableINTinti;unsignedchar}typedef{unsignedlongintint //globalint //globalint //globalAN037-1.1 AN037-LithiumIonBatteryChargerUsing//GlobalVariabletime_struct //GlobalStructtoTrackcharbdataTERMINATION; //GlobalVariabletoTrackTerminationcharbdataCHARGE_STATUS;// INTcodeCHECK_BYTE _at_0x1A00; //0x0A0ADefaultvalue,forlateruseLONGcodeVOLT_SLOPE _at_0x1A60; //VoltSlopeRegisterLONGcode _at_ //VoltOffsetLONGcodeI_NOAMP_SLOPE_at_0x1A70; //CurrentSlopeRegister,ext.ampoffLONGcodeI_NOAMP_OFFSET_at_0x1A74; //CurrentOffsetRegister,ext.amp.offLONGtemp_LONG_1,temp_LONG_2; //TemporaryStorageVariablesINT //TemporaryStorage//BitmaskableCHARGESTATUSRegister=bit0:BULKchargestatus=bit1:LOWCURRENTchargestatus=bit2:ERRORbefore/during=bit3:chargedw/constant=bit4:chargedw/constant=bit5:BULKchargeDELAYforafterCURRENTthreshold=bit6:Lowcurrentchargeterminated;batteryis1=bit7:NotCurrently//BitMaskableTERMINATIONRegister=0minimumTEMPERATURE=1umTEMPERATURE=2minimumCURRENT=3umCURRENT=4umtime=5umVOLTAGE=6minimumVOLTAGE2=7NotCurrently//BitmaskablePORT=^0SDAIn/Output,Pin=^1SCLOutput,Pin=^2Output,Pin=^3LED0,Pin=^7Switch0,PinAMUXog#definebit4: og#definebit5:Currentog#definebit6:VoltageogAN037-1.1AN037-LithiumIonBatteryChargerUsing//8051F300#define //SystemclockTempSensorGainin(uV/2PGAgain4PGAgainADCVoltageReferenceFLASHpageusedfortempfrequencyis96//#define
//1stcalpointfor2point#defineV2_CAL //2ndcalpointfor2pointcal.#defineI1_CAL //1stcalpointfor2pointcal.#defineI2_CAL //2ndcalpointfor2pointcal.#defineRSENSE //RSENSEisassumedtobe1/2ohm#defineRESB //10kOhms,VoltageDivideResistor#define //20kOhms,VoltageDivide#defineTEMP_SLOPE((long)TEMP_GAIN*TEMP_SENSOR_GAIN*65536/100///Anestimateofthe//in[tenthcodes///Thetemperaturemeasurement//within3degreesof//Monitor_BattyerSwitchTEMPERATURE5 31//Battery/Pack1NumberofcellsinthemAh,BatteryCapacitymV,NominalCharge#defineI_LOWCURRENT (unsignedint)(CAPACITY/4)#define (unsigned#define (unsigned#defineVOLT_TOLERANCE (unsignedint)(LiIon_CELL_VOLT/100)//1PercentAcc#defineCURRENT_TOLERENCE(unsignedint)(CAPACITY/10) //10PercentAccAN037-1.1 AN037-LithiumIonBatteryChargerUsing//BatteryCharacteristics:ChargeTERMINATION#defineMIN_TEMP_ABS //Abs.min.TEMPERATURE=-10C,263K#defineMAX_TEMP_ABS //Abs.max.TEMPERATURE=50C,323K:#defineMIN_VOLT_BULK //MinimumBULKVoltage#defineMAX_VOLT_ABS (unsignedint)(CELLS*LiIon_CELL_VOLT)#defineMIN_I_BULK (unsignedint)(CAPACITY/4)#defineMAX_TIME_LOWCURRENT30 //MaxLowcurrentChargeTime=90min#defineMAX_TIME_BULK umBULKChargeTime=90min at1C#define //DELAY=30minafter//ENDOF AN037-1.1AN037-LithiumIonBatteryChargerUsing//Copyright2002CygnalIntegratedProducts,// //TargetDevice:// 11SEP//Created //Tool KEILEval//ThisisastandalonebatterychargerforaLithiumION//Itutilizesabuckconverter,controlledbytheon-chip8- //toprovideconstantcurrentfollowedbyconstantvoltagebattery//#include#include //BatteryHearder//void{ = //EnableVDD = //SkipP0.4,5,6; og = //EnableSMBusonP0.0,P0.1,and =
atcrossbarandweakpull-P0MDOUT= //SetP0.2&P0.3outputtopush- = //ConfigureP0.4,5,6 og= //SetSYSCLKto24.5MHz,internal=
TurnontheADCenablelowpowermodefor=
ConfigureADC’stouseVDDforVoltageReference,EnableOn-chipTemperature//PCA = //Disable = // Timebase= =0x00; //InitializePCACountertoZero =0x00;= //EnablePCA//ClearPCACounterOverflow//ModulePCA0CPM0= //ConfigureCCM0to8- AN037-1.1 AN037-LithiumIonBatteryChargerUsingPCA0CPL0= //Initialize tosmalldutyPCA0CPH0= //0xF0EnsuresaSoftInitial//ModulePCA0CPM1= //ConfigureModule1assoftwarePCA0CPL1= //Initializeto255sothat isgeneratedwhenPCA//8- PCA0CPH1= //PCA0CPHisthehighbyteof OutputCompare = //EnablePCAOverflow}//Reset_Time_Base-ResetsallTimeCountingvoid{ = = =0x00;TIME.t_count= }//Delay-ThisisaDelaytopermittimeforSwitchestovoidDelay_Loop{longfor}//Initialize//Thisfunctioncalibratesthevoltagechannelandstoresthe//coefficientsintheparametersvolt_slopeandvoid//Thiscalibrationroutineusesa2point{unsignedcharxdata*pwrite; //FLASHwritepointerEA=0; //DisableAllInterrupts//Waituntil1stcalibrationvoltageisreadyforwhile(SW0== //WaituntilSW0 //WaitforSwitch//Onceready,GetthefirstcalibrationAMX0SL=VBAT; //SelectappropriateinputforAMUXADC0CF=(SYSCLK/ )<<3; //ADCconversionclock=5.0MHzADC0CF&=0xF8; //ClearanyPreviousGainSettingsADC0CF|=0x01; //PGAgain=1temp_INT_1.i=Measure(); AN037-1.1AN037-LithiumIonBatteryChargerUsing//Waituntil2ndcalibrationvoltageisreadyforwhile(SW0== //WaituntilSW0 //WaitforSwitch//Onceready,Getthe2ndcalibrationAMX0SL=VBAT; ChangeMuxforsecondpointtemp_INT_2.i=Measure();//CalculatetheSLOPE //V1andV2areintenthofadegreetemp_LONG_1.l=(unsigned)(temp_INT_2.i-temp_INT_1.i);temp_LONG_1.l*=(unsigned)100; //AccountforMathTruncationErrortemp_LONG_1.l/=(unsigned)(V2_CAL-V1_CAL);//Calculatethetemp_LONG_2.l=(unsigned)temp_INT_1.i;temp_LONG_2.l-=(signed)(temp_LONG_1.l*V1_CAL/100);temp_LONG_1.l= //Ifnocal.usetemp_LONG_2.l= //asdefault//Erasedmemoryatpagepwrite=(charxdataPSCTL= //MOVXwritestargetFLASH//FLASHeraseoperationsFLKEY= //FLASHkeysequenceFLKEY= //FLASHkeysequence*pwrite= //initiatePAGE//WritetheVoltSLOPEandOFFSETtoPSCTL= //MOVXwritestopwrite=(charxdata*)&(VOLT_SLOPE.b[0]);FLKEY=0xA5;FLKEY= //enableflash*pwrite=pwrite=(charxdata*)&(VOLT_SLOPE.b[1]);FLKEY=0xA5;FLKEY= //enableflash*pwrite=pwrite=(charxdata*)&(VOLT_SLOPE.b[2]);FLKEY=0xA5;FLKEY= //enableflash*pwrite=pwrite=(charxdata*)&(VOLT_SLOPE.b[3]);FLKEY=0xA5;FLKEY= //enableflash*pwrite=pwrite=(charxdata*)&(VOLT_OFFSET.b[0]);FLKEY=0xA5;FLKEY= //enableflash*pwrite=pwrite=(charxdata*)&(VOLT_OFFSET.b[1]);FLKEY=0xA5;AN037-1.1 AN037-LithiumIonBatteryChargerUsingFLKEY= //enableflash*pwrite=pwrite=(charxdata*)&(VOLT_OFFSET.b[2]);FLKEY=0xA5;FLKEY= //enableflash*pwrite=pwrite=(charxdata*)&(VOLT_OFFSET.b[3]);FLKEY=0xA5;FLKEY= //enableflash*pwrite=PSCTL= //MOVXwritestarget//Initialize//Thisfunctioncalibratesthecurrentchannelwithnoexternal//andstoresthecalibrationcoefficientsin//parametersi_noamp_slopeandi_noamp//Thiscalibrationroutineusesa2point//Waituntilcalibrationvoltageisreadyforwhile(SW0== //WaituntilSW0 //WaitforSwitch//Onceready,GetthefirstcalibrationAMX0SL=IBAT; //SelectappropriateinputforAMUXADC0CF=(SYSCLK/ )<<3; //ADCconversionclock=5.0MHzADC0CF&=0xF8; //ClearanyPreviousGainSettingsADC0CF|=0x03; //SetPGAgain=4temp_INT_1.i=Measure(); //Acquire16-bitConversiontemp_INT_1.i*=2; //AccountforDifferentialMode//Waituntil2ndcalibrationvoltageisreadyforwhile(SW0== //WaituntilSW0 //WaitforSwitch//Onceready,Getthe2ndcalibrationtemp_INT_2.i=Measure(); //Acquire16-bitConversiontemp_INT_2.i*=2; //AccountforDifferentialMode//Calculatethetemp_LONG_1.l=(unsigned)(temp_INT_2.i-temp_LONG_1.l*=(unsigned)100; //AccountforMathTruncationErrortemp_LONG_1.l/=(unsigned)(I2_CAL-I1_CAL);temp_LONG_1.l/=(unsigned)CURRENT_GAIN;//Accountfor//Calculatethetemp_LONG_2.l=(signed)(temp_INT_1.i/CURRENT_GAIN);temp_LONG_2.l-=(signed)(temp_LONG_1.l*V1_CAL/100);temp_LONG_1.l= //Ifnocal.usetemp_LONG_2.l= //asdefault//Memoryat0x1A00isalready//WritetheVoltSLOPEandOFFSETtoPSCTL=1; //MOVXwritestoFlashpwrite=(charxdata*)&(I_NOAMP_SLOPE.b[0]); AN037-1.1AN037-LithiumIonBatteryChargerUsingFLKEY=FLKEY= //enableflash*pwrite=pwrite=(charxdata*)&(I_NOAMP_SLOPE.b[1]);FLKEY=0xA5;FLKEY= //enableflash*pwrite=pwrite=(charxdata*)&(I_NOAMP_SLOPE.b[2]);FLKEY=0xA5;FLKEY= //enableflash*pwrite=pwrite=(charxdata*)&(I_NOAMP_SLOPE.b[3]);FLKEY=0xA5;FLKEY= //enableflash*pwrite=pwrite=(charxdata*)&(I_NOAMP_OFFSET.b[0]);FLKEY=0xA5;FLKEY= //enableflash*pwrite=pwrite=(charxdata*)&(I_NOAMP_OFFSET.b[1]);FLKEY=0xA5;FLKEY= //enableflash*pwrite=pwrite=(charxdata*)&(I_NOAMP_OFFSET.b[2]);FLKEY=0xA5;FLKEY= //enableflash*pwrite=pwrite=(charxdata*)&(I_NOAMP_OFFSET.b[3]);FLKEY=0xA5;FLKEY= //enableflash*pwrite=PSCTL= //MOVXwritestarget}////Thisroutineaverages65536ADCsamplesandreturnsa16-bit//unsignedintMeasure{unsigned //sampleunsignedlong //here’swhereweintegrate//ADC//readtheADCvalueandaddtorunningtotali=0;doAD0INT= //clearend-of-conversionAD0BUSY= //initiate //waitforconversiontoaccumulator+= //readadcvalueand //update}while(i!=AN037-1.1 AN037-LithiumIonBatteryChargerUsing//theaccumulatornowcontains16addedbitsofwhich8areusablereturn(unsignedint)(accumulator>>8);}////Thisroutinemonitorsthebattery’scurrentand// (i.e.dutycycle)tokeepthecurrentataknown{unsignedinttemp=temp= //Measureif(temp<passed_current)if(temp>passed_current)}while((temp<(passed_current-CURRENT_TOLERENCE))||(temp>(passed_current+CURRENT_TOLERENCE)));//I_BULKorI_LOWCURRENTissettemp= //IfVOLTAGEwithin//changefromconstantCURRENT//modetoconstantVOLTAGEchargemodeif((temp>=(VOLT_LOWCURRENT-VOLT_TOLERANCE))&&(temp<=(VOLT_LOWCURRENT+{CONST_C=CONST_V=}}////Thisroutinemonitorsthebattery’svoltageand// (i.e.dutycycle)tokeepthevoltageataknownvoid{unsignedinttemp=//setVOLT_BULK(with“softtemp=if(temp<VOLT_BULK)if(temp>VOLT_BULK)}while((temp<(VOLT_BULK-VOLT_TOLERANCE)) AN037-1.1AN037-LithiumIonBatteryChargerUsing(temp>(VOLT_BULK+//VOLTAGEisset}// //Thisroutinepeformsasoftchargeturnoffbytaking //dutycycleslowlytovoid {if(PCA0CPH0<0xF0)}while(PCA0CPH0<//DutyCycleisnowsmallandsafetoturnPCA0CPM0= //}////Thisroutineactsasaswitchwhengatheringdifferentconversion//Itadjuststhethroughput,adjusttheAMUXandreturnsthecurrentin//voltageinmV,andtemperatureinC,2%intMonitor_Battery(unsignedchar{charunsignedlongav=0;longsignedresult;ADC0CF=(SYSCLK/ADC0CF&=0xF8;)ADCconversionclock=5.0MHzClearanyPreviousGainSettingsswitch{case AMX0SL=SelectappropriateinputforADC0CF|=SetPGAgain=caseAMX0SL= //SelectappropriateinputforADC0CF|=0x01; //SetPGAgain=1case // AMX0SL= //SelectappropriateinputforADC0CF|=0x01; //SetPGAgain=1AN037-1.1AN037-LithiumIonBatteryChargerUsingcaseAMX0SL= //SelectappropriateinputforADC0CF|=0x03; //SetPGAgain=4}puteaverageofnext10A/DconversionsAD0INT= //clearend-of-conversionAD0BUSY= //initiate //waitforconversiontocompleteav=av+ADC0;}av= //Computetheav= //Convertto16-bit//...toaccountfor16-bit PCA0CPM0=0x42; //Turnonswitch(value){caseresult=(long)av*1000/TEMP_SLOPE;casecase result=(av- //AccountforSystemresult/=VOLT_SLOPE.l; //ConverttoVoltageinMillivoltsresult*=100; //AccountforMathTruncationErrorresult*=RESAB; //AccountforDivideResistorsresult/=RESB;caseresult=av*2; //AccountforDifferentialModeresult-=I_NOAMP_OFFSET.l; //AccountforSystemErrorsresult/=I_NOAMP_SLOPE.l; //ConverttoMilliampsresult*= //AccountforMathTruncationresult/= //AccountforSenseresult*=RESAB; //AccountforDivideResistorsresult/=RESB;result/=CURRENT_GAIN;}return(int)}//Bulk_Chargevoid{unsignedinttemp=unsignedintbulk_finish_hour=AN037-1.1AN037-LithiumIonBatteryChargerUsingunsignedintbulk_finish_min=0;unsignedintdelay_hour=0;unsignedintdelay_min=0;unsignedintlast_min=0; //ResetTimeBaseto//CalculateBULKchargefinishtimebulk_finish_min=(TIME.min+MAX_TIME_BULK);bulk_finish_hour=TIME.hour;while(bulk_finish_min>60){bulk_finish_min=bulk_finish_min-60;}CONST_C= //Startinconstantcurrentcharge = //Resettimertemp=Monitor_Battery(TEMPERATURE);//Monitor//Istemperaturewithinif((temp>MIN_TEMP_ABS)&&(temp<{temp= //Monitor//IsVoltagewithinif((temp<=(MAX_VOLT_ABS+VOLT_TOLERANCE))&&temp>{PCA0CPM0= //ConfigureCCM0to8- //EntermainloopinBulk_Charge()while((BULK==1)&&(ERROR=={if(CONST_C== //ChargewithConstantelseif(CONST_V== //ChargewithConstant//Now,Checkforerrorandchargetermination//Ifabovemaxchargetime,flag//TestforBULKChargeTime//Monitorif((TIME.hour==bulk_finish_hour)&&(TIME.min==bulk_finish_min)&&(DELAY==0)){ //TurnTIME_MAX= //SetTimemaxerror = //Setgeneralerror}//MonitorTemperaturetemp=Monitor_Battery(TEMPERATURE);if((temp<MIN_TEMP_ABS)&&(temp>{AN037-1.1 AN037-LithiumIonBatteryChargerUsing //TurnOffif(temp<MIN_TEMP_ABS)TEMP_MIN=1; //SetTemperaturebelowminimumflagTEMP_MAX= //SetTemperature um = //Setgeneralerror}if(TIME.min!={
//Minute//Checkforminimum//ifreached,enterlastDELAYlast_min=if((CONST_V==1)&&(DELAY==0)&&<={//CalculateTOPOFFBatteryTimefinishtimedelay_min=(TIME.min+BULK_TIME_DELAY);delay_hour=TIME.hour;while(delay_min>60){delay_min=delay_min-60;}DELAY= //SetDelay}//MonitorDelaytime,timeup?if((TIME.hour==delay_hour)&&(TIME.min==delay_min)&&(DELAY=={ //TurnCONST_V= //ExitCONST_C= //PreparetoenterBULK= //PreparetoexitBULKLOWCURRENT= //PreparetoenterLOWCURRENT}} //EndMainWhile}elseif(ERROR=={if(temp>(MAX_VOLT_ABS+{VOLT_MAX=1; //SetMaxVoltageerrorflag =1; //Setgeneralerrorflag}elseif(temp<{VOLT_MIN=1; //SetMinimumbulkvoltageerrorflagLOWCURRENT=1; //SwitchtoLOWCURRENTmodeBULK= //ExitBulkCharge //battery’svoltagevery}} AN037-1.1AN037-LithiumIonBatteryChargerUsingelseif(ERROR== //Absolutetemperatureoutof{if(temp<TEMP_MIN=1; //SetTemperaturebelowminimumflagTEMP_MAX= //SetTemperature umERROR= //Setgeneralerror}}//void{unsignedinttemp=unsignedintlowcurrent_finish_min=0;unsignedintlowcurrent_finish_hour=0; //ResetTimebaseto//CalculateLOWCURRENTfinishtimelowcurrent_finish_min=(TIME.min+MAX_TIME_LOWCURRENT);lowcurrent_finish_hour=TIME.hour;while(lowcurrent_finish_min>{lowcurrent_finish_min=lowcurrent_finish_min-60;}//EnterMainLowcurrent//Onlyexitsareuponerrorandfullchargewhile((LOWCURRENT==1)&&(ERROR==0)){temp=Monitor_Battery(TEMPERATURE);//GetTemperature//IsTEMPERA
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 廣東省實驗中學廣州市天河區(qū)附屬實驗學校2021-2022學年八年級下學期期中物理試題(含答案)
- 基層中醫(yī)藥知識培訓課件
- (一模)哈三中2025屆高三第一次模擬考試 英語試題(含答案)
- 物業(yè)管理服務委托及管理費支付協(xié)議
- 安東尼奇妙的冒險故事讀后感
- 項目執(zhí)行工作計劃書與時間表安排
- 山西省晉中市太谷區(qū)職業(yè)中學校2024-2025學年高一上學期期末考試生物試題
- 企業(yè)文件保密制度表格化處理記錄
- 三農問題社會調查方法與技術指導書
- 離職員工知識產權保密協(xié)議
- DB3410T 34-2024特定地域單元生態(tài)產品價值核算規(guī)范
- 無人機操控技術 課件全套 項目1-6 緒論-無人機自動機場
- 江蘇紅豆實業(yè)股份有限公司償債能力分析
- 青島中石化輸油管道爆炸事故調查報告
- 2024年蘇州職業(yè)大學高職單招(英語/數(shù)學/語文)筆試歷年參考題庫含答案解析
- 充電樁采購安裝投標方案(技術方案)
- 教科版小學科學六年級下冊單元練習試題及答案(全冊)
- 《Java程序設計》電子課件
- 乳腺癌患者的疼痛護理課件
- 研課標說教材修改版 八年級下冊
- 江西宜春城市文化介紹
評論
0/150
提交評論