📄 常用接口电路及其编程.htm
字号:
lang=EN-US>“</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">日</SPAN><SPAN
lang=EN-US>”</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">字形,另一个贺点形的发光管在显示器的右下角作为显示小数点用,它能显示各种数字及部份英文字母。</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">LED</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">显示器有两种不同的形式:一种是</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">8</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个发光二极管的阳极都连在一起的,称之为共阳极</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">LED</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">显示器;另一种是</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">8</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个发光二极管的阴极都连在一起的,称之为共阴极</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">LED</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">显示器。如下图所示。</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">`</SPAN></P>
<P style="MARGIN-LEFT: 36pt"><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">共阴和共阳结构的</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">LED</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">显示器各笔划段名和安排位置是相同的。当二极管导通时,相应的笔划段发亮,由发亮的笔划段组合而显示的各种字符。</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">8</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个笔划段</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">hgfedcba</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对应于一个字节(</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">8</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">位)的</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">D7 D6 D5 D4 D3 D2 D1 D0,</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">于是用</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">8</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">位二进制码就可以表示欲显示字符的字形代码。例如,对于共阴</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">LED</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">显示器,当公共阴极接地(为零电平),而阳极</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">hgfedcba</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">各段为</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">0111011</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时,显示器显示</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">"P"</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">字符,即对于共阴极</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">LED</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">显示器,</SPAN><SPAN
lang=EN-US>“</SPAN><SPAN lang=EN-US style="FONT-FAMILY: System">P</SPAN><SPAN
lang=EN-US>”</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">字符的字形码是</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">73H</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。如果是共阳</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">LED</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">显示器,公共阳极接高电平,显示</SPAN><SPAN
lang=EN-US>“</SPAN><SPAN lang=EN-US style="FONT-FAMILY: System">P</SPAN><SPAN
lang=EN-US>”</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">字符的字形代码应为</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">10001100</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">8CH</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">)。这里必须注意的是:很多产品为方便接线,常不按规则的方法去对应字段与位的关系,这时字形码就必须根据接线来自行设计了,后面我们会给出一个例子。</SPAN></P>
<P
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo4; tab-stops: list 36.0pt"><![if !supportLists]><SPAN
lang=EN-US>2.<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">静态显示接口</SPAN></P>
<P><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在单片机应用系统中,显示器显示常用两种方法:静态显示和动态扫描显示。所谓静态显示,就是每一个显示器都要占用单独的具有锁存功能的</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">I/O</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口用于笔划段字形代码。这样单片机只要把要显示的字形代码发送到接口电路,就不用管它了,直到要显示新的数据时,再发送新的字形码,因此,使用这种方法单片机中</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">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 style="FONT-FAMILY: System">I/O</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口电路很多,这里以常用的串并转换电路</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">74LS164</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为例,介绍一种常用静态显示电路,以使大家对静态显示有一定的了解。</SPAN></P>
<P><SPAN lang=EN-US style="FONT-FAMILY: System">MCS-51</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">单片机串行口方式押为移们寄存器方式,外接</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">6</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">片</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">74LS164</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">作为</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">6</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">位</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">LED</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">显示器的静态显示接口,把</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">8031</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">RXD</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">作为数据输出线,</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">TXD</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">作为移位时钟脉冲。</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">74LS164</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">TTL</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">单向</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">8</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">位移位寄存器,可实现串行输入,并行输出。其中</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">A</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">B</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(第</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">1</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">2</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">脚)为串行数据输入端,</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">2</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个引脚按逻辑与运算规律输入信号,公一个输入信号时可并接。</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">T</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(第</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">8</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">脚)为时钟输入端,可连接到串行口的</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">TXD</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">端。每一个时钟信号的上升沿加到</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">T</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">端时,移位寄存器移一位,</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">8</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个时钟脉冲过后,</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">8</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">位二进制数全部移入</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">74LS164</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中。</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">R</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(第</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">9</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">脚)为复位端,当</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">R=0</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时,移位寄存器各位复</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">0</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,只有当</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">R=1</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时,时钟脉冲才起作用。</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">Q1</SPAN><SPAN lang=EN-US>…</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">Q8</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(第</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">3-6</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">10-13</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">引脚)并行输出端分别接</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">LED</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">显示器的</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">hg---a</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">各段对应的引脚上。关于</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">74LS164</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">还可以作如下的介绍:所谓时钟脉冲端,其实就是需要高、低、高、低的脉冲,不管这个脉冲是怎么来的,比如,我们用根电线,一端接</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">T</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,一端用手拿着,分别接高电平、低电平,那也是给出时钟脉冲,在</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">74LS164</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">获得时钟脉冲的瞬间(再讲清楚点,是在脉冲的沿),如果数据输入端(第</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">1</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">2</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">引脚)是高电平,则就会有一个</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">1</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">进入到</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">74LS164</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的内部,如果数据输入端是低电平,则就会有一个</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: System">0</SPAN><SPAN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -