資源簡介
基于英飛凌16位單片機,實現BMS解決方案C語言程序源碼及使用說明

代碼片段和文件信息
#include?
#include?
#include?
#include?“MemoryXC8.h“
#include?“Routines.h“
//********************************************************
// ?????????FLASH?ROUTINE
//********************************************************????????????????
void?FlashCalculateAdr(?SlaveData?*pSlaveData?)
{
???unsigned?int?idata?SectorAdr;
???char?idata?WL?WL_Start;
???
???//?define?WL
???if(*(unsigned?long?code?*)FlashB400?!=?0?&&?*(unsigned?long?code?*)FlashB7E0?==?0)?
????????//?second?sector
????????WL_Start=32;??
???else?//?first?sector
????????WL_Start=?0;??
???
???//?Wl?=?Wordline?=?32?Byte
???for(WL=WL_Start;?WL<((FlashB800-FlashB000)/sizeof(WLBuf))+1;?WL++)
???{ ???? ???????
?????//?calculate?start?address from?0xB000...0xB3E0?or?0xB400....0xB800
?????SectorAdr?=?FlashB000?+?(sizeof(WLBuf)?*?WL);
?????//?search?the?empty?line?????
?????if(?*(unsigned?long?code?*)SectorAdr?==?0?)?
???????break;?
???}
??
???//?check?address
???if(SectorAdr?==?FlashB000?||?SectorAdr?==?FlashB800)
???{??
?????//?next?free?adress
?????pSlaveData->FlashData.NextSectorAdr????=?FlashB000;
?????//?current?adress
?????pSlaveData->FlashData.CurrentSectorAdr?=?FlashB7E0;?????
???}?????
???else
???{??????????
?????//?next?free?adress
?????pSlaveData->FlashData.NextSectorAdr????=?SectorAdr;
?????//?current?address
?????pSlaveData->FlashData.CurrentSectorAdr?=?SectorAdr?-?sizeof(WLBuf);
???}
???
???printf(“read?from?FlashAdr:0x%x\n“?(unsigned?int)pSlaveData->FlashData.CurrentSectorAdr);??????????
???printf(“->?next?empty?FlashAdr:0x%x\n“?(unsigned?int)pSlaveData->FlashData.NextSectorAdr);??????????
}
//********************************************************
// ?????????FLASH?ROUTINE
//********************************************************????????????????
void?FlashErrors(?SlaveData?*pSlaveData?)
{
???char?idata?SectorNo;
???unsigned?char?xdata?*pAdr?=?NULL;
???static?unsigned?char?FlashValue?=?0;
???//?only?3?times?flash?possible
???if(?FlashValue?<=?2??)
???{
?????//?calculate?sector?0?or?1
?????if(pSlaveData->FlashData.NextSectorAdr??????if(pSlaveData->FlashData.NextSectorAdr?
?????//?which?Sector?No?
?????switch(?SectorNo?)
?????{
???????case?0:?//******************************************************
?? ???//????????????address?where?to?save?value?0xB000
?? ???//******************************************************?????
??? ?
??? ???????//?fill?internal?RAM?buffer
??? ???????LoadXD2WLBuf(?(unsigned?char?xdata?*)&pSlaveData->FlashData?);
??? ???????//?program?flash
??? ???????ProgWL(?(unsigned?char?code?*)pSlaveData->FlashData.NextSectorAdr?);
??? ???????//?wait?until?ready
??? ???????while(FlReady(4)?==?0);
??? ???????
?? ???????//?new?current?sector?address
?? ???????pSlaveData->FlashData.CurrentSectorAdr?=?pSlaveData->FlashData.NextSectorAdr;
?? ???????//?new?next?sector?address
?? ??????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????.......?????19214??2009-08-12?19:23??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\ADC.C
????.......??????3290??2009-08-12?19:23??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\ADC.H
????.......?????28905??2010-03-17?10:20??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\ADC.LST
????.......?????69037??2010-03-17?10:20??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\ADC.OBJ
????.......?????89148??2009-08-12?19:27??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\BM_NewSlave.dav
????.......?????86146??2009-08-12?19:23??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\CAN.C
????.......?????26619??2009-08-12?19:23??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\CAN.H
????.......????122239??2010-03-17?10:20??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\CAN.LST
????.......????113279??2010-03-17?10:20??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\CAN.OBJ
????.......???????562??2009-09-15?17:38??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\CAN_INT.LST
????.......?????13645??2009-08-12?19:23??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\CC6.C
????.......??????4768??2009-08-12?19:23??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\CC6.H
????.......?????20102??2010-03-17?10:20??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\CC6.LST
????.......?????40844??2010-03-17?10:20??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\CC6.OBJ
????.......??????9270??2009-08-06?12:44??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\Flash.c
????.......???????490??2008-12-16?10:49??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\Flash.h
????.......?????15073??2010-03-17?10:20??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\Flash.LST
????.......????152064??2010-03-17?10:20??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\Flash.OBJ
????.......??????7311??2009-08-12?19:23??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\INT.C
????.......??????2775??2009-08-12?19:23??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\INT.H
????.......?????12390??2010-03-17?10:20??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\INT.LST
????.......?????58339??2010-03-17?10:20??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\INT.OBJ
????.......?????10755??2009-08-12?19:23??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\IO.C
????.......??????4270??2009-08-12?19:23??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\IO.H
????.......?????16873??2010-03-17?10:20??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\IO.LST
????.......?????36674??2010-03-17?10:20??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\IO.OBJ
????.......?????18216??2009-08-12?19:23??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\MAIN.H
????.......?????58013??2009-09-17?13:09??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\MAIN_own.C
????.......?????94564??2010-03-17?10:20??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\MAIN_own.LST
????.......????366156??2010-03-17?10:20??英飛凌BMS解決方案C語言程序源碼及使用說明\BMS?-?4-v2\MAIN_own.OBJ
............此處省略44個文件信息
- 上一篇:哈夫曼編碼譯碼
- 下一篇:IEEE30節點系統潮流計算C程序
評論
共有 條評論