1. 首页
  2. 课程学习
  3. 嵌入式
  4. PIC18微控制器的堆栈操纵

PIC18微控制器的堆栈操纵

上传者: 2022-10-23 13:10:30上传 PDF文件 247.84 KB 热度 14次

Traditionally,themicrocontrollerstackhasonlybeen

usedasastoragespaceforreturnaddressesofsub-

routinesorinterruptroutines,whereall‘push’and‘pop’

operationswerehidden.Forthemostpart,usershad

nodirectaccesstotheinformationonthestack.The

PIC18microcontrollerdivergesfromthistradition

slightly.WiththenewPIC18core,usersnowhave

accesstothestackandcanmodifythestackpointer

andstackdatadirectly.Havingsuchlevelsofaccessto

thestackallowsforsomeuniqueandinteresting

programmingpossibilities.

Thisapplicationnotedescribesspecificinformation,

registers,andinstructionsrelatedtoaccessingthe

stack.Anexampleisalsoincludeddemonstratinga

verysimpletaskmanager,anessentialelementfora

real-timeoperatingsystem(RTOS).MAN818ManipulatingtheStackofthePIC18MicrocontrollerAuthor:RossM.FoslerThepointertothetopofthestackisprovidedinregisterMicrochipTechnologyInc.STKPTR.Thepointerisonlyfive-bitswide,whichaccountsforastackdepthof32words.However,thefirstlocationisnotcounted,sinceitisnotphysicallyaINTRODUCTIONmemorylocationinthestack.ThefirstlocationalwaysTraditionally,themicrocontrollers

用户评论