⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ——单片机系统在测控领域的稳定性探讨.htm

📁 网上收集的关于嵌入式开发的文档。拿来共享!
💻 HTM
📖 第 1 页 / 共 3 页
字号:
            lang=EN-US><o:p></o:p></SPAN></B></P>
            <P class=MsoNormal style="TEXT-INDENT: 21.75pt"><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">当乱飞的程序进入非程序区的时候,</SPAN> 
            <SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我们就可设定软件陷阱对乱飞的程序进行拦截从而将程序引向一个固定的位置。这样我们就可将捕获的程序重新纳入正轨。</SPAN></P>
            <P class=MsoNormal style="TEXT-INDENT: 21.75pt"><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">软件陷阱主要就是把程序从新引入它的复位入口处,也就是说我们在适当的地方设置这样的指令:</SPAN></P>
            <P class=MsoNormal style="TEXT-INDENT: 21.75pt"><SPAN 
            lang=EN-US>NOP</SPAN></P>
            <P class=MsoNormal style="TEXT-INDENT: 21.75pt"><SPAN lang=EN-US>NOP 
            </SPAN></P>
            <P class=MsoNormal style="TEXT-INDENT: 21.75pt"><SPAN 
            lang=EN-US>LJMP<SPAN style="mso-spacerun: yes">&nbsp; 
            </SPAN>0000H</SPAN></P>
            <P class=MsoNormal style="TEXT-INDENT: 21.75pt"><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对于软件陷阱的安排,我们主要安排在这样一些区域,未使用的中断区,未使用的</SPAN><SPAN 
            lang=EN-US>EPROM</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">空间及非</SPAN><SPAN 
            lang=EN-US>EPROM</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">空间。程序运行区,及中断服务程序区。在这里我们主要来看前三种:</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN-LEFT: 39.75pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo2; tab-stops: list 39.75pt"><SPAN 
            lang=EN-US>1、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; 
            </SPAN></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">未使用的中断区</SPAN></P>
            <P class=MsoNormal style="MARGIN-LEFT: 21.75pt"><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果对于未使用的中断因干扰而开放的话,我们可以把中断服务程序这样来写:</SPAN></P>
            <P class=MsoNormal style="MARGIN-LEFT: 21.75pt"><SPAN lang=EN-US>NOP 
            </SPAN></P>
            <P class=MsoNormal style="MARGIN-LEFT: 21.75pt"><SPAN 
            lang=EN-US>NOP</SPAN></P>
            <P class=MsoNormal style="MARGIN-LEFT: 21.75pt"><SPAN 
            lang=EN-US>POP<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; 
            </SPAN>D1<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; 
            </SPAN></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">;将原来的错误断点弹出</SPAN></P>
            <P class=MsoNormal style="MARGIN-LEFT: 21.75pt"><SPAN 
            lang=EN-US>POP<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; 
            </SPAN>D2<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; 
            </SPAN></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">;将原来的错误断点弹出</SPAN></P>
            <P class=MsoNormal style="MARGIN-LEFT: 21.75pt"><SPAN 
            lang=EN-US>PUSH<SPAN style="mso-spacerun: yes">&nbsp; 
            </SPAN>00H</SPAN></P>
            <P class=MsoNormal style="MARGIN-LEFT: 21.75pt"><SPAN 
            lang=EN-US>PUSH<SPAN style="mso-spacerun: yes">&nbsp; 
            </SPAN>00H<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; 
            </SPAN></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">;将断点地址重写为</SPAN><SPAN 
            lang=EN-US>0000H</SPAN></P>
            <P class=MsoNormal style="MARGIN-LEFT: 21.75pt"><SPAN 
            lang=EN-US>RETI</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN-LEFT: 39.75pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo2; tab-stops: list 39.75pt"><SPAN 
            lang=EN-US>2、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; 
            </SPAN></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">未使用的</SPAN><SPAN 
            lang=EN-US>EPROM</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">区</SPAN></P>
            <P class=MsoNormal 
            style="TEXT-INDENT: 21pt; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt"><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">假设我们用了一片</SPAN><SPAN 
            lang=EN-US>2764</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,但并没有用完整个存储区。这时候就可在未用的区域里填充上</SPAN><SPAN 
            lang=EN-US>020000</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">数据,这样当程序飞入其中时就会很快的走入正轨。这条指令其实是“</SPAN><SPAN 
            lang=EN-US>LJMP<SPAN style="mso-spacerun: yes">&nbsp; 
            </SPAN>0000H</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”的机器码。</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN-LEFT: 39.75pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo2; tab-stops: list 39.75pt"><SPAN 
            lang=EN-US>3、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; 
            </SPAN></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">非</SPAN><SPAN 
            lang=EN-US>EPROM</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">空间</SPAN></P>
            <P class=MsoNormal 
            style="TEXT-INDENT: 21pt; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt"><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">单片机系统的程序空间是</SPAN><SPAN 
            lang=EN-US>64K</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,正常情况下我们所使用的</SPAN><SPAN 
            lang=EN-US>EPROM</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">不会占用所有的空间,假设我们现在的</SPAN><SPAN 
            lang=EN-US>EPROM</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">占用</SPAN><SPAN 
            lang=EN-US>16K</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的空间那么剩下的</SPAN><SPAN 
            lang=EN-US>48K</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">空间就被闲置不用了。当乱飞的</SPAN><SPAN 
            lang=EN-US>PC</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">落入这些空间时,读入的数据将为</SPAN><SPAN 
            lang=EN-US>FFH</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,这是</SPAN> 
            <SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">:</SPAN><SPAN 
            lang=EN-US>MOV<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; 
            </SPAN>R7</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,</SPAN><SPAN 
            lang=EN-US>A<SPAN style="mso-spacerun: yes">&nbsp; 
            </SPAN></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">指令的机器码,将修改</SPAN><SPAN 
            lang=EN-US>R7</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的内容。因此,当程序乱飞入非</SPAN><SPAN 
            lang=EN-US>EPROM</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">芯片区后,不仅无法导入正规,面且破坏了</SPAN><SPAN 
            lang=EN-US>R7</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的内容。</SPAN></P>
            <P class=MsoNormal 
            style="TEXT-INDENT: 21pt; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt"><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我们知道,当</SPAN><SPAN 
            lang=EN-US>CPU</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">读程序存储器的时候,伴随着会产生一个</SPAN><SPAN 
            lang=EN-US>PSEN</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">信号,我们就可利用这个信号,再加上一个非</SPAN><SPAN 
            lang=EN-US>EPROM</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">区的地址译码信号,构成一个选通信号来起动一个空闲的中断,再用软件陷井的方法从中断程序中把程序导入正规。我们可看下面的一个图:</SPAN></P>
            <P class=MsoNormal><v:group id=_x0000_s1026 
            style="MARGIN-TOP: 0px; Z-INDEX: 1; LEFT: 0px; MARGIN-LEFT: 47.1pt; WIDTH: 346.65pt; POSITION: absolute; HEIGHT: 85.8pt; TEXT-ALIGN: left" 
            coordorigin="2739,11424" coordsize="6933,1716"><v:shapetype 
            id=_x0000_t202 coordsize="21600,21600" o:spt="202" 
            path="m0,0l0,21600,21600,21600,21600,0xe"><v:stroke 
            joinstyle="miter"></v:stroke><v:path gradientshapeok="t" 
            o:connecttype="rect"></v:path></v:shapetype><v:shape id=_x0000_s1027 
            style="LEFT: 3267px; WIDTH: 6405px; POSITION: absolute; TOP: 11424px; HEIGHT: 1716px" 
            type="#_x0000_t202" filled="f" stroked="f"><v:textbox>
            <TABLE cellSpacing=0 cellPadding=0 width="100%">
              <TBODY>
              <TR>
                <TD>
                  <DIV>
                  <P class=MsoNormal><SPAN 
                  lang=EN-US>&nbsp;<o:p></o:p></SPAN></P></DIV></TD></TR></TBODY></TABLE></v:textbox></v:shape><v:line 
            id=_x0000_s1028 style="POSITION: absolute" from="4842,11736" 
            to="6102,11736"></v:line><v:rect id=_x0000_s1029 
            style="LEFT: 6102px; WIDTH: 315px; POSITION: absolute; TOP: 11580px; HEIGHT: 624px"></v:rect><v:oval 
            id=_x0000_s1030 
            style="LEFT: 6417px; WIDTH: 105px; POSITION: absolute; TOP: 11802px; HEIGHT: 156px"></v:oval><v:line 
            id=_x0000_s1031 style="POSITION: absolute; flip: x" 
            from="5577,12048" to="6102,12048"></v:line><v:line id=_x0000_s1032 
            style="POSITION: absolute" from="5577,12048" 
            to="5577,12360"></v:line><v:rect id=_x0000_s1033 
            style="LEFT: 5412px; WIDTH: 375px; POSITION: absolute; TOP: 12480px; HEIGHT: 192px"></v:rect><v:oval 
            id=_x0000_s1034 
            style="LEFT: 5532px; WIDTH: 105px; POSITION: absolute; TOP: 12330px; HEIGHT: 156px"></v:oval><v:line 
            id=_x0000_s1035 style="POSITION: absolute" from="5577,12672" 
            to="5577,12828"></v:line><v:line id=_x0000_s1036 
            style="POSITION: absolute; flip: x" from="4842,12828" 
            to="5577,12828"></v:line><v:line id=_x0000_s1037 
            style="POSITION: absolute" from="6522,11892" 
            to="7677,11892"></v:line><v:group id=_x0000_s1038 
            style="LEFT: 6942px; WIDTH: 840px; POSITION: absolute; TOP: 11892px; HEIGHT: 468px" 
            coordorigin="4737,11892" coordsize="840,468"><v:shape 
            id=_x0000_s1039 
            style="LEFT: 4737px; WIDTH: 840px; POSITION: absolute; TOP: 11892px; HEIGHT: 468px" 
            type="#_x0000_t202" filled="f" stroked="f"><v:textbox>
            <TABLE cellSpacing=0 cellPadding=0 width="100%">
              <TBODY>
              <TR>
                <TD>
                  <DIV>
                  <P class=MsoNormal><SPAN 
              lang=EN-US>INT0</SPAN></P></DIV></TD></TR></TBODY></TABLE></v:textbox></v:shape><v:line 
            id=_x0000_s1040 style="POSITION: absolute" from="4887,11973" 
            to="5412,11973"></v:line></v:group><v:group id=_x0000_s1041 
            style="LEFT: 4527px; WIDTH: 840px; POSITION: absolute; TOP: 12360px; HEIGHT: 468px" 
            coordorigin="4737,11892" coordsize="840,468"><v:shape 
            id=_x0000_s1042 
            style="LEFT: 4737px; WIDTH: 840px; POSITION: absolute; TOP: 11892px; HEIGHT: 468px" 
            type="#_x0000_t202" filled="f" stroked="f"><v:textbox>
            <TABLE cellSpacing=0 cellPadding=0 width="100%">
              <TBODY>
              <TR>
                <TD>
                  <DIV>
                  <P class=MsoNormal><SPAN 
              lang=EN-US>PSEN</SPAN></P></DIV></TD></TR></TBODY></TABLE></v:textbox></v:shape><v:line 
            id=_x0000_s1043 style="POSITION: absolute" from="4887,11973" 
            to="5412,11973"></v:line></v:group><v:shape id=_x0000_s1044 
            style="LEFT: 2739px; WIDTH: 2730px; POSITION: absolute; TOP: 11736px; HEIGHT: 468px" 
            type="#_x0000_t202" filled="f" stroked="f"><v:textbox>
            <TABLE cellSpacing=0 cellPadding=0 width="100%">
              <TBODY>
              <TR>
                <TD>
                  <DIV>
                  <P class=MsoNormal><SPAN 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -