In the paper,the memory distribution of MCS-51 microcontroller,the storage mode of C51 variable and the transfer mode of function parameter are introduced,which causes the thinking and analysis of the reentrant problem of C51 function.Unlike other processor C compilers,in addition to the fact that explicit access to global resources in the body of a function breaks function reentrant,C51 function parameter passing and local variable store allocation may also result in implicit global resource access conflicts that cause function non-reentrant.Based on the analysis of global resource access conflicts in various cases,the corresponding solutions are put forward to avoid software running exceptions caused by non-reentrant function being called by multi-task.
Key words
MCS-51 /
memory distribution /
storage mode /
parameter passing /
access conflict
{{custom_sec.title}}
{{custom_sec.title}}
{{custom_sec.content}}
References
[1] 张毅刚,刘杰.MCS-51单片机原理及应用[M].哈尔滨:哈尔滨工业大学出版社,2008.
[2] 赵利民.C51堆栈构成与空间需求分析[J].自动化与仪器仪表,2012(2):154-158.
[3] 张玉峰,荀建军.Keil C51中C51程序与汇编程序的接口方法[J].软件技术,2006,24(58):58-60.
[4] 徐爱钧,彭秀华.单片机高级语言C51与汇编语言ASM51的通用接口[J].微计算机应用,2000,21(1):31-35.
[5] 雷电.96系列单片机C语言函数的重入与非重入性[J].应用与实践,1996,12(1):45-47.
[6] 阮海蓉.Keil C51中变量的使用[J].单片机与嵌入式系统应用,2011,11(1):67-69.
[7] 吴光文,周航慈.51单片机操作系统开发中的问题与技巧[J].单片机与嵌入式系统应用,2004(11):75-76.
[8] 朱博,许伦辉.Keil C51中函数指针的使用[J].单片机与嵌入式系统应用,2008(5):71-72.