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

📄 dpjjx24.htm

📁 本单片机教程是平凡老师花了大量时间
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size=2 face="宋体"> MOV A,SBUF &#9;&#9;;</font><font face="宋体" lang="ZH-CN" size=2>将取得的数送</font><font size=2 face="宋体">P1</font><font face="宋体" lang="ZH-CN" size=2>口</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"> MOV P1,A</font></p> 
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"> LJMP WAIT</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size=2 face="宋体">DELAY:&#9;&#9;&#9;&#9;;</font><font face="宋体" lang="ZH-CN" size=2>延时子程序</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"> MOV R7,#0ffH</font></p> 
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"> DJNZ R7,$</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"> RET</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"> END</font></p>
<p style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体">将程序编译通过,写入芯片,插入实验板,用通读电缆将实验板与主机的串口相连就可以实验了。上面的程序功能很简单,就是每隔一段时间向主机轮流送数55H和AAH,并把主机送去的数送到P1口。可以在PC端用串口精灵来做实验。串口精灵在我主页上有下载。运行串口精灵后,按主界面上的“设置参数”按钮进入“设置参数”对话框,按下面的参数进行设置。注意,我的机器上用的是串口2,如果你不是串口2,请自行更改串口的设置。</font></p>
<p style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"><img src="dpjjx245.gif" width="417" height="220"></font></p>
<p style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体">设置完后,按确定返回主界面,注意右边有一个下拉列表,应当选中“按16进制”。然后按“开始发送”、“开始接收”就可以了。按此设置,实验板上应当有两只灯亮,6只灯灭。大家可以自行更改设置参数中的发送字符如55,00,FF等等,观察灯的亮灭,并分析原因,也可以在主界面上更改下拉列表中的“按16进制”为“按10进制”或“按ASCII字符”来观察现象,并仔细分析。这对于大家理解16进制、10进制、ASCII字符也是很有好处的。程序本身很简单,又有注释,这里就不详加说明了。</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体">三、上述程序的中断版本</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体">org 0000H</font></p> 
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体">&#9;AJMP&#9;START</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"> org 0023h</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"> AJMP SERIAL ;</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体">&#9;ORG&#9;30H</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体">START: </font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"> mov SP,#5fh ;</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size=2 face="宋体"> mov TMOD,#20h ;T1: </font>
<font face="宋体" lang="ZH-CN" size=2>工作模式</font><font size=2 face="宋体">2</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"> mov PCON,#80h ;SMOD=1</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size=2 face="宋体"> mov TH1,#0FDH ;</font><font face="宋体" lang="ZH-CN" size=2>初始化波特率(参见表)</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"> mov SCON,#50h ;Standard UART settings</font></p> 
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size=2 face="宋体"> MOV R0,#0AAH &#9;;</font><font face="宋体" lang="ZH-CN" size=2>准备送出的数</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 
<font size=2 face="宋体">SETB 
REN ;</font><font face="宋体" lang="ZH-CN" size=2>允许接收</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size=2 face="宋体"> SETB TR1 ;T1</font><font face="宋体" lang="ZH-CN" size=2>开始工作</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size=2 face="宋体"> SETB EA ;</font><font face="宋体" lang="ZH-CN" size=2>开总中断</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size=2 face="宋体"> SETB ES ;</font><font face="宋体" lang="ZH-CN" size=2>开串口中断</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"> SJMP $ </font></p> 
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体">SERIAL:</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"> MOV A,SBUF &#9;&#9;</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"> MOV P1,A</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"> CLR RI &#9;&#9;</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"> RETI</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体"> END</font></p>
<p style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体">本程序没有写入发送程序,大家可以自行添加。</font></p>
<p style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体">&nbsp; </font> </p>
<p style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体">  </font> </p>

<p style="line-height: 150%; margin-top: 0; margin-bottom: 0"> </p>

          <hr width="550" SIZE="1" align="center">
<p align="center" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 
  <font size="2" face="宋体">杭州电子计算机工作室 COPYRIGHT; <a href="http://www.hificat.com" target="_blank">http://www.hificat.com</a><br>
  &nbsp; e-mail:<a href="mailto:xu169@sina.com">xu169@sina.com</a></font> qq:12739176 
  <font size="2">电话</font>:<font size="2">0571-85956028 13185018567</font> 
<p align="center" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体">  </font>
<p style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体">  </font> </p>
<p style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" face="宋体">  </font> </p>
</body>
</html>

⌨️ 快捷键说明

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