基于51单片机的74HC164驱动六位数码管显示程序与仿真
实验一 Keil C51集成开发环境的使用练习、仿真与调试
实验一Keil C51集成开发环境的使用练习、仿真与调试一、实验目的1、熟悉Keil C51集成开发环境的使用方法2、熟悉Keil C51集成开发环境调试功能的使用和DP-51PROC单片机综合仿真实验仪的使用。
二、实验设备及器件IBM PC机一台DP-51PROC单片机综合仿真实验仪一台三、实验内容1、进行Keil C51集成开发环境的安装和使用练习。
然后按照以下内容建立文件并编译产生HEX文件。
ORG 0000HLJMP MainORG 00F0HMain:MOV R7, #0Loop:MOV R6, #0DJNZ R6, $DJNZ R6, $DJNZ R6, $DJNZ R6, $DJNZ R7, LoopCPL P1.0 ; P 1 .0 取反CPL P1.1 ; P 1 .1 取反CPL P1.2 ; P 1 .2 取反CPL P1.3 ; P 1 .3 取反CPL P1.4 ; P 1 .4 取反CPL P1.5 ; P 1 .5 取反CPL P1.6 ; P 1 .6 取反CPL P1.7 ; P 1 .7 取反SJMP Main;END2、进行Keil C51集成开发环境的仿真调试练习。
然后按照以下内容建立文件并编译仿真调试。
ORG 8000HLJMP MainORG 80F0HMain:MOV R7, #0Loop:MOV R6, #0DJNZ R6, $DJNZ R6, $DJNZ R6, $DJNZ R6, $DJNZ R7, LoopCPL P1.0 ; P 1 .0 取反CPL P1.1 ; P 1 .1 取反CPL P1.2 ; P 1 .2 取反CPL P1.3 ; P 1 .3 取反CPL P1.4 ; P 1 .4 取反CPL P1.5 ; P 1 .5 取反CPL P1.6 ; P 1 .6 取反CPL P1.7 ; P 1 .7 取反SJMP MainEND四、实验要求1、熟练掌握Keil C51集成开发环境的工程建立、编辑与编译功能。
74HC164的驱动和应用
74HC164的驱动和应用74HC164的几点说明:1.74HC164是串行输入,并行输出的;2.它的并行输出其实是有延时的,只是延时时间小,可以认为是并行输出;74hc164封装和真值表:真值表中文解释说明:H-高电平 L -低电平 X -任意电平↑-低到高电平跳变(上升沿有效)QA0,QB0,QH0 -规定的稳态条件建立前的电平QAn,QGn -时钟最近的↑前的电平看真值表的第三条和第五条:就可以知道,在保持clear为 H, clock为↑状态下,AB都为H时,移位寄存器移入H,而当移位寄存器移入L时,必须令B为L,而A不受约束。
所以可以把AB断相连再接入单片机数据端口。
还有一种是A脚直接接高电平,B脚连入单片机数据端(P2_7)时序图:1. 首先区分输入输出信号。
这里CLEAR、A、B、CLOCK是输入信号,Qa~Qh是输出信号;2. 拿尺子开始扫描……2.1. 首先可以看到CLEAR的下降沿后输出全部置低电平。
结合后面的一个CLEAR 下降沿,可以得出结论:当CLEAR输入下降沿时,无论A、B、CLOCK状态为何,输出全部拉低;2.2. 尺子向右移动……找到Qa的第一个上升沿,可以看到这个上升沿是与CLOCK的上升沿对齐的,可以得出结论:输出在逻辑上与上升沿同步。
此时将会注意到在此之前已经有3个上升沿但输出始终为低电平,尺子移动分别比较这3个上升沿,其A、B输入分别为10、01,于是可以得出结论:Q a = A · B。
2.3. 尺子继续向右移动……可以分别看出在随后的CLOCK上升沿处,Qa全部按照A与B进行输出,从而验证以上结论。
此外Qb~Qh的波形为Qa波形依次移位得到。
基于51单片机的多功能电子时钟设计报告及其protel仿真电路及效果
单片机课程设计报告多功能电子数字钟姓名:学号:班级:指导教师:目录一课程设计题目-------------------------------- 3 二电路设计--------------------------------------- 4 三程序总体设计思路概述------------------- 5 四各模块程序设计及流程图---------------- 6 五课程设计心得及体会---------------------- 12 六程序、仿真电路效果见附录------------ 41一题目及要求本次单片机课程设计在Proteus软件仿真平台下实现,完成电路设计连接,编程、调试,仿真出实验结果。
具体要如下:用8051单片机设计扩展6位数码管的静态或动态显示电路,再连接几个按键和一个蜂鸣器报警电路,设计出一个多功能电子钟,实现以下功能:(1)走时(能实现时分秒,年月日的计时)(2)显示(分屏切换显示时分秒和年月日,修改时能定位闪烁显示)(3)校时(能用按键修改和校准时钟)(4)定时报警(能定点报时)本次课程设计要求每个学生使用Proteus仿真软件独立设计制作出电路图、完成程序设计和系统仿真调试,验收时能操作演示。
最后验收检查结果,评定成绩分为:(1)完成“走时+显示+秒闪”功能----及格(2)完成“校时修改”功能----中等(3)完成“校时修改位闪”----良好(4)完成“定点报警”功能,且使用资源少----优秀二电路设计(电路设计图见附件电路图)(1)采用89C51型号单片机(2)采用8位共阴数码管(3)因为单片机输出高电平时输出的电流不足以驱动数码管,所以在P0口与8位数码管之间加74LS373来驱动数码管(4)P2口与数码管选择位直接加74LS138译码器(5)蜂鸣器接P3.7口。
因为单片机输出高电平时输出的电流不足以驱动蜂鸣器所以蜂鸣器,所以P3.7口与蜂鸣器直接接反相器再接蜂鸣器的一端,蜂鸣器的另一端接5V电源。
51单片机实现的多图显示用12864液晶驱动程序设计
51单片机实现的多图显示用12864液晶驱动程序设计作者:佚名日期:2010年06月02日来源:不详【字体:大中小】我要评论(0)核心提示:/************************************************程序名称:12864液晶驱动程序(显示多图)简要说明:控制器:KS0107 LCD型号:FM12864、TS12864A-2或兼容型号(不带字库)&nbs/************************************************程序名称:12864液晶驱动程序(显示多图)简要说明:控制器:KS0107LCD型号:FM12864、TS12864A-2或兼容型号(不带字库)MCU:AT89S5*,晶体频率:11.0592MHz取模方式:纵向取模、字节倒序CS1和CS2为高电平有效************************************************/;***************硬件端口定义***********RS EQU P2.0RW EQU P2.1E EQU P2.2CS1 EQU P2.3CS2 EQU P2.4RST EQU P2.5COM EQU 20H ;指令数据寄存器DAT EQU 21H ;显示数据寄存器;**********************************主程序入口地址ORG 0000HAJMP STRORG 0003H;*********************************中断程序入口地址STR:AJMP L0100L0100: CLR RSTNOPNOPSETB RST;********************************以上是软件复位MOV SP,#60HMOV IE,#81H ;中断允许MOV IP,#01H ;优先中断MOV TCON,#00H ;电平中断MOV COM,#3FH ;显示开LCALL S02A9 ;左半屏写指令子程序LCALL S02C1 ;右半屏写指令子程序;----------------------------------------------------------------------MOV COM,#0C0H ;第一行LCALL S02A9 ;左半屏写指令子程序LCALL S02C1 ;右半屏写指令子程序;----------------------------------------------------------------------MOV COM,#0B8H ;第一页LCALL S02A9 ;左半屏写指令子程序LCALL S02C1 ;右半屏写指令子程序;----------------------------------------------------------------------MOV COM,#40H ;第一列LCALL S02A9 ;左半屏写指令子程序LCALL S02C1 ;右半屏写指令子程序;********************************************************以上是软件初始化MOV B,#0AAHLCALL XIHX ;显示横线1LCALL DELAY; MOV B,#55H; LCALL XIHX; LCALL DELAY ;显示横线2MOV B,#0FFHMOV 29H,#00HLCALL XISXLCALL DELAY ;显示竖线1; MOV B,#00H; MOV 29H,#0FFH; LCALL XISX; LCALL DELAY ;显示竖线2MOV DPTR,#TAB1LCALL LEFTMOV DPTR,#TAB2LCALL RIGHTLCALL DELAY ;显示第一幅图片MOV DPTR,#TAB3LCALL LEFTMOV DPTR,#TAB4LCALL RIGHTLCALL DELAY ;显示第二幅图片MOV DPTR,#TAB5LCALL LEFTMOV DPTR,#TAB6LCALL RIGHTLCALL DELAY ;显示第三幅图片AJMP L0100;=======================================================以上是主程序LEFT: MOV R1,#0B8H_AB: MOV COM,R1 ;第一页LCALL S02A9 ;左半屏写指令子程序MOV COM,#40H ;第一列LCALL S02A9 ;左半屏写指令子程序MOV R0, #64S027B: MOV A,#00HMOVC A,@A+DPTRMOV DAT,ALCALL S02B1 ;左半屏写数据子程序INC DPTRDJNZ R0,S027BINC R1CJNE R1, #0C0H,_ABRET;======================================================以上是左半屏写数据子程序RIGHT: MOV R1,#0B8HABC: MOV COM,R1 ;第一页LCALL S02C1 ;右半屏写指令子程序MOV COM,#40H ;第一列LCALL S02C1 ;右半屏写指令子程序MOV R0, #64S027D: MOV A,#00HMOVC A,@A+DPTRMOV DAT,ALCALL S02B9 ;右半屏写数据子程序INC DPTRDJNZ R0,S027DINC R1CJNE R1, #0C0H,ABCRET;*******************************************************以上是右半屏写数据子程序XIHX: MOV R1,#0B8HBA: MOV COM,R1 ;第一页LCALL S02A9 ;左半屏写指令子程序LCALL S02C1 ;右半屏写指令子程序MOV COM,#40H ;第一列LCALL S02A9 ;左半屏写指令子程序LCALL S02C1 ;右半屏写指令子程序MOV R0, #64W027B: MOV DAT,BLCALL S02B1 ;左半屏写数据子程序LCALL S02B9 ;右半屏写数据子程序DJNZ R0,W027BINC R1CJNE R1, #0C0H,BARET;---------------------------------------------------------XISX: MOV R1,#0B8HCA: MOV COM,R1 ;第一页LCALL S02A9 ;左半屏写指令子程序LCALL S02C1 ;右半屏写指令子程序MOV COM,#40H ;第一列LCALL S02A9 ;左半屏写指令子程序LCALL S02C1 ;右半屏写指令子程序MOV R0, #32X027B: MOV DAT,BLCALL S02B1 ;左半屏写数据子程序LCALL S02B9 ;右半屏写数据子程序MOV DAT,29HLCALL S02B1 ;左半屏写数据子程序LCALL S02B9 ;右半屏写数据子程序DJNZ R0,X027BINC R1CJNE R1, #0C0H,CARET;****************************************************以上是显示线条程序S02A9: SETB CS1LCALL S02C9CLR CS1 ;左半屏写指令子程序RETS02B1: SETB CS1 ;左半屏写数据子程序LCALL S02E0CLR CS1RETS02C1: SETB CS2 ;右半屏写指令子程序LCALL S02C9CLR CS2RETS02B9: SETB CS2 ;右半屏写数据子程序LCALL S02E0CLR CS2RET;****************************************************S02C9: CLR RSSETB RWS02C9A: MOV P0,#0FFHSETB EMOV A, P0CLR EJB ACC.7,S02C9ACLR RWMOV P0,COMSETB ENOPCLR ERET;*************************************************以上是写指令子程序S02E0: CLR RSSETB RWS02E0A: MOV P0,#0FFHSETB EMOV A, P0CLR EJB ACC.7,S02E0ASETB RSCLR RWMOV P0,DATSETB ENOPCLR ERET;************************************************以上是写数据子程序DELAY: MOV R5,#0BH ;延时D1: MOV R7,#0FFHD2: MOV R6,#0FFHD3: DJNZ R6,$DJNZ R7,D2DJNZ R5,D1RET;****************************************************************TAB1:;-- 调入了一幅图像:C\128x64-1.bmp --;-- 宽度x高度=64x64 --DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,080H,080H,0C0H,0C0 HDB0E0H,0E0H,0E0H,0F0H,0F0H,0F0H,0F0H,0F0H,0F8H,0F8H,0F8H,0F8H,0F8H,0F8H,0F8H,0F 8HDB0FCH,0FCH,0FCH,0FCH,0FCH,0FCH,0FCH,0FCH,0FCH,0FCH,07CH,078H,078H,038H,038H ,030HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,0E0H,0F0H,0FCH,0FEH,0FFH,0FFH,0FFH,0FFH,0F FHDB0FFH,0FFH,0FFH,0FFH,0EFH,0CFH,0E7H,0E7H,0E7H,0F3H,073H,033H,03BH,019H,00DH,0 8DHDB0CDH,0E7H,0F6H,0FEH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,07FH,03EH,01CH, 000HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,0E0H,0E0H,0F0H,0F0H,0F0H,0F8H,0F9H,0FDH,0FDH,0FDH,0DFH,09FH,08EH,08FH,0 8FHDB08FH,00FH,00FH,00FH,00FH,00FH,007H,003H,001H,060H,060H,06CH,06CH,06EH,06FH,06 7HDB067H,0E7H,0F7H,0F7H,0F3H,0F3H,0F3H,0F3H,0F9H,0F9H,0F8H,0F8H,0FCH,0FCH,0FEH,0 FEHDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,001H,00FH,07FH,0FFH,0FFH,0FFH,0FFH,0FFH,07FH,01FH,00FH,007H,003H,003H,00 1HDB081H,0E0H,0F0H,0F8H,0FCH,0FEH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FEH,0FEH,0FEH, 0FEHDB0FEH,0FCH,0FCH,0FCH,0F8H,0F0H,061H,001H,001H,003H,003H,007H,0DFH,0FFH,0FFH,0 FFHDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,001H,00FH,07FH,0FFH,0FFH,0E0H,0C0H,0C0H,080H,000H,000H,00 0HDB003H,007H,00FH,00FH,00FH,00FH,00FH,00FH,00FH,00FH,00FH,00FH,00FH,00FH,00FH,00 7HDB087H,087H,0C3H,0C3H,0C1H,0E0H,0F0H,0F0H,0F8H,0FCH,0FCH,0FFH,0FFH,0FFH,0FFH, 0FFHDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,001H,00FH,07FH,0FFH,0FFH,0FFH,0FFH,0FFH,0F FHDB0FEH,0FEH,0FEH,0FEH,0FEH,0FEH,0FEH,0FEH,0FEH,0FEH,0FEH,0FEH,0FFH,0FFH,0FFH ,0FFHDB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,07FH,07FH,03FH,03FH,03FH,01FH,01FH,01FH,0 0FHDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,003H,00FH,07FH,0FFH,0FFH,0FF HDB0FFH,07FH,07FH,03FH,03FH,03FH,01FH,01FH,01FH,00FH,00FH,00FH,007H,007H,003H,00 3HDB003H,001H,001H,001H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HTAB2:;-- 调入了一幅图像:C:\128x64-2.bmp --;-- 宽度x高度=64x64 --DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,080H,080H,080H,0C0 HDB0C0H,0C0H,0E0H,0E0H,0E0H,0F0H,0F0H,0F8H,0F8H,0F8H,0FCH,0FCH,0FCH,0FEH,0FEH, 0FFHDB0FFH,0FFH,0FFH,0FEH,0F8H,0C0H,000H,000H,000H,000H,000H,000H,000H,000H,000H,00 0HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB030H,038H,078H,0F8H,0FCH,0FCH,0FCH,0FEH,0FEH,0FEH,0FFH,0FFH,0FFH,0FFH,0FFH, 0FFHDB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, 0FFHDB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FEH,0F0H,0C0H,000H,000H,000H,000H,000H,000H,00 0HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,080H,0C0H,0F1H,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0 FFHDB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, 0FFHDB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FEH,0F0H,080H,000H,000H,000H,0 00HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,03FH,007H,001H,001H,001H,001H,00 1HDB0E1H,0FDH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,01FH,007H,001H,001H,001H,0C1H,0 C1HDB001H,001H,001H,007H,01FH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FEH,0F0H,080H,00 0HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,03FH,007H,001H,000H,000H,000H,000H,0E0H,0F8H,0F FHDB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,03FH,007H,000H,000H,000H,000H,038H,03EH,03FH,0B FHDB0BFH,0F8H,0C0H,0C0H,0E0H,0E0H,0E7H,0FFH,0FFH,09FH,01FH,00FH,00FH,007H,007H,0 00HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB0FFH,0FFH,0FFH,0FFH,0EFH,0E1H,0E0H,0E0H,0E0H,0E0H,0E0H,0F8H,07FH,07FH,07FH,0 3FHDB03FH,03FH,07FH,07FH,07FH,078H,07CH,07CH,07CH,07EH,00EH,007H,003H,003H,003H,00 3HDB003H,003H,003H,00FH,03FH,07FH,07FH,07FH,07FH,07FH,07CH,070H,000H,000H,000H,00 0HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB00FH,00FH,007H,007H,003H,003H,003H,001H,001H,001H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HTAB3:;-- 调入趣味性文字和图片像右半屏:纵向取模下高位,数据排列:从左到右从上;-- 宽度x高度=64x64 --DB000H,000H,000H,000H,000H,000H,000H,000H,000H,0E0H,0C0H,080H,0C0H,0F8H,0F0H,0B 0HDB060H,068H,0D0H,0F0H,0F0H,020H,020H,060H,0C0H,0C0H,0C0H,0C0H,080H,080H,080H,00 0HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,0C0H,0F0H,0FCH,0EFH,0F3H,0F9H,0FCH,0F1H,07BH,07DH,0 3FHDB03EH,038H,03EH,03CH,03DH,038H,03FH,03FH,03EH,03EH,03FH,03FH,03FH,03FH,07FH,0 7FHDB0FFH,0FEH,0FEH,0FCH,0F8H,0F0H,0E0H,080H,000H,000H,000H,000H,000H,000H,000H,00 0HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,0E0H,0FEH,0FFH,0FFH,0FFH,07FH,007H,001H,000H,000H,008H,008H,00 8HDB010H,010H,020H,040H,000H,000H,000H,000H,000H,040H,020H,010H,010H,008H,008H,008 HDB000H,000H,001H,007H,03FH,0FFH,0FFH,0FFH,0FEH,0E0H,000H,000H,000H,000H,000H,00 0HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,080H,09FH,0FFH,0FFH,063H,061H,0E0H,0E0H,0F0H,0F0H,0F0H,0F0H,0D0H,08 0HDB010H,010H,020H,020H,0C0H,060H,060H,060H,0C0H,0E0H,0E0H,0F0H,0F0H,0F0H,0F0H,0D 0HDB010H,010H,010H,020H,0E0H,060H,061H,0FFH,0FFH,09FH,080H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB006H,009H,010H,010H,020H,039H,060H,080H,001H,003H,007H,007H,007H,007H,007H,007 HDB007H,004H,004H,022H,041H,040H,040H,040H,041H,023H,007H,007H,007H,007H,007H,007 HDB007H,004H,004H,002H,001H,080H,060H,039H,020H,010H,010H,019H,0E6H,000H,004H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,080H,0C0H,0C0H,0E1H,0E2H,0E2H,0F4H,0F4H,0F4H,0F8H,0F 8HDB0F8H,0F0H,0F0H,0F0H,090H,090H,090H,090H,090H,070H,0F0H,0F0H,0E8H,0E8H,0E8H,0C 4HDB0C4H,084H,082H,002H,0FBH,0F4H,0E4H,0F4H,0FCH,004H,002H,001H,000H,000H,000H,00 0HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,007H,00FH,01FH,03FH,03FH,07FH,07FH,0FFH,021H,001H,003H,007 HDB00FH,09FH,0FFH,0FFH,0FFH,0FEH,0F9H,0F7H,0FEH,0F8H,0FFH,0FFH,0FFH,0FFH,0FFH,0 E7HDB00FH,00FH,01FH,01FH,03FH,03FH,03FH,03FH,01FH,000H,000H,000H,000H,000H,000H,00 0HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,001H,002H,004H,004H,004 HDB002H,001H,00FH,03FH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0 FFHDB0FFH,0FCH,0F0H,060H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HTAB4:;-- 调入了一幅图像:帅呆了吧DB000H,000H,0E0H,000H,0F8H,000H,0E0H,020H,0F8H,020H,020H,0E0H,000H,000H,000H,078 HDB048H,048H,0C8H,048H,048H,078H,000H,000H,000H,000H,008H,008H,008H,008H,0C8H,048 HDB028H,018H,008H,000H,000H,0F0H,010H,0F0H,000H,0F0H,010H,010H,0F0H,010H,0F8H,010 HDB000H,000H,000H,000H,000H,000H,000H,000H,0E0H,0F0H,0F0H,0E0H,000H,000H,000H,000 HDB000H,020H,017H,008H,007H,000H,00FH,000H,03FH,000H,008H,00FH,000H,021H,011H,009 HDB005H,003H,03FH,003H,005H,009H,011H,011H,000H,000H,000H,000H,020H,020H,03FH,000 HDB000H,000H,000H,000H,000H,007H,004H,007H,000H,01FH,021H,021H,021H,021H,021H,038 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,01BH,01BH,000H,000H,000H,000H,000 HDB000H,0F4H,05CH,034H,05CH,0F4H,000H,05CH,048H,07EH,048H,048H,000H,040H,05EH,0D 4HDB054H,054H,040H,0DEH,054H,054H,052H,058H,000H,000H,002H,002H,002H,002H,0F2H,012DB00AH,006H,002H,000H,000H,0FCH,084H,084H,0FCH,000H,03AH,022H,0A2H,0FEH,022H,02 2HDB000H,000H,000H,000H,000H,000H,000H,000H,038H,0FCH,0FCH,038H,000H,000H,000H,000 HDB000H,00FH,005H,005H,005H,00FH,000H,00FH,009H,009H,009H,00FH,000H,00AH,009H,00B HDB005H,003H,000H,00FH,00AH,009H,009H,00EH,000H,000H,000H,000H,008H,008H,00FH,000 HDB000H,000H,000H,000H,000H,001H,000H,008H,009H,004H,002H,009H,008H,00FH,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,006H,006H,000H,000H,000H,000H,000 HDB000H,018H,0FFH,008H,050H,044H,044H,0FFH,044H,044H,07CH,040H,000H,020H,022H,02 AHDB0B2H,062H,0FFH,062H,0B2H,02AH,022H,020H,000H,004H,004H,0FFH,004H,004H,0FCH,00 0HDB0FCH,004H,004H,0FCH,000H,000H,000H,000H,0C1H,031H,00EH,030H,0C0H,000H,000H,00 0HDB000H,000H,000H,07CH,055H,056H,0FCH,056H,055H,054H,07CH,000H,000H,000H,000H,00 0HDB000H,000H,007H,0C4H,004H,002H,001H,0C0H,001H,002H,004H,004H,000H,002H,002H,0C 1HDB000H,000H,087H,080H,080H,0C1H,082H,002H,000H,004H,003H,080H,044H,004H,003H,000 HDB0C7H,002H,002H,007H,000H,004H,082H,001H,000H,0C0H,000H,000H,000H,0C1H,002H,00 4HDB000H,001H,001H,0C1H,041H,041H,0C7H,041H,041H,041H,0C1H,001H,000H,000H,000H,00DB000H,000H,080H,07FH,012H,012H,012H,013H,0F2H,002H,002H,002H,000H,061H,019H,0FF HDB009H,091H,07FH,000H,000H,0FFH,000H,0C0H,000H,0FFH,091H,091H,091H,0FFH,004H,00 BHDB031H,001H,001H,0FFH,000H,002H,0FFH,002H,002H,07FH,022H,022H,022H,07FH,002H,002 HDB000H,020H,020H,017H,08DH,075H,007H,005H,0FDH,015H,027H,020H,000H,000H,000H,000 HDB000H,001H,000H,000H,000H,000H,000H,000H,001H,000H,000H,000H,000H,000H,000H,001 HDB001H,000H,000H,000H,000H,001H,001H,001H,000H,001H,000H,000H,000H,001H,000H,000 HDB001H,001H,001H,000H,000H,000H,001H,001H,001H,001H,001H,001H,001H,001H,001H,001 HDB000H,000H,001H,001H,000H,000H,000H,000H,001H,000H,000H,000H,000H,000H,000H,000 HTAB5:;-- 调入图像:纵向取模下高位,数据排列:从左到右从上到下;-- 宽度x高度=64x64 --DB000H,000H,000H,000H,000H,000H,000H,000H,000H,0C0H,0E0H,0E0H,0F0H,0F0H,0F0H,0F 0HDB0F0H,0F0H,0F8H,0BCH,01CH,08CH,0CEH,0CFH,0CFH,0EBH,0C9H,0D0H,090H,010H,010H, 010HDB020H,021H,061H,041H,043H,0C2H,08CH,000H,001H,001H,002H,006H,00CH,00FH,010H,03 EHDB023H,046H,085H,089H,019H,033H,066H,08DH,0DBH,0F9H,0A6H,02FH,03FH,007H,08FH,0C FHDB000H,000H,000H,080H,0E0H,0F0H,0F0H,0F0H,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0 FFHDB0FFH,07FH,0FFH,0EFH,0FFH,0FFH,0FFH,0FFH,07FH,06FH,037H,01BH,00FH,007H,001H,0 0FHDB009H,00AH,00EH,006H,006H,004H,004H,00CH,008H,018H,010H,020H,060H,040H,0C0H,08 0HDB000H,000H,000H,001H,0C3H,007H,00DH,037H,022H,0C2H,083H,001H,00FH,037H,01FH,03 7HDB000H,000H,000H,0FFH,0FFH,0FFH,0FFH,01FH,006H,0C6H,0E6H,066H,07EH,0FFH,0EFH,0 D1HDB0D9H,0E9H,0E9H,0F9H,0F2H,0E6H,01CH,030H,000H,000H,000H,000H,000H,000H,000H,00 0HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,001 HDB003H,0C6H,078H,0B0H,0E0H,083H,00EH,018H,0E0H,080H,003H,00EH,038H,0C0H,018H,0F 0HDB000H,000H,000H,000H,007H,00FH,01FH,01FH,01CH,0FFH,07FH,060H,038H,027H,079H,0C 1HDB0F3H,0F3H,0FFH,0FFH,078H,03FH,002H,000H,000H,000H,000H,000H,000H,000H,002H,071 HDB039H,019H,0F9H,0F9H,0F9H,0FBH,0FBH,073H,073H,0E6H,0CEH,09CH,038H,030H,000H,0 00HDB000H,01FH,0E0H,0FFH,0FFH,0FFH,0FCH,0F8H,0E0H,087H,0F8H,000H,000H,007H,0FEH,0 F1HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,07FH,0C0H,000H,000H,000H,000H,000 HDB080H,000H,000H,010H,010H,000H,020H,020H,020H,000H,000H,000H,000H,000H,01CH,03E HDB070H,07CH,07CH,078H,0FFH,0FFH,07FH,07EH,03EH,01FH,003H,003H,002H,000H,000H,00 0HDB000H,000H,000H,0FBH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,000H,000H,000H,0FFH,0 F3HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,003H,018H,0E0H,000H,000H,000 HDB003H,006H,00EH,00EH,00EH,018H,018H,018H,008H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,080 HDB0C0H,0C6H,0EFH,0A7H,073H,07BH,009H,084H,0CCH,0E3H,0FFH,0F8H,0FCH,0FEH,0FFH, 0FFHDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,002H,006 HDB000H,00CH,008H,008H,000H,010H,010H,010H,010H,010H,018H,018H,008H,084H,084H,004 HDB006H,0F2H,0B2H,016H,034H,0E4H,004H,004H,004H,00CH,0CCH,08CH,01CH,018H,03FH,0 3FHDB07CH,0DEH,0DFH,0DFH,0EEH,0F7H,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, 0FFHDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000 HDB000H,000H,000H,000H,000H,000H,000H,004H,004H,00EH,036H,064H,07CH,018H,001H,003 HDB00EH,000H,001H,001H,003H,001H,000H,000H,000H,000H,003H,003H,003H,001H,000H,000 HDB000H,000H,001H,007H,00FH,03FH,07FH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0 FFHTAB6:;-- 调入图像:纵向取模下高位,数据排列:从左到右从上到下;-- 宽度x高度=64x64;-- 调入了一幅图像:我们年轻.bmp --;-- 宽度x高度=64x64 --DB000h,000h,000h,000h,000h,000h,000h,000h,080h,080h,000h,0C0h,000h,080h,000h,000h DB000h,000h,000h,000h,000h,0C0h,000h,040h,080h,000h,080h,080h,080h,000h,000h,000h DB000h,000h,0C0h,000h,000h,000h,000h,000h,000h,000h,080h,000h,000h,000h,000h,000h DB0C0h,000h,000h,000h,080h,080h,080h,080h,080h,000h,000h,000h,000h,000h,000h,000h DB000h,000h,000h,044h,044h,045h,025h,0FFh,014h,014h,084h,07Fh,0C4h,024h,015h,084h DB000h,000h,008h,004h,0FFh,000h,0FFh,000h,000h,000h,000h,000h,0FFh,000h,000h,000h DB044h,042h,079h,049h,049h,049h,0FFh,049h,049h,049h,049h,041h,000h,000h,089h,08Fh DB049h,0FDh,029h,001h,028h,024h,0E2h,023h,024h,008h,000h,000h,000h,000h,000h,000h DB000h,000h,000h,080h,080h,088h,0B2h,003h,020h,0A1h,028h,030h,020h,0E1h,022h,023h DB000h,000h,080h,040h,03Bh,020h,023h,020h,0E0h,020h,020h,022h,033h,020h,000h,000h DB020h,0E0h,038h,0A0h,020h,020h,013h,090h,050h,070h,090h,000h,000h,000h,020h,0A0h DB0A8h,0B3h,0A0h,0A2h,082h,0FAh,083h,092h,0A2h,082h,000h,000h,000h,000h,000h,000h DB000h,000h,000h,000h,040h,020h,01Fh,020h,050h,048h,045h,042h,045h,048h,050h,040h DB000h,000h,008h,008h,00Fh,009h,009h,009h,07Fh,009h,009h,009h,009h,008h,000h,000h DB011h,011h,009h,07Fh,005h,040h,045h,044h,07Ch,044h,044h,041h,000h,000h,020h,01Bh DB042h,07Eh,00Ah,053h,020h,01Fh,000h,07Fh,040h,070h,000h,000h,000h,000h,000h,000h DB000h,000h,000h,000h,040h,040h,040h,05Fh,055h,055h,0D5h,055h,05Fh,040h,040h,040h DB000h,000h,010h,011h,0F6h,000h,000h,0FCh,056h,055h,054h,05Eh,0C4h,000h,000h,000h DB010h,0D4h,014h,0FFh,094h,094h,022h,022h,0FEh,022h,022h,020h,000h,000h,008h,008hDB008h,008h,0C8h,03Fh,048h,088h,008h,008h,00Ch,008h,000h,000h,000h,000h,000h,000hDB000h,000h,000h,000h,000h,0C8h,044h,043h,0C4h,008h,0CFh,049h,049h,049h,0E9h,048h DB000h,000h,008h,084h,0C3h,0A4h,088h,00Bh,00Ah,0EAh,08Ah,08Ah,08Bh,008h,000h,000h DB08Ch,003h,004h,0E7h,008h,008h,008h,0E8h,00Bh,008h,008h,008h,000h,000h,048h,044hDB042h,041h,040h,041h,046h,040h,041h,042h,06Ch,044h,000h,000h,000h,000h,000h,000hDB000h,000h,000h,000h,000h,0FFh,022h,025h,018h,000h,0FFh,044h,044h,044h,0FFh,000hDB000h,000h,000h,0FFh,088h,088h,0FFh,002h,005h,018h,080h,000h,0FFh,000h,000h,000hDB020h,013h,008h,0FFh,002h,002h,002h,0FFh,002h,002h,002h,002h,000h,000h,000h,0FFhDB009h,011h,0FFh,000h,000h,0FFh,009h,011h,0FFh,000h,000h,000h,000h,000h,000h,000hDB 000h,000h,000h,000h,000h,001h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h DB 000h,000h,000h,001h,000h,000h,001h,000h,000h,000h,000h,001h,000h,000h,000h,000h DB 000h,000h,000h,001h,000h,001h,001h,001h,001h,001h,001h,000h,000h,000h,000h,001h DB 000h,001h,001h,000h,000h,001h,000h,001h,001h,000h,000h,000h,000h,000h,000h,000h END上传两个显示画面液晶屏是朋友托卖的,无背光无字库,带负压产生电路,有些成色比较新,先到先得了,45RMB一块,送资料,驱动程序,QQ以下是程序//**************************************;* 控制器:KS0107 *;* LCD型号:TS12864A-2或兼容型号 *;* MCU:AT89S5* ,晶体频率:11.0592MHz *;* 取模方式:纵向字节倒序 *;* CS1和CS2为高电平有效 * *;***************硬件端口定义***********RS EQU P2.4RW EQU P2.3E EQU P2.2CS1 EQU P2.7CS2 EQU P2.6RST EQU P2.5BUF EQU P0;******************************************COM EQU 20H ;指令数据寄存器DAT EQU 21H ;显示数据寄存器;**********************************主程序入口地址ORG 0000HAJMP STRORG 0003H;*********************************中断程序入口地址STR:AJMP L0100L0100: CLR RSTNOPNOPSETB RST;********************************以上是软件复位MOV SP,#60HMOV IE,#81H ;中断允许MOV IP,#01H ;优先中断MOV TCON,#00H ;电平中断MOV COM,#3FH ;显示开LCALL S02A9 ;左半屏写指令子程序LCALL S02C1 ;右半屏写指令子程序;---------------------------------------------------------------------- MOV COM,#0C0H ;第一行LCALL S02A9 ;左半屏写指令子程序LCALL S02C1 ;右半屏写指令子程序;---------------------------------------------------------------------- MOV COM,#0B8H ;第一页LCALL S02A9 ;左半屏写指令子程序LCALL S02C1 ;右半屏写指令子程序;---------------------------------------------------------------------- MOV COM,#40H ;第一列LCALL S02A9 ;左半屏写指令子程序LCALL S02C1 ;右半屏写指令子程序;********************************************************以上是软件初始化MOV B,#0AAHLCALL XIHX ;显示横线1LCALL DELAYMOV B,#55HLCALL XIHXLCALL DELAY ;显示横线2MOV B,#0FFHMOV 29H,#00HLCALL XISXLCALL DELAY ;显示竖线1MOV B,#00HMOV 29H,#0FFHLCALL XISXLCALL DELAY ;显示竖线2MOV DPTR,#TAB1LCALL LEFTMOV DPTR,#TAB2LCALL RIGHTLCALL DELAY ;显示第一幅图片MOV DPTR,#TAB3LCALL LEFTMOV DPTR,#TAB4LCALL RIGHTLCALL DELAY ;显示第二幅图片MOV DPTR,#TAB5LCALL LEFTMOV DPTR,#TAB6LCALL RIGHTLCALL DELAY ;显示第三幅图片AJMP L0100;=======================================================以上是主程序LEFT: MOV R1,#0B8H_AB: MOV COM,R1 ;第一页LCALL S02A9 ;左半屏写指令子程序MOV COM,#40H ;第一列LCALL S02A9 ;左半屏写指令子程序MOV R0, #64S027B: MOV A,#00HMOVC A,@A+DPTRMOV DAT,ALCALL S02B1 ;左半屏写数据子程序INC DPTRDJNZ R0,S027BINC R1CJNE R1, #0C0H,_ABRET;======================================================以上是左半屏写数据子程序RIGHT: MOV R1,#0B8HABC: MOV COM,R1 ;第一页LCALL S02C1 ;右半屏写指令子程序MOV COM,#40H ;第一列LCALL S02C1 ;右半屏写指令子程序MOV R0, #64S027D: MOV A,#00HMOVC A,@A+DPTRMOV DAT,ALCALL S02B9 ;右半屏写数据子程序INC DPTRDJNZ R0,S027DINC R1CJNE R1, #0C0H,ABCRET;*******************************************************以上是右半屏写数据子程序XIHX: MOV R1,#0B8HBA: MOV COM,R1 ;第一页LCALL S02A9 ;左半屏写指令子程序LCALL S02C1 ;右半屏写指令子程序MOV COM,#40H ;第一列LCALL S02A9 ;左半屏写指令子程序LCALL S02C1 ;右半屏写指令子程序MOV R0, #64W027B: MOV DAT,BLCALL S02B1 ;左半屏写数据子程序LCALL S02B9 ;右半屏写数据子程序DJNZ R0,W027BINC R1CJNE R1, #0C0H,BARET;--------------------------------------------------------- XISX: MOV R1,#0B8HCA: MOV COM,R1 ;第一页LCALL S02A9 ;左半屏写指令子程序LCALL S02C1 ;右半屏写指令子程序MOV COM,#40H ;第一列LCALL S02A9 ;左半屏写指令子程序LCALL S02C1 ;右半屏写指令子程序MOV R0, #32X027B: MOV DAT,BLCALL S02B1 ;左半屏写数据子程序LCALL S02B9 ;右半屏写数据子程序MOV DAT,29HLCALL S02B1 ;左半屏写数据子程序LCALL S02B9 ;右半屏写数据子程序DJNZ R0,X027BINC R1CJNE R1, #0C0H,CARET;****************************************************以上是显示线条程序S02A9: SETB CS1LCALL S02C9CLR CS1 ;左半屏写指令子程序RETS02B1: SETB CS1 ;左半屏写数据子程序LCALL S02E0CLR CS1RETS02C1: SETB CS2 ;右半屏写指令子程序LCALL S02C9CLR CS2RETS02B9: SETB CS2 ;右半屏写数据子程序LCALL S02E0CLR CS2RET;****************************************************S02C9: CLR RSSETB RWS02C9A: MOV BUF,#0FFHSETB EMOV A, BUFCLR EJB ACC.7,S02C9ACLR RWMOV BUF,COMSETB ENOPCLR ERET;*************************************************以上是写指令子程序S02E0: CLR RSSETB RWS02E0A: MOV BUF,#0FFHSETB EMOV A, BUFCLR EJB ACC.7,S02E0ASETB RSCLR RWMOV BUF,DATSETB ENOPCLR ERET;************************************************以上是写数据子程序DELAY: MOV R5,#0BH ;延时D1: MOV R7,#0FFHD2: MOV R6,#0FFHD3: DJNZ R6,$DJNZ R7,D2DJNZ R5,D1RET;****************************************************************TAB1:;-- 调入菲戈幅图像左半屏:纵向取模下高位,数据排列:从左到右从上到下;-- 宽度x高度=64x64DB000h,000h,000h,040h,080h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,010h DB060h,080h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,0FCh,000h,000h DB000h,000h,000h,000h,000h,000h,000h,000h,000h,0C0h,030h,008h,000h,000h,000h,000h DB000h,000h,000h,000h,000h,080h,040h,000h,000h,000h,000h,000h,000h,000h,000h,000h DB000h,000h,000h,000h,000h,001h,002h,004h,008h,010h,020h,040h,080h,000h,000h,000h DB000h,001h,006h,018h,060h,080h,000h,000h,000h,000h,000h,000h,000h,0FFh,000h,000h DB000h,000h,000h,000h,000h,0C0h,030h,00Ch,003h,000h,000h,000h,000h,080h,040h,020h DB010h,008h,004h,002h,001h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h DB002h,002h,004h,004h,008h,008h,010h,010h,020h,020h,040h,040h,080h,081h,002h,004h DB008h,010h,020h,040h,080h,001h,006h,018h,020h,000h,000h,000h,080h,09Fh,080h,000h DB000h,040h,030h,00Ch,003h,080h,040h,020h,010h,008h,004h,002h,001h,000h,000h,080h DB080h,040h,040h,020h,020h,010h,010h,010h,008h,008h,004h,004h,002h,002h,000h,000h000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,001h,001h DB002h,002h,004h,004h,008h,009h,000h,030h,0CCh,002h,001h,001h,000h,000h,000h,001h DB001h,002h,0CCh,030h,001h,000h,008h,008h,004h,004h,002h,002h,001h,001h,001h,000h DB000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h DB000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,004h,018h DB060h,080h,000h,000h,000h,000h,000h,000h,000h,001h,002h,002h,084h,0FCh,044h,042h DB022h,021h,020h,020h,010h,010h,010h,060h,080h,000h,000h,000h,000h,000h,000h,000h DB000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h DB000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h DB000h,000h,003h,004h,004h,002h,002h,002h,001h,001h,001h,001h,000h,0FFh,000h,000h DB000h,000h,000h,000h,000h,000h,000h,000h,000h,001h,006h,008h,010h,000h,000h,000h DB000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h DB000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h DB000h,000h,080h,080h,040h,040h,020h,020h,010h,010h,008h,008h,004h,00Fh,010h,020h。
74hc164驱动数码管笔段问题
{
uchar i;
i=8;
ACC=data__CLK=0;
simuseri_DATA=a0;
simuseri_CLK=1;
ACC=ACC>>1;
numer=dis_code[ge];
out_simuseri(numer); //个位移位显示
delay(5);
P2_0=1;
P2_1=0;
numer=dis_code[shi]; //十位移位
out_simuseri(numer);
0x74,0x61,0x21,0x7A,0x20,0x60, 0x01};
uchar numer,temp;
uchar ge,shi;
//----------------------------------------------------------------------------
// 函数名称:out_simuseri
// 输入参数:data_buf
// 输出参数:无
// 功能说明:8位同步移位寄存器,将data_buf的数据逐位输出到simuseri_DATA
//----------------------------------------------------------------------------
}
while(--i!=0);
}
/************************************/
void delay(uchar ms) //延时程序
{
uchar i;
74LS164和74LS165工作原理及其单片机中的应用(基于Proteus仿真)
74LS164和74LS165工作原理及其在单片机中的应用基于Proteus仿真前言:本文详细介绍了74LS164和74LS165工作原理,并分别举例它们在单片机中的应用,所举例子包含proteus仿真电路图,源程序,程序注释详细清楚。
1、74LS164在单片机中应用举例本例在单片机串行口外接一片8位串入并出移位寄存器74LS164芯片,构成单片机输出接口电路,控制8只LED滚动显示。
(1)74LS164芯片如右图所示,它是8位串入并出移位寄存器,串行输入数据,然后并行输出。
各引脚功能如下:A、B(1、2引脚):数据输入端,数据通过这两个输入端之一串行输入;任一输入端可以用作高电平使能端,控制另一输入端的数据输入。
当其中任意一个为低电平,则禁止新数据输入;当其中有一个为高电平,则另一个就允许输入数据。
因此两个输入端或者连接在一起,或者把不用的输入端接高电平,一定不要悬空。
Q0~Q7(3~6,10~13引脚):数据输出端CP(8号引脚):时钟输入端。
CP每次由低变高时,数据右移一位,输入到Q0,Q0 是两个数据输入端的逻辑与,它将上升时钟沿之前保持一个建立时间的长度。
MR:复位清除端,当MR为低电平时,其它所有输入端都无效,同时所有输出端均为低电平。
GND(7号引脚,在proteus中已隐藏):接地端VCC(14号引脚,在proteus中已隐藏):电源端,接+5V电源74LS164 内部逻辑图(2)如下图所示,本例单片机串行口工作于方式0,即移位寄存器输入/输出模式。
串行数据通过RXD输出,TXD则用于输出移位时钟脉冲。
数据输入端1接高电平,数据输入端2接单片机RXD引脚。
时钟输入端接TXD引脚,复位端悬空。
数据输出端通过限流电阻接8只LED灯。
C程序如下:#include <reg51.h>#include <intrins.h>#define uint unsigned int#define uchar unsigned charvoid delay(uint x){uchar i;while(x--)for(i=0;i<120;i++);}void main(){uchar c=0x80;SCON=0x00; //串行口工作在方式0while(1){c=_crol_(c,1);SBUF=c;while(TI==0); //等待发送结束TI=0; //发送结束,TI置0delay(400);}}Proteus仿真运行结果如下:2、74LS165在单片机中的应用举例本例在单片机串行口外接一片8位并入串出移位寄存器74LS165,连接移位寄存器并行输入端的是8位拨码开关,其开关动作对应的8位二进制序列将通过移位寄存器串行输入到单片机串口,并通过单片机P0端口的8只LED显示出来。
74HC164应用实例:驱动数码管两例(电路图和源程序)
74HC164应用实例:驱动数码管两例(电路图和源程序)————————————————————————————————作者:————————————————————————————————日期:4HC164应用实例:驱动数码管两例(电路图和源程序) 文章编号:100816210758 文章分类: 电路 > 电子元件 点击:... 关键词: 74HC164文章来源:百合电子工作室收集整理 摘要: 74HC164应用实例:驱动数码管的两个实例分别提供了汇编源程序和C 源程序...实例174HC164是串行输入,并行输出接口器件,可用在单向的并行输出/并行地址锁存等. 74HC164因为价格便宜,容易使用特别适合使用在在需要用到数码管显示IO 口又比较紧张的电子产品中,下面浅谈使用方法:1. 首先先了解他的引脚功能和逻辑图,如下图:图1 引脚名称和用途图2 真值表通过真值表我们可以了解到,A,B两个输入端是互锁的,CLK上升沿时数据移入移位寄存器中,CLEAR为清零用的,接低电平时所有端口都输出低电平,了解了真值表之后开始运用了,先给出如下原理图:图3 原理图图中,采用义隆的EM78P153作为控制芯片,P50作为CLK时钟信号,注意平时数据不传输时,时钟信号是不发送的应一直保持低电平或者高电平,数据需要传输的时候才输出时钟信号^_^ ,继续P51作为移位数据输出端,接到74HC164的B端,A端接高电平,当然也可以AB端短路,然后连接到DATA移位数据端,P52作为数码管的选通信号(也可以叫消隐^_^), 作用是使数据传输过程暂时关闭显示,以免显示出不需要的数据,原因是应为164不带锁存功能,数据传输过程是一位一位的向高位移位输出的,所以要等数据全部移入后才打开始点亮数码管.注意了哦,通过查看164的规格书发现,164输出高电平电流比输出低电平电流要小,亦称灌电流大,扇出电流弱,所以适合选用共阳数码管,如图,本人偷懒没有画出那个数码管的8字该介绍的介绍的差不多了,废话少说,该开始干活了,任务是: 显示0-9 每秒+1 ,到9后又返回0,一直循环显示,根据任务得到如下流程图:1. 显示部分:将需要显示的数值送入A ==>查表求得显示段码==>将段码逐位移入164==>8位移完后点亮数码管==>延时==>返回第一步执行2. 中断部分:进入中断==>保存现场(以备调查取证,送你入狱^_^)==>重置TCC==>够1秒钟将需要显示的数据+1,并重置,不够就退出;根据以上要求就开始写代码调试了,要注意一点,数据移位时一定要记得高位在前哦,否则显示错误别怪我没有说清楚,我当年实验时就因为这个数据移位方向反了排查了半天,甚至以为是时钟频率不对,又以为时许不对.....搞了半天,NND后来重看DATASHEET才发现,原来是低级错误啊,呜呼哀哉.......,希望你不要重蹈我覆辙,哎哟!! 谁! 谁! 谁扔砖头上来? 啥? 你扔的? 我废话太多.........,那俺少来两句,继续上菜, 咦好像没啥可说的了,上源程序吧1.;中断部分:2.3.;;;;;;;;;;中断;;;;;;;;4.INTPUT:5.MOV TEMPA, A;6.MOV A,@130;7.MOV TCC,A;255-130=1258.CLR RF;9.;;;;;此处填写250Us处理程序10. BS WKREG,T500US11.;;;;;;;;;;;;;;;;;;;;;;;;;12. DJZ R1MS13.JMP INTEXT;14.MOV A,@415.MOV R1MS,A;重置16. BS WKREG,T1MS17.;;;;;;;此处填写1ms处理程序18.19.;;;;;;;;;;;;;;;;;;;;;;;;;;20. DJZ R20MS21.JMP INTEXT;22.MOV A,@2023.MOV R20MS,A;重置24.;;;此处填写1秒处理程序25. BS WKREG,T20MS26.;;;;;;;;;;;;;;27. DJZ R1S28.JMP INTEXT;29.MOV A,@5030.MOV R1S,A;31.;;;;;;;;;32.INC NUMBER33.MOV A,NUMBER34. SUB A,@1035. JBS SR,236.JMP INTEXT37.MOV A,@038.MOV NUMBER,A39.40.41. INTEXT:42.MOV A,TEMPA;43.RETI;;;;;;;;;;;;;;;;;;;;;44.45.46.47.48.49.;显示部分:50.51.;==============TXDATA==============52.TXDATA:53. BS P5,CC154.MOV A,@855.MOV DATALOP,A;56.TXLOP:57. BC WKREG,T500US58. BS P5,CLK;clk=高59.NOP;60.NOP61. JBS DATA_BUF,762.JMP $+363. BS P5,DATA;64.JMP $+265. BC P5,DATA66.DD1MS: JBS WKREG,T500US67.JMP $-168. BC P5,CLK69. BC WKREG,T500US70. JBS WKREG,T500US71.JMP $-1;72.RLC DATA_BUF73. DJZ DATALOP74.JMP TXLOP75.;;;;;;;;;;76. BC WKREG,T500US77. BS P5,CLK;clk=高78. BC WKREG,T500US79. JBS WKREG,T500US80.JMP $-1;81. BC P5,CLK82.;;;;;;;;83. BC P5,CC184.85.RET;;;;;;;86.87.;数据查表88.;===============DSPTBL============89.DSPTBL: ADD PC,A90. RETL @0B01000000;091. RETL @0B01111001;192. RETL @0B00100100;293. RETL @0B00110000;394. RETL @0B00011001;495. RETL @0B00010010;596. RETL @0B00000010;697. RETL @0B01111000;798. RETL @0B00000000;899. RETL @0B00010000;9100.101.102.;循环体部分;103.104.;;;;;;;;;;主程序;;;;;;;;;;;105.MLOOP:106.MOV A,NUMBER107.CALL DSPTBL108.MOV DATA_BUF,A109.CALL TXDATA110. BC WKREG,T1MS111. JBS WKREG,T1MS112.JMP $-1113.NOP;114.115.JMP MLOOP;;;;;;;;;;;;;;;;;;;;实例2在实际应用中驱动数码管常用的方式分动态扫描和静态驱动。
HC164应用实例:驱动数码管两例
4HC164应用实例:驱动数码管两例(电路图和源程序)文章编号:文章分类:电路>电子元件点击:...关键词:74HC164文章来源:百合电子工作室收集整理摘要:74HC164应用实例:驱动数码管的两个实例分别提供了汇编源程序和C源程序...实例174HC164是串行输入,并行输出接口器件,可用在单向的并行输出/并行地址锁存等. 74HC164因为价格便宜,容易使用特别适合使用在在需要用到数码管显示IO口又比较紧张的电子产品中,下面浅谈使用方法:1. 首先先了解他的引脚功能和逻辑图,如下图:图1 引脚名称和用途图2 真值表通过真值表我们可以了解到,A,B两个输入端是互锁的,CLK上升沿时数据移入移位寄存器中,CLEAR为清零用的,接低电平时所有端口都输出低电平,了解了真值表之后开始运用了,先给出如下原理图:图3 原理图图中,采用义隆的EM78P153作为控制芯片,P50作为CLK时钟信号,注意平时数据不传输时,时钟信号是不发送的应一直保持低电平或者高电平,数据需要传输的时候才输出时钟信号^_^ ,继续P51作为移位数据输出端,接到74HC164的B端,A端接高电平,当然也可以AB端短路,然后连接到DATA移位数据端,P52作为数码管的选通信号(也可以叫消隐^_^), 作用是使数据传输过程暂时关闭显示,以免显示出不需要的数据,原因是应为164不带锁存功能,数据传输过程是一位一位的向高位移位输出的,所以要等数据全部移入后才打开始点亮数码管.注意了哦,通过查看164的规格书发现,164输出高电平电流比输出低电平电流要小,亦称灌电流大,扇出电流弱,所以适合选用共阳数码管,如图,本人偷懒没有画出那个数码管的8字该介绍的介绍的差不多了,废话少说,该开始干活了,任务是: 显示0-9 每秒+1 ,到9后又返回0,一直循环显示,根据任务得到如下流程图:1. 显示部分:将需要显示的数值送入A ==>查表求得显示段码==>将段码逐位移入164==>8位移完后点亮数码管==>延时==>返回第一步执行2. 中断部分:进入中断==>保存现场(以备调查取证,送你入狱^_^)==>重置TCC==>够1秒钟将需要显示的数据+1,并重置,不够就退出;根据以上要求就开始写代码调试了,要注意一点,数据移位时一定要记得高位在前哦,否则显示错误别怪我没有说清楚,我当年实验时就因为这个数据移位方向反了排查了半天,甚至以为是时钟频率不对,又以为时许不对.....搞了半天,NND后来重看DATASHEET才发现,原来是低级错误啊,呜呼哀哉.......,希望你不要重蹈我覆辙,哎哟!! 谁! 谁! 谁扔砖头上来啥你扔的我废话太多.........,那俺少来两句,继续上菜, 咦好像没啥可说的了,上源程序吧1.;中断部分:2.3.;;;;;;;;;;中断;;;;;;;;4.INTPUT:5.MOV TEMPA, A;6.MOV A,@130;7.MOV TCC,A;255-130=1258.CLR RF;9.;;;;;此处填写250Us处理程序10.BS WKREG,T500US11.;;;;;;;;;;;;;;;;;;;;;;;;;12.DJZ R1MS13.JMP INTEXT;14.MOV A,@415.MOV R1MS,A;重置16.BS WKREG,T1MS17.;;;;;;;此处填写1ms处理程序18.19.;;;;;;;;;;;;;;;;;;;;;;;;;;20.DJZ R20MS21.JMP INTEXT;22.MOV A,@2023.MOV R20MS,A;重置24.;;;此处填写1秒处理程序25.BS WKREG,T20MS26.;;;;;;;;;;;;;;27.DJZ R1S28.JMP INTEXT;29.MOV A,@5030.MOV R1S,A;31.;;;;;;;;;32.INC NUMBER33.MOV A,NUMBER34.SUB A,@1035.JBS SR,236.JMP INTEXT37.MOV A,@038.MOV NUMBER,A39.40.41.INTEXT:42.MOV A,TEMPA;43.RETI;;;;;;;;;;;;;;;;;;;;;44.45.46.47.48.49.;显示部分:50.51.;==============TXDATA==============52.TXDATA:53.BS P5,CC154.MOV A,@855.MOV DATALOP,A;56.TXLOP:57.BC WKREG,T500US58.BS P5,CLK;clk=高59.NOP;60.NOP61.JBS DATA_BUF,762.JMP$+363.BS P5,DATA;64.JMP$+265.BC P5,DATA66.DD1MS: JBS WKREG,T500US67.JMP$-168.BC P5,CLK69.BC WKREG,T500US70.JBS WKREG,T500US71.JMP$-1;72.RLC DATA_BUF73.DJZ DATALOP74.JMP TXLOP75.;;;;;;;;;;76.BC WKREG,T500US77.BS P5,CLK;clk=高78.BC WKREG,T500US79.JBS WKREG,T500US80.JMP$-1;81.BC P5,CLK82.;;;;;;;;83.BC P5,CC184.85.RET;;;;;;;86.87.;数据查表88.;===============DSPTBL============89.DSPTBL: ADD PC,A90.RETL @0B01000000;091.RETL @0B01111001;192.RETL @0B00100100;293.RETL @0B00110000;394.RETL @0B00011001;495.RETL @0B00010010;596.RETL @0B00000010;697.RETL @0B01111000;798.RETL @0B00000000;899.RETL @0B00010000;9100.101.102.;循环体部分;103.104.;;;;;;;;;;主程序;;;;;;;;;;;105.MLOOP:106.MOV A,NUMBER107.CALL DSPTBL108.MOV DATA_BUF,A109.CALL TXDATA110.BC WKREG,T1MS111.JBS WKREG,T1MS112.JMP$-1113.NOP;114.115.JMP MLOOP;;;;;;;;;;;;;;;;;;;;实例2在实际应用中驱动数码管常用的方式分动态扫描和静态驱动。
(完整版)74LS164驱动数码管动态显示
74LS1641、器件功能作用8 位串入,并出移位寄存器2. 概述74HC164、74HCT164 是高速硅门 CMOS 器件,与低功耗肖特基型 TTL (LSTTL) 器件的引脚兼容。
74HC164、74HCT164 是 8 位边沿触发式移位寄存器,串行输入数据,然后并行输出。
数据通过两个输入端(DSA 或 DSB)之一串行输入;任一输入端可以用作高电平使能端,控制另一输入端的数据输入。
两个输入端或者连接在一起,或者把不用的输入端接高电平,一定不要悬空。
时钟 (CP) 每次由低变高时,数据右移一位,输入到 Q0, Q0 是两个数据输入端(DSA 和 DSB)的逻辑与,它将上升时钟沿之前保持一个建立时间的长度。
主复位 (MR) 输入端上的一个低电平将使其它所有输入端都无效,同时非同步地清除寄存器,强制所有的输出为低电平。
3. 特性•门控串行数据输入•异步中央复位•符合 JEDEC 标准 no. 7A•静电放电 (ESD) 保护:·HBM EIA/JESD22-A114-B 超过 2000 V·MM EIA/JESD22-A115-A 超过 200 V 。
•多种封装形式•额定从 -40 °C 至+85 °C 和 -40 °C 至+125 °C 。
4. 功能图图 1. 逻辑符号图 2. IEC 逻辑符号图 3. 逻辑图图 4. 功能图5. 引脚信息图 5. DIP14、SO14、SSOP14 和 TSSOP14 封装的引脚配置引脚说明符号引脚说明DSA 1 数据输入DSB 2 数据输入Q0~Q3 3~6 输出GND 7 地 (0 V)CP 8 时钟输入(低电平到高电平边沿触发)/M/R 9 中央复位输入(低电平有效)Q4~Q7 10~13 输出VCC 14 正电源罗亩的笔记6. 功能表(真值表)H = HIGH(高)电平h = 先于低-至-高时钟跃变一个建立时间 (set-up time) 的 HIGH(高)电平L = LOW(低)电平l = 先于低-至-高时钟跃变一个建立时间 (set-up time) 的 LOW(低)电平q = 小写字母代表先于低-至-高时钟跃变一个建立时间的参考输入(referenced input) 的状态↑ = 低-至-高时钟跃变7. 电器特性动态特性(TA=25℃)8. 推荐工作条件[1] 对于 DIP14 封装:Ptot 在超过70 °C 时以 12 mW/K 的速度线性降低。
74LS164驱动数码管动态显示
74LS1641、器件功能作用8 位串入,并出移位寄存器2. 概述74HC164、74HCT164 是高速硅门 CMOS 器件,与低功耗肖特基型 TTL (LSTTL) 器件的引脚兼容。
74HC164、74HCT164 是 8 位边沿触发式移位寄存器,串行输入数据,然后并行输出。
数据通过两个输入端(DSA 或 DSB)之一串行输入;任一输入端可以用作高电平使能端,控制另一输入端的数据输入。
两个输入端或者连接在一起,或者把不用的输入端接高电平,一定不要悬空。
时钟 (CP) 每次由低变高时,数据右移一位,输入到 Q0, Q0 是两个数据输入端(DSA 和 DSB)的逻辑与,它将上升时钟沿之前保持一个建立时间的长度。
主复位 (MR) 输入端上的一个低电平将使其它所有输入端都无效,同时非同步地清除寄存器,强制所有的输出为低电平。
3. 特性•门控串行数据输入•异步中央复位•符合 JEDEC 标准 no. 7A•静电放电 (ESD) 保护:·HBM EIA/JESD22-A114-B 超过 2000 V·MM EIA/JESD22-A115-A 超过 200 V 。
•多种封装形式•额定从 -40 °C 至+85 °C 和 -40 °C 至+125 °C 。
4. 功能图图 1. 逻辑符号图 2. IEC 逻辑符号图 3. 逻辑图图 4. 功能图5. 引脚信息图 5. DIP14、SO14、SSOP14 和 TSSOP14 封装的引脚配置引脚说明符号引脚说明DSA 1 数据输入DSB 2 数据输入Q0~Q3 3~6 输出GND 7 地 (0 V)CP 8 时钟输入(低电平到高电平边沿触发)/M/R 9 中央复位输入(低电平有效)Q4~Q7 10~13 输出VCC 14 正电源罗亩的笔记6. 功能表(真值表)H = HIGH(高)电平h = 先于低-至-高时钟跃变一个建立时间 (set-up time) 的 HIGH(高)电平L = LOW(低)电平l = 先于低-至-高时钟跃变一个建立时间 (set-up time) 的 LOW(低)电平q = 小写字母代表先于低-至-高时钟跃变一个建立时间的参考输入(referenced input) 的状态↑ = 低-至-高时钟跃变7. 电器特性动态特性(TA=25℃)8. 推荐工作条件[1] 对于 DIP14 封装:Ptot 在超过70 °C 时以 12 mW/K 的速度线性降低。
51单片机数码管显示实验报告
51单片机数码管显示实验报告实验目的:1.学习51单片机的编程方法和硬件连接方法;2.掌握使用51单片机驱动数码管显示的方法。
实验器材:1.51单片机开发板;2.公共阳极共阳向数码管一个;3.若干杜邦线。
实验原理:数码管是一种数字显示器件,由7个发光二极管和若干个选通器件构成。
每个发光二极管可以发出两种颜色的光,通常使用红色和绿色。
这篇实验报告以共阳数码管为例,共阳数码管的每个发光二极管的阳极都连接到电源VCC上,而七个阴极分别用来选择一些数字进行显示。
当要选择一些数码管显示时,需要对对应的阴极进行低电平使能,而使能其他阴极保持高电平,这样就可以通过控制每个数码管的阴极低电平使能来选择要显示的数字。
实验步骤:1.将51单片机开发板上的数码管连接到51单片机开发板的P1口和P0口上,连接方式如下图所示:```-----------------VCC-P0.0--,a,-----------------P0.1--,b,------P0.2--,c,---,数字2P0.3--,d,------P0.4--,e,------P0.5--,f,---,数字1P0.6--,g,------P0.7--,h,-----------------------P1.0P1.1```2. 在Keil µVision中新建工程,编写程序。
3.利用P0口控制数码管的阴极,利用P1口选择数码管要显示的数字。
4.在主程序中循环选择每个数码管,并通过P0口设置要显示的数字。
实验结果:```---------------------------------P1.0P1.1P0.6P0.7空空数字2数字1abcdefgh---------------------------------```实验结论:通过本次实验,学习了51单片机的编程方法和硬件连接方法,并掌握了使用51单片机驱动数码管显示的方法。
同时,还了解了数码管的工作原理和编程的基本步骤。
基于51单片机16x64点阵设计报告(附程序及效果图)
物理与电子信息工程学院电子设计竞赛设计方案制作项目:基于单片机的Led点阵设计团队成员:电子科学技术协会技术部第一章:实物图展示第二章:芯片简介2.1点阵简介:8x8点阵是由64个发光二极管排列成8行8列的矩阵,一个发光二极管控制着点阵的一个点。
这种显示比较逼真,能显示的字符比较多。
实际应用比较广泛,如点阵广告牌,交通灯报站台。
16*64点阵屏构成首先,我们来分析一下16*16点阵行控线,列控线。
级联方法:如图四个点阵。
● 把00,01相同的行线相连接。
● 把10,11相同的行线相连接。
● 把00,10相同的列线相连接。
● 把01,11相同的列线相连接。
● 最后,00,01的列就作为16x16点阵的列控线。
00,10的行就作为16x16点阵的行控线。
同理:16*64的点阵也是一样的,将同一行的所有行连在一起,同一列的所有列连在一起!(我们这次点阵用的是共阳型点阵,即行接阳极)00 8*8点阵 01 8*8点阵 10 8*8点阵11 8*8点阵这里的16*64设计我们使用的是proteus画图的,里面使用的是网络标号!2.2 AT89S52简介:AT89S52有P0,P1,P2,P3。
四个口,18,19号引脚提供外部时钟信号。
2.3 74HC595简介:74HC595是8位串行输入,8位串行或并行输出。
●Q A~Q H为并行输出。
可以将信号输送到LED,类似流水灯。
●Q’H为串行输出。
●10号角:移位寄存器清零端,低电平有效。
●11号引脚:移位寄存器时钟脉冲,高电平有效。
●12号引脚:存储寄存器时钟脉冲,高电平有效。
●13号引脚:控制输出的使能端,低电平有效。
●14号角传送串行信号,信号源可以来单片机。
●16,8号引脚分别接VCC,GND。
2.4 74HC 154简介:74HC154是一个类似于74LS138一样的译码器,它为4-16线译码,它为单片机的引脚扩展发挥了很大的作用。
●23,22,21,20号引脚:传送地位到高位的地址码。
51单片机驱动16位数码管C语言程序
说明:本程序配合电路为:使用STC89C52、2个74hc138和1个74hc164完成16位数码管的检测任务。
其中74HC164完成数码管段码的输出,2个74HC138完成16个数码管位码的选择。
/*********************************接线关系:P0.0---164(P1、P2) DATP0.1---164(P8) CLKP0.2---138a(P6)GP2.3---138b(P6)G特别说明:本程序位码表所对应74hc138(a、b、c)接线为:P2.2---138(P1) aP2.1---138(P2) bP2.0---138(P3) C*****************************************************/c语言程序如下:#include <reg52.h>#include <absacc.h>#include <intrins.h>#define uchar unsigned char#define uint unsigned int#define ON 0#define OFF 1sbit DAT_164=P0^0;sbit CLK_164=P0^1;sbit G_138a=P0^2;sbit G_138b=P2^3; //数码管显示开关uchar code seg[]={ //七段码表0x3f,0x06,0x5b,0x4f,0x66,0x6d, //0-5 00H-05H0x7d,0x07,0x7f,0x6f,0x77,0x7c, //6-b 06H-0BH0x39,0x5e,0x79,0x71,0x40,0x46, //c- -1 0CH-11H0x76,0x00,0x80,}; //H 全灭 . 12H-16Hunsigned char code wma3[]={0x00,0x04,0x02,0x06,0x01,0x05,0x03,0x07}; //此为位码表对应于138a-P2.2;138b-P2.1;138c-P2.0。
74LS164和74LS165工作原理及其单片机中的应用(基于Proteus仿真)
74LS164和74LS165工作原理及其在单片机中的应用基于Proteus仿真前言:本文详细介绍了74LS164和74LS165工作原理,并分别举例它们在单片机中的应用,所举例子包含proteus仿真电路图,源程序,程序注释详细清楚。
1、74LS164在单片机中应用举例本例在单片机串行口外接一片8位串入并出移位寄存器74LS164芯片,构成单片机输出接口电路,控制8只LED滚动显示。
(1)74LS164芯片如右图所示,它是8位串入并出移位寄存器,串行输入数据,然后并行输出。
各引脚功能如下:A、B(1、2引脚):数据输入端,数据通过这两个输入端之一串行输入;任一输入端可以用作高电平使能端,控制另一输入端的数据输入。
当其中任意一个为低电平,则禁止新数据输入;当其中有一个为高电平,则另一个就允许输入数据。
因此两个输入端或者连接在一起,或者把不用的输入端接高电平,一定不要悬空。
Q0~Q7(3~6,10~13引脚):数据输出端CP(8号引脚):时钟输入端。
CP每次由低变高时,数据右移一位,输入到Q0,Q0 是两个数据输入端的逻辑与,它将上升时钟沿之前保持一个建立时间的长度。
MR:复位清除端,当MR为低电平时,其它所有输入端都无效,同时所有输出端均为低电平。
GND(7号引脚,在proteus中已隐藏):接地端VCC(14号引脚,在proteus中已隐藏):电源端,接+5V电源74LS164 内部逻辑图(2)如下图所示,本例单片机串行口工作于方式0,即移位寄存器输入/输出模式。
串行数据通过RXD输出,TXD则用于输出移位时钟脉冲。
数据输入端1接高电平,数据输入端2接单片机RXD引脚。
时钟输入端接TXD引脚,复位端悬空。
数据输出端通过限流电阻接8只LED灯。
C程序如下:#include <reg51.h>#include <intrins.h>#define uint unsigned int#define uchar unsigned charvoid delay(uint x){uchar i;while(x--)for(i=0;i<120;i++);}void main(){uchar c=0x80;SCON=0x00; //串行口工作在方式0while(1){c=_crol_(c,1);SBUF=c;while(TI==0); //等待发送结束TI=0; //发送结束,TI置0delay(400);}}Proteus仿真运行结果如下:2、74LS165在单片机中的应用举例本例在单片机串行口外接一片8位并入串出移位寄存器74LS165,连接移位寄存器并行输入端的是8位拨码开关,其开关动作对应的8位二进制序列将通过移位寄存器串行输入到单片机串口,并通过单片机P0端口的8只LED显示出来。
基于51单片机的16-6显示屏
摘要单片机是为各类专用控制器而设计的通用或专用的微型计算机系统,高密度集成了普通计算机微处理系统,一定容量的RAM和ROM以及输入/输出接口,定时器等电路于一块芯片上构成的。
在现代工业控制和一些智能化仪器仪表中,越来越多的场所需要用点阵图形来显示汉字、数字,汉字显示屏也广泛应用到汽车报站器,广告屏等。
LED点阵显示屏作为一种新兴的显示器件,是由多个独立的LED发光二极管封装而成.。
LED点阵显示屏可以显示数字、文字或符号, 通常用来显示时间、速度、系统状态等。
用点阵方式构成图形或文字非常灵活,可以根据需要任意组成和变化,只要设计好合适的数据文件,就可以得到满意的显示效果,因而采用点阵式图文显示屏显示经常需要变化的信息是非常有效的。
本次课程设计实现LED点阵屏核心功能即汉字的多样化显示。
加深对单片机课程的全面认识和掌握,对单片机课程的应用进一步的了解。
将单片机软硬件结合起来对程序进行编辑,校验,锻炼实践能力和理论联系实际的能力。
关键词:AT89C51单片机LED点阵显示动态显示第一章功能要求及方案论证1.1、设计目的《单片机原理与应用》是一门实践性和应用性非常强的课程,学习的目的在于应用。
本课程设计主要了解 16*16 矩阵式点阵 LED 的工作原理,掌握单片机扩展 16*16 点阵 LED 显示汉字的编程方法。
它能起到巩固课堂和书本上所学知识,加强综合能力,提高系统设计水平,启发创新思想的效果。
1.2、功能要求本方案设计一个电子显示屏,具体要求满足以下条件:1.要求采用51单片机作为微控制器;2.通过四个8x8的点阵LED组成16x16点阵进行文字显示;3.在目测条件下LED显示屏各点亮度均匀、充足、稳定、清晰无串扰。
4.文字显示具有每排字有静止、左移。
右移等显示方式。
系统大致可以分成单片机系统及外围电路模块、列驱动电路模块、行驱动电路模块和显示模块四部分。
1.3、单片机最小系统方案单片机采用MSC-51或其兼容系列芯片,本设计采用ATC89C51单片机。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
P2=0xff; //数码"灭"
}
}
main()
{
separateData(123456);
while(1)
{
display();
}
}
DS_data[2]=dat/100%10;
DS_data[3]=d4]=dat/10000%10;
DS_data[5]=dat/100000%10;
}
void write_164(unsigned char dat)
{
unsigned char i;
for(i=0;i<8;i++)
sbit MOSI=P1^1;//符号DSA引脚1数据输入符号DSB引脚2数据输入
unsigned char code Tab[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,
0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71};//共阴数码管
基于51单片机的74HC164驱动六位数码管显示程序与仿真
#include<reg52.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
//74HC164
sbit CLK=P1^0;//符号CP引脚8时钟输入(低电平到高电平边沿触发)
void delay1ms()
{
unsigned char i,j;
for(i=0;i<10;i++)
for(j=0;j<33;j++)
;
}
void separateData(unsigned long dat)// dat为六位数
{
DS_data[0]=dat%10;
DS_data[1]=dat/10%10;
{
CLK=0;
if(dat&0x80) MOSI=1;
else MOSI=0;
CLK=1;
dat<<=1;
}
}
void display()
{
unsigned char i;
for(i=0;i<6;i++)
{
write_164(Tab[DS_data[i]]);
P2=0x3f&(~(0x01<<i)); //数码"位"共阴低电平选中seg1对应P2.5,seg6对应//P2.0;
unsigned char DS_data[6];
/*****************************************************
函数功能:数码管扫描延时子程序
函数功能:延时1ms
(3j+2)*i=(3×33+2)×10=1010(微秒),可以认为是1毫秒
***************************************************/