对于MPLAB C18 C编译器的动态内存分配
Dynamicmemoryallocationisanicefunctionalitythat
isprovidedwithvirtuallyallPC-basedcompilers.How-
ever,notallmicrocontrollercompilershavesuchcapa-
bility,mostlikelyduetothelackofasophisticated
operatingsystemwithmemorymanagement.Although
mostapplicationsarestaticinnature,therearecases
whereaneedfordynamicallocationofmemory
resourcesexists.Examplesincludeanynumberofnet-
workprotocolsthathaveadynamicallyspecified
nature.Thisapplicationnotepresentsasimpleandeffi-
cientmethodfordynamicmemoryallocationwithout
theneedofanoperatingsystem.AN914DynamicMemoryAllocationfortheMPLABC18CCompilerAuthor:RossM.FoslerFIGURE1:SIMPLEHEAPEXAMPLEMicrochipTechnologyIncorporatedAllocationBitSegmentLength/ReferenceINTRODUCTIONSegment1DynamicmemoryallocationisanicefunctionalitythatisprovidedwithvirtuallyallPC-basedcompilers.How-ever,notallmicrocontrollercompilershavesuchcapa-bility,mostlikelyduetothelackofa