📄 pic16cxxx-9-3.htm
字号:
<html>
<head>
<title>PIC16Cxxx单片机应用与设计</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
<!--
BODY {font-size:12px;font-family:宋体;}
td {font-size:12px;font-family:宋体;}
A:link { COLOR: #0000ff; TEXT-DECORATION: underline}
A:visited { COLOR:#0000ff; TEXT-DECORATION: underline}
A:active { COLOR:red! important; TEXT-DECORATION: underline}
A:hover { TEXT-DECORATION: none}
.b24 a:link { FONT-SIZE: 12px; COLOR:#0000ff; TEXT-DECORATION: underline}
.b24 a:visited {FONT-SIZE: 12px; COLOR:#0000ff; TEXT-DECORATION: underline}
.b24 a:active { FONT-SIZE: 12px; COLOR:#0000ff; TEXT-DECORATION: underline}
.b24 a:hover { FONT-SIZE: 12px; COLOR:#990000; TEXT-DECORATION: none}
.lh13 { LINE-HEIGHT: 130%}
.lh15 { LINE-HEIGHT: 150%}
.lh17 { LINE-HEIGHT: 170%}
.lh19 { LINE-HEIGHT: 190%}
.lh30 { LINE-HEIGHT: 300%}
-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" >
<table width="757" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="center">
<td> </td>
</tr>
<tr align="center">
<td> <table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="41%" height="46" valign="top"><img src="logo.gif" width="205" height="41"></td>
<td height="46" width="59%" valign="bottom" align="right"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right"><b><font style="font-size:16px" color="#990000">——
—— —— 技术资料下载中心</font></b> </td>
</tr>
<tr>
<td height="8"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="1" colspan="2"></td>
</tr>
<tr bgcolor="#990000">
<td height="1" colspan="2"></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><font style="font-size:16px" color="#000000"><b>>> <a href="index.htm">PIC16CXXX单片机应用与设计</a>
\</b></font></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table>
<table width="700" border="0" cellspacing="0" cellpadding="2" class="lh15">
<tr>
<td align="center"><b><font size="3">第九章 PIC16CXX设计范例 </font><font size="3"></font></b></td>
</tr>
<tr>
<td> <p> </p></td>
</tr>
<tr valign="top">
<td height="300"> <p>(三)程序清单<br>
<br>
;本程序把数据写入93LC56/66地址为10H-13H空间,<br>
;然后从10H-13H读回数据,存入20H-23H的寄存器</p>
<p><img src="image/d5.gif" width="538" height="2159" hspace="30"></p>
九、8位并行口的使用<br> <br>
(一)电路设计<br> PIC16C64/74带有一个8位并行口。本例由并行口读、写产生中断,读(对CPU是输出)中断时,把数据送出PORT_D口,计数寄存器加1,并把新值送到输出队列,写(对CPU是输入)中断时,
从PORT_D读取数据,并送给RB口。电路图如下:<br> <p align="center"> <img src="image/a415.gif" width="552" height="383">
</p>
(二)程序流程图<br>
1、主程序<br> <p align="center"><img src="image/a416.gif" width="420" height="584"></p>
<p>2、中断程序</p>
<p align="center"><img src="image/a417.gif" width="360" height="656"></p>
<p>(三)程序清单</p>
<p><img src="image/d6.gif" width="546" height="1583" hspace="30"></p>
<p>十、CPP模式的应用例程<br>
<br>
CPP模式可工作在以下三种状态:<br>
1、捕捉输入<br>
2、比较输出<br>
3、PWM(脉宽调制)输出</p>
<p>(一)PWM输出<br>
PWM的周期由PR2决定,脉宽比由CCPR1L值决定,最高分辩率可达10位。本例由RB口输的值做为周期,RA<1:0>值作为TMR2的分频比,PORT_D值为脉宽高8位,POR_E<1:0>为脉宽低2位。本程序上电时读取RA<1:0>值做为TMR2分频比,每次TMR1中断重新读取RB、RD、RE口值,更新周期和脉宽。</p>
<p>1、流程图<br>
①主程序流程图</p>
<p align="center"><img src="image/a418.gif" width="192" height="416"></p>
②中断服务程序<br> <div align="center">
<p><img src="image/a419.gif" width="292" height="671"> </p>
</div>
<p>2、程序清单</p>
<p><img src="image/d7.gif" width="534" height="1760" hspace="30"></p>
<div align="right">
<p><a href="PIC16Cxxx-9-2.htm">上一页</a> <a href="PIC16Cxxx-9-4.htm">下一页</a>
</p>
</div>
<p><a href="PIC16Cxxx-1.htm">第一章</a> <a href="PIC16Cxxx-2.htm">第二章</a>
<a href="PIC16Cxxx-3.htm">第三章</a> <a href="PIC16Cxxx-4.htm">第四章</a>
<a href="PIC16Cxxx-5.htm">第五章</a> <a href="PIC16Cxxx-6.htm">第六章</a>
<a href="PIC16Cxxx-7.htm">第七章</a> <a href="PIC16Cxxx-8.htm">第八章</a>
<a href="PIC16Cxxx-9.htm">第九章</a> <a href="PIC16Cxxx-10.htm">第十章</a></p></td>
</tr>
</table>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"> </td>
<td> </td>
</tr>
</table>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#990000">
<td height="1" width="634"></td>
</tr>
<tr align="right">
<td height="6"></td>
</tr>
<tr align="right">
<td><font color="#990000" size="2">[ <a href="index.htm">返回</a> ]</font>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -