论文部分内容阅读
采用单板计算机用于自动控制或测试时,经常会遇到程序飞离现象,这时需要采用自启动技术,使程序自动返回。实现自启动的方法有多种,这里介绍一种采用CTC实现程序自启的方法。 考虑一下循环检测的主程序,有一个定时中断的服务程序。在主程序中设两个单元,一个是程序进程标志单元(JCBZ),初始化时该单元置ooH,每执行一段程序该单元的内容加1,在程序末尾该单元又置ooH,所以该单元的内容标志程序执行到哪一个阶段;另一个工作标志单元(GZBZ),该单元内容在程序末尾置成FFH(工作标志)。在中断服务程序开始,检查工作标志单元内容,看是否为FFH。若为FFH,则表示程序工作正常,将工作标志单元内容改成ooH,(或其它非FFH的值)后执行中断
The use of single-board computer for automatic control or testing, often encounter the phenomenon of program flies away, then need to use self-starting technology, the program automatically returns. There are many ways to achieve self-starting, here is a method of using CTC self-starting program. Consider the main program loop detection, there is a timer interrupt service routine. In the main program set up two units, one is the process of marking the unit (JCBZ), initialization unit set ooH, the implementation of a program of the unit’s content plus 1, at the end of the program and set ooH, so the unit The content flag indicates to which stage the program is executing; another work flag cell (GZBZ), which is set to FFH (work flag) at the end of the program. At the beginning of the interrupt service routine, check the contents of the work flag unit to see if it is FFH. If FFH, then the program is working properly, the work logo unit content changed ooH, (or other non-FFH value) after the implementation of the interrupt