当前位置:文档之家› 基于51单片机的LED点阵屏显示设计外文文献翻译

基于51单片机的LED点阵屏显示设计外文文献翻译

基于51单片机的LED点阵屏显示设计外文文献翻译
基于51单片机的LED点阵屏显示设计外文文献翻译

51单片机在编程电路中的应用

本应用指南说明了Atmel AT89C51是可在线可编程的微控制器。它为电路编程提出了相应的例子,程序的修改需要在线编程的支持。这类显示方法在应用程序中的AT89C51单片机可通过电话线远程控制。该应用指南所描述的电路只支持5v电压下编程。此应用软件可以到Atmel进行下载。

总论

当不在进行程序设计的时候,在电路设计中的AT89C51设计将变得透明化。

在编程期间必须重视EA/VPP这一脚。在不使用外部程序存储器的应用程序中,这脚可能会永久接到VCC。应用程序使用的外部程序存储器要求这一脚为低电平才能正常运行。

RST在编程期间必须为高电平。应该提供一种方法使得电路通入电源以后,使RST代替主要的复位电路起到复位的作用。

在编程过程中,PSEN必须保持低电平,在正常运行期间绝不能使用。

ALE/ PROG在编程过程中输出低电平,在正常运行期间绝不能使用。

在编程过程中,AT89C51的I / O端口是用于模式应用程序,地址和数据选择的,可能需要该控制器从应用的电路隔离。如何做到这一点取决于应用程序。

输入端口

在编程过程中,控制器必须与应用电路的信号来源隔离。带有三个输出状态的缓冲区会在应用程序之间插入电路和控制器,同时在编程时缓冲区输出三种状态。一个多路复用器可用于信号源之间进行选择,适用于任何一方的应用电路或编程控制器电路的信号。

输出端口

如果应用的电路可以允许端口在编程过程中的状态变化,则不需要改变电路。如果应用电路的状态,必须事先在编程过程中的保持不变,可能在控制器和应用电路中插入锁存。锁存在编程期间是可用的,并保存应用程序的电路状态。

应用实例

应用是该AT89C51一个移动的显示情况。此应用程序有在电路重新编程时将结果以图表的形式显示的简单能力。文本显示被设计作为其硬件的一部分,不能在无

改编情况下变化。

显示的文本可在4位DIP开关选择两种模式之一中进行。在第一种模式的时候,进入一个字符从右边显示和快速移动,通过每个元素显示其在最后的装配位置的左侧。在第二个模式,信息在信息窗口中右到左移动显示。这种模式与常常在股票价格的显示器所使用的方法类似。

输出包括四个DL1414T,4位17段的积分解码器和驱动程序的字母数字显示器。这就产生了16名显示元素,每个数字有0-9的显示能力,是大写字母,标点符号和一些字符。可显示字符的ASCII 码,范围为20H-5FH。上电复位电路和一个6 MHz 的晶体振荡器完成应用软件程序。无论外部程序存储器或外部数据存储器都时可用的。

支持应用程序的修改

据推测,编程器在休眠时,既不会驱动,也不会加载应用程序。由于应用程序不使用外部程序存储器,EA/VPP脚接VCC电源。复位电路被两种转换器改变状态,此转换器允许编程时RST接高电平。在基本应用时未使用的PSEN和ALE/ PROG,是被程序员直接控制的。

编程器的编程需要获得所有数据表中记录的AT89C51的I / O端口。编程器是与那些应用程序未使用的控制器的引脚相连的,而这些应用程序的引脚需要最低有效位的四所产生的地址是可获得的,如下段所述。

由编程器生成的最小的四位地址是与DIP转换的数据在控制器的端口多路复

用的请注意,加在开关上的四个电阻在基本应用中并不是必须的,因为AT89C51的端口上提供一个内部上拉电阻。

在应用程序的正常运作时,控制器端口0,1个分别在显示器上提供数据和控制信号。在编程和程序验证时,编程受端口0和端口2的一部分控制。程序设计器连接端口0和1,没有缓冲,因为,在不活动时,它的存在不影响应用程序的正常运作。

透明锁存器被加在了控制器的两个端口之间做输入控制。锁存持有的显示控制信号在编程过程中不反应,从而消除端口0和2由于程序控制器的活动造成操作失误。显示数据输入是不能被孤立的,因为数据应用到输入被忽略时,控制信号无效。

AT89C51单片机复位电路,输入多路复用器和输出锁存器是由程序控制器生成

一个单一的信号来控制的。在编程过程中,复位键生效,多路开关信号输入,以及冻结显示锁存控制线。

为确保控制线显示在已知的状态前锁定,AT89C51的外部中断是用来允许程序控制器在复位之前向应用程序发出信号。应用程序固件响应中断显示一条消息,关闭显示控制线。

编程后,当复位生效,当锁存可视控制器端口输出高电平。由于显示控制输入不为高电平,直到新的程序写入显示器内部不被打乱。虽然这个应用程序是没有必要的,它可能在某些应用中必须指出,在编程过程中不会扰乱外围电路的状态

程序控制器

程序控制器生成的地址,数据和控制信号,对嵌入到程序中的AT89C51有重要作用。

程序控制器电路由一个AT89C51和一个RS - 232电平转换器组成。该控制器运行在11.0592兆HZ,此频率允许串口运行在一个标准波特率下。一个MAXIM MAX232线路驱动器/接收器产生RS - 232水平,而只需要5伏的电源系统。

程序控制器所产生的信号许多只需直接连接到AT89C51,无需缓冲。这些信号,在不活动时,不再是三种状态,但被接高电平。AT89C51的端口1,2,3内部有大约3000欧姆的上拉电阻,因为端口0没有内部上拉电阻,所以外部10千欧姆的上拉电阻已经加上允许适当的程序认证模式操作。示例应用程序在这种环境下可正常运行。如果有需要的应用程序兼容性,程序发出的信号可能在类似74xx125三态缓冲缓冲区内缓冲。

AT89C51的程序不使用外部程序或数据存储器,这需要牺牲所需要的I / O引脚。这就要求程序代码和I / O缓冲区保持足够小以适合片上存储器。

商业电话线远程编程

编程器和前面描述的显示应用是与通过调制解调器连接在远程站点电话线相

连的。使用链接调制解调器的个人电脑,用户可以上传包含一个新的消息的程序,这个信息被变成进了嵌入到应用程序的AT89C51中。当编程完成后,应用程序执行新的程序,它显示新信息。

本地配置

测试配置的本地配置包括一台IBM个人电脑级的计算机连接到与Hayes兼容

的,普罗米修斯1200波特的调制解调器。选择此调制解调器,因为它是廉价可得。更快的调制解调器如果需要的话可使用更快速的调制解调器,尽管一旦该文件的传输时间低于1分钟,进一步削减的传输时间不会进一步降低连接时间费用。更高的传输速度的可能优势是在某些高速调制解调器内的自动错误检测和纠正。

Procomm Plus版本2.01,是一个商业数据通信软件包,用于配置调制解调器,建立通讯设置参数,并建立与远程调制解调器的链接。Procomm Plus包括所谓的宏语言方面,它允许用户编写实现自定义的文件传输协议的脚本。一个简单的脚本编写用来读取一个程序文件的内容,并上传到远程编程器。

文件传输协议(FTP)的实施,是一个简单的发送和等待的,数据包导向的协议。FTP模式发送和接收的是用数字4和5,如流程图所示。不在流程控制下发射器发送每个数据包,并等待响应。

在计算校验和时那个程序控制器(接收器)读取并剖析了数据包。如果计算出的校验和是有效的,程序员通过发送一个ACK承认此数据包。如果校验和错误,程序员通过发送一个NAK来否定。当接收一个ACK后,发射器发送下一个数据包。如果传送者接收到NAK,它重新发送相同的数据包。以这种方式传输,直到整个文件已被移交。

程序控制器可能通过发送一个CAN来响应数据包,CAN表明一个不可恢复的错误发生,而发射机应立即中止文件传输。如果程序员没有在有限的时间内响应到一个数据包,发送器将重新发送相同的数据包。

发射器将继续重发,直到接收到一个有效的反应,或者,超出文件传输被中止的时间。每个数据包接收和通过程序员验证后,数据包中包含的数据被加载到的AT89C51单片机控制器编程。

编程后,数据从控制器读回并对接收的数据包进行验证。成功的审查表明,成功的程序设计,使程序员发送ACK给传送者。如果编程失败,程序员发送CAN向传送者发送信号中止文件传输。

简单的FTP减少了AT89C51的程序在编程时使用的内存量。由于AT89C51的编程和擦除时间可以很容易地吸收,FTP发送和等待的性质允许跨包延迟。对程序验证的支持是透明的,不需要明确的命令或结果代码,或转让的其他数据。

上传到程序控制器的文件是用英特尔MCS- 51软件开发包来创建的。在包中包

括了MCS - 51宏汇编,MCS - 51单片机Relocator和连接器,以及一个有用的工具,OH。OH将8051绝对目标文件转换为为等效的ASCII十六进制目标文件。

远程配置

在测试配置中的远程配置包括显示应用程序和程序员电路,如前所述,连接到一个与Hayes兼容的普罗米修斯1200波特调制解调器。在正常操作时,应用程序执行其内部程序,而调制解调器和程序员监测来电电话线。

通话被检测到并连接建立后,程序器强迫暂停其程序的执行。新的程序就被下载并嵌入到应用程序中的AT89C51的编程。当编程完成后,应用软件程序获准开始其新的程序执行,而程序控制器返回监督下一个通话的电话线。

程序控制输出无效时程序控制器上电,允许应用程序正常运行。在配置调制解调器接听来电后,程序控制器停止工作。是程序控制器不会影响到程序直到一个新的程序应用程序被下载。

程序员通过发送控制在串行接口上的ASCII命令字符串来控制调制解调器,对此调制解调器响应海斯式调制解调器的ASCII数字代码。该软件是专为与海斯兼容使用的调制解调器,其中包括这里使用的1200普罗米修斯ProModem。

串行接口,程序员通过它连接到调制解调器,它支持两个握手信号,DTR和DSR。上电时,程序控制器判定DTR,断定为DTR后调制解调器响应。如果调制解调器不响应任何命令,包括命令挂断,程序控制器抬高DTR点位,强制调制解调器下降。

当程序控制器停止工作后,监测调制解监听电话线,等待来电呼叫。当检测到输入,调制解调器响应并试图与输入建立通信。如果建立了连接,调制解调器发送一个代码,唤醒程序控制器。程序控制器验证连接的代码,并开始审查有效的数据包报头。

传入数据包必须在少于30秒内到达,否则调制解调器挂断和程序控制器继续停止工作,等待下一次呼叫。如果来电挂断,在得到下一次呼叫之前,三十秒时间必须终止。在复位延迟时间传入是被忽略的。

如果复位延迟时间结束之前收到一个有效的数据包报头,程序控制器将尝试读取和验证传入的数据包。在数据包的接收过程中的任何时间,无效字符,奇偶校验错误或超时的时间内接待字符将导致部分数据包被宣布无效,并丢弃。

两个数据包类型定义:数据和最终文件。数据包包含五个领域,除了包报头,

是一个可变长度的数据字段。数据字段包含程序的数据在应用程序中被写入在

AT89C51的控制器。负载地址字段中包含数据写入的地址。末端文件包中包含与数据包相同的领域的文件,但该数据字段是空的。这包类型对程序控制器具有特殊的意义,如下所述。

任何包含有效文种的数据包,记录长度或校验和无效。程序数据在一个无效的数据包被丢弃的处理过程中被积累。编程器给传送者发送一个NAK作为信号数据包的接收和恢复为一个有效的数据包报头审查的警示信号。

第一个有效数据的接收引起编程器中断应用程序控制器。该控制器的中断响应放弃其正在运行的程序,并显示一条消息,表明程序已经被替代。如果这是由于接收了末端文件或者是电源触发从而接收的第一个有效的数据包,运用必要的控制信号清除在应用控制器内的记忆程序。然后编程器在程序模式中放置控制器。

当接收到第一个和其后的有效数据程序包时,将它们分开,它们包含的数据被编程到程序包负载地址域中的地址中的应用控制器内。编程后,从控制器内将数据读回并与接收到的数据包中的数据进行比较。成功的核查表明,方案是成功的,导致编程器向传送者发送ACK信号。由于30秒的复位延迟,编程器重新对有效的数据包报头进行测试。

如果编程失败,编程器向传送者发送信号CAN中止文件传输。调制解调器掉线,程序器继续休眠等待下一次呼叫。应用控制在程序模式中被保留,用以阻止它包含的不完整的或无效的程序。

重要的是要注意,无效的数据包永远不会规划到应用程序控制器。这样做将要求错误被纠正之前,编程器中的记忆程序被彻底抹掉,造成先前所有数据的不可恢复。

根据末端文件的接收,编程器向闲置的状态电源返回其控制输出,允许应用程序控制器,开始执行新的程序。然后编程器在三十秒延迟之下重新开始对一个数据包报进行审查。

如果一个有效的数据包在30秒延迟之前接收,另一个只能被接受一个有效的末端文件而终止的程序循环开始执行。

如果复位在收有效末端文件之前终止,那么调制解调器会掉线,编程器停止工作,等待下一次传入。在这种情况下应用控制器被保留在程序设计模式,以防止它

执行这个程序。要返回应用程序的正常运行,另一个传入必须被接收,一个有效的程序文件被上传,由末端文件包终止。

译文题目: 51单片机在编程电路中的应用

原稿题目:AT89C51 In-Circuit Programming

原稿出处:https://www.doczj.com/doc/da3823764.html,/dyn/resources/prod_documents/doc0287.pdf

AT89C51单片机外文翻译

AT89C51外文翻译 Description The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash Programmable and Erasable Read Only Memory (PEROM). The device is manufactured using Atmel’s high density nonvolatile memory technology and is compatible with the industry standard MCS-51? instruction-set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer which provides a highly flexible and cost effective solution to many embedded control applications. Features ? Compatible with MCS-51? Products ? 4K Bytes of In-System Reprogrammable Flash Memory – Endurance: 1,000 Write/Erase Cycles ? Fully Static Operation: 0 Hz to 24 MHz ? Three-Level Program Memory Lock ? 128 x 8-Bit Internal RAM ? 32 Programmable I/O Lines ? Two 16-Bit Timer/Counters ? Six Interrupt Sources ? Programmable Serial Channel ? Low Power Idle and Power Down Modes The AT89C51 provides the following standard features: 4K bytes of Flash,128 bytes of RAM, 32 I/O lines, two 16-bit timer/counters, a five vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator and clock circuitry. In addition, the AT89C51 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The Power-down Mode saves the RAM contents but freezes the oscillator disabling all other chip functions until the next hardware reset.

51单片机实例程100讲全集

目录 目录 (1) 函数的使用和熟悉 (4) 实例3:用单片机控制第一个灯亮 (4) 实例4:用单片机控制一个灯闪烁:认识单片机的工作频率 (4) 实例5:将P1口状态分别送入P0、P2、P3口:认识I/O口的引脚功能 (5) 实例6:使用P3口流水点亮8位LED (5) 实例7:通过对P3口地址的操作流水点亮8位LED (6) 实例8:用不同数据类型控制灯闪烁时间 (7) 实例9:用P0口、P1 口分别显示加法和减法运算结果 (8) 实例10:用P0、P1口显示乘法运算结果 (9) 实例11:用P1、P0口显示除法运算结果 (9) 实例12:用自增运算控制P0口8位LED流水花样 (10) 实例13:用P0口显示逻辑"与"运算结果 (10) 实例14:用P0口显示条件运算结果 (11) 实例15:用P0口显示按位"异或"运算结果 (11) 实例16:用P0显示左移运算结果 (11) 实例17:"万能逻辑电路"实验 (11) 实例18:用右移运算流水点亮P1口8位LED (12) 实例19:用if语句控制P0口8位LED的流水方向 (13) 实例20:用swtich语句的控制P0口8位LED的点亮状态 (13) 实例21:用for语句控制蜂鸣器鸣笛次数 (14) 实例22:用while语句控制LED (15) 实例23:用do-while语句控制P0口8位LED流水点亮 (16) 实例24:用字符型数组控制P0口8位LED流水点亮 (17) 实例25:用P0口显示字符串常量 (18) 实例26:用P0 口显示指针运算结果 (19) 实例27:用指针数组控制P0口8位LED流水点亮 (19) 实例28:用数组的指针控制P0 口8 位LED流水点亮 (20) 实例29:用P0 、P1口显示整型函数返回值 (21) 实例30:用有参函数控制P0口8位LED流水速度 (22) 实例31:用数组作函数参数控制流水花样 (22) 实例32:用指针作函数参数控制P0口8位LED流水点亮 (23) 实例33:用函数型指针控制P1口灯花样 (25) 实例34:用指针数组作为函数的参数显示多个字符串 (26) 实例35:字符函数ctype.h应用举例 (27) 实例36:内部函数intrins.h应用举例 (27) 实例37:标准函数stdlib.h应用举例 (28) 实例38:字符串函数string.h应用举例 (29) 实例39:宏定义应用举例2 (29) 实例40:宏定义应用举例2 (29) 实例41:宏定义应用举例3 (30)

步进电机及单片机英文文献及翻译

外文文献: Knowledge of the stepper motor What is a stepper motor: Stepper motor is a kind of electrical pulses into angular displacement of the implementing agency. Popular little lesson: When the driver receives a step pulse signal, it will drive a stepper motor to set the direction of rotation at a fixed angle (and the step angle). You can control the number of pulses to control the angular displacement, so as to achieve accurate positioning purposes; the same time you can control the pulse frequency to control the motor rotation speed and acceleration, to achieve speed control purposes. What kinds of stepper motor sub-: In three stepper motors: permanent magnet (PM), reactive (VR) and hybrid (HB) permanent magnet stepper usually two-phase, torque, and smaller, step angle of 7.5 degrees or the general 15 degrees; reaction step is generally three-phase, can achieve high torque output, step angle of 1.5 degrees is generally, but the noise and vibration are large. 80 countries in Europe and America have been eliminated; hybrid stepper is a mix of permanent magnet and reactive advantages. It consists of two phases and the five-phase: two-phase step angle of 1.8 degrees while the general five-phase step angle of 0.72 degrees generally. The most widely used Stepper Motor. What is to keep the torque (HOLDING TORQUE) How much precision stepper motor? Whether the cumulative: The general accuracy of the stepper motor step angle of 3-5%, and not cumulative.

单片机_英文参考文献

Structure and function of the MCS-51 series Structure and function of the MCS-51 series one-chip computer MCS-51 is a name of a piece of one-chip computer series which Intel Company produces. This company introduced 8 top-grade one-chip computers of MCS-51 series in 1980 after introducing 8 one-chip computers of MCS-48 series in 1976. It belong to a lot of kinds this line of one-chip computer the chips have,such as 8051, 8031, 8751, 80C51BH, 80C31BH,etc., their basic composition, basic performance and instruction system are all the same. 8051 daily representatives- 51 serial one-chip computers . An one-chip computer system is made up of several following parts: ( 1) One microprocessor of 8 (CPU). ( 2) At slice data memory RAM (128B/256B),it use not depositting not can reading /data that write, such as result not middle of operation, final result and data wanted to show, etc. ( 3) Procedure memory ROM/EPROM (4KB/8KB ), is used to preserve the procedure , some initial data and form in slice. But does not take ROM/EPROM within some one-chip computers, such as 8031 , 8032, 80C ,etc.. ( 4) Four 8 run side by side I/O interface P0 four P3, each mouth can use as introduction , may use as exporting too. ( 5) Two timer / counter, each timer / counter may set up and count in the way, used to count to the external incident, can set up into a timing way too, and can according to count or result of timing realize the control of the computer. ( 6) Five cut off cutting off the control system of the source . ( 7) One all duplexing serial I/O mouth of UART (universal asynchronous receiver/transmitter (UART) ), is it realize one-chip computer or one-chip computer and serial communication of computer to use for. ( 8) Stretch oscillator and clock produce circuit, quartz crystal finely tune electric capacity need outer. Allow oscillation frequency as 12 megahertas now at most. Every the above-mentioned part was joined through the inside data bus .Among them, CPU is a core of the one-chip computer, it is the control of the computer and command centre, made up of such parts as arithmetic unit and controller , etc.. The arithmetic unit can carry on 8 persons of arithmetic operation and unit ALU of logic operation while including one, the 1 storing device temporarilies of 8, storing device 2 temporarily, 8's accumulation

51单片机汇编程序范例

16位二进制数转换成BCD码的的快速算法-51单片机2010-02-18 00:43在做而论道上篇博文中,回答了一个16位二进制数转换成BCD码的问题,给出了一个网上广泛流传的经典转换程序。 程序可见: http: 32.html中的HEX2BCD子程序。 .说它经典,不仅是因为它已经流传已久,重要的是它的编程思路十分清晰,十分易于延伸推广。做而论道曾经利用它的思路,很容易的编写出了48位二进制数变换成16位BCD码的程序。 但是这个程序有个明显的缺点,就是执行时间太长,转换16位二进制数,就必须循环16遍,转换48位二进制数,就必须循环48遍。 上述的HEX2BCD子程序,虽然长度仅仅为26字节,执行时间却要用331个机器周期。.单片机系统多半是用于各种类型的控制场合,很多时候都是需要“争分夺秒”的,在低功耗系统设计中,也必须考虑因为运算时间长而增加系统耗电量的问题。 为了提高整机运行的速度,在多年前,做而论道就另外编写了一个转换程序,程序的长度为81字节,执行时间是81个机器周期,(这两个数字怎么这么巧!)执行时间仅仅是经典程序的!.近来,在网上发现了一个链接: ,也对这个经典转换程序进行了改进,话是说了不少,只是没有实质性的东西。这篇文章提到的程序,一直也没有找到,也难辩真假。 这篇文章好像是选自某个著名杂志,但是在术语的使用上,有着明显的漏洞,不像是专业人员的手笔。比如说文中提到的:

“使用51条指令代码,但执行这段程序却要耗费312个指令周期”,就是败笔。51条指令代码,真不知道说的是什么,指令周期是因各种机型和指令而异的,也不能表示确切的时间。 .下面说说做而论道的编程思路。;----------------------------------------------------------------------- ;已知16位二进制整数n以b15~b0表示,取值范围为0~65535。 ;那么可以写成: ; n = [b15 ~ b0] ;把16位数分解成高8位、低8位来写,也是常见的形式: ; n = [b15~b8] * 256 + [b7~b0] ;那么,写成下列形式,也就可以理解了: ; n = [b15~b12] * 4096 + [b11~b0] ;式中高4位[b15~b12]取值范围为0~15,代表了4096的个数; ;上式可以变形为: ; n = [b15~b12] * 4000 + {[b15~b12] * (100 - 4) + [b11~b0]} ;用x代表[b15~b12],有: ; n =x * 4000 + {x * (100 - 4) + [b11~b0]} ;即: ; n =4*x (千位) + x (百位) + [b11~b0] - 4*x ;写到这里,就可以看出一点BCD码变换的意思来了。 ;;上式中后面的位:

51单片机外文文献

The Introduction of AT89C51 Description The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications. Function characteristic The AT89C51 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM, 32 I/O lines, two 16-bit timer/counters, one 5 vector two-level interrupt architecture, a full duplex serial port, one-chip oscillator and clock circuitry. In addition, the AT89C51 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The Power-down Mode saves the RAM contents but freezes the oscillator disabling all other chip functions until the next hardware reset. Pin Description VCC:Supply voltage. GND:Ground.

51单片机实用汇编程序库(word)

51 单片机实用程序库 4.1 流水灯 程序介绍:利用P1 口通过一定延时轮流产生低电平 输出,以达到发光二极管轮流亮的效果。实际应用中例如:广告灯箱彩灯、霓虹灯闪烁。 程序实例(LAMP.ASM) ORG 0000H AJMP MAIN ORG 0030H MAIN: 9 MOV A,#00H MOV P1,A ;灭所有的灯 MOV A,#11111110B MAIN1: MOV P1,A ;开最左边的灯 ACALL DELAY ;延时 RL A ;将开的灯向右边移 AJMP MAIN ;循环 DELAY: MOV 30H,#0FFH D1: MOV 31H,#0FFH D2: DJNZ 31H,D2 DJNZ 30H,D1 RET END 4.2 方波输出 程序介绍:P1.0 口输出高电平,延时后再输出低电 平,循环输出产生方波。实际应用中例如:波形发生器。 程序实例(FAN.ASM): ORG 0000H MAIN: ;直接利用P1.0 口产生高低电平地形成方波////////////// ACALL DELAY SETB P1.0 ACALL DELAY 10 CLR P1.0 AJMP MAIN ;////////////////////////////////////////////////// DELAY: MOV R1,#0FFH DJNZ R1,$ RET

五、定时器功能实例 5.1 定时1 秒报警 程序介绍:定时器1 每隔1 秒钟将p1.o 的输出状态改变1 次,以达到定时报警的目的。实际应用例如:定时报警器。程序实例(DIN1.ASM): ORG 0000H AJMP MAIN ORG 000BH AJMP DIN0 ;定时器0 入口 MAIN: TFLA G EQU 34H ;时间秒标志,判是否到50 个 0.2 秒,即50*0.2=1 秒 MOV TMOD,#00000001B;定时器0 工作于方式 1 MOV TL0,#0AFH MOV TH0,#3CH ;设定时时间为0.05 秒,定时 20 次则一秒 11 SETB EA ;开总中断 SETB ET0 ;开定时器0 中断允许 SETB TR0 ;开定时0 运行 SETB P1.0 LOOP: AJMP LOOP DIN0: ;是否到一秒//////////////////////////////////////// INCC: INC TFLAG MOV A,TFLAG CJNE A,#20,RE MOV TFLAG,#00H CPL P1.0 ;////////////////////////////////////////////////// RE: MOV TL0,#0AFH MOV TH0,#3CH ;设定时时间为0.05 秒,定时 20 次则一秒 RETI END 5.2 频率输出公式 介绍:f=1/t s51 使用12M 晶振,一个周期是1 微秒使用定时器1 工作于方式0,最大值为65535,以产生200HZ 的频率为例: 200=1/t:推出t=0.005 秒,即5000 微秒,即一个高电

单片机外文翻译--STC89C52处理芯片

外文资料翻译 STC89C52 processi ng chip Prime features: With MCS - 51 SCM product compatibility, 8K bytes in the system programmable Flash memory, 1000 times CaXie cycle, the static operation: 0Hz ~ 33Hz, triple encryption program memory, 32 programmed I/O port, three 16 timer/counter, the eight uninterrupted dual-career UART serial passage, low power consumption, leisure and fall after fall electric power mode can be awakened and continuous watchdog timer and double-number poin ter, power ide ntifier. Efficacy: characteristics STC89C52 is one kind of low power consumption, high CMOS8 bit micro-co ntroller, 8K in system programmable Flash memory. Use high-de nsity nonv olatile storage tech no logy, and in dustrial 80C51 product in structi on and pin fully compatible. The Flash memory chips allows programs in the system, also suitable for programmable conventional programming. In a single chip, have clever 8 bits CPU and on li ne system programmable Flash, in crease STC89C52 for many embedded control system to provide high vigorous application and useful solutions. STC89C52 has following standard efficacy: 8k byte Flash RAM, 256 bytes, 32 I/O port, the watchdog timer, two, three pointer numerical 16 timer/counter, a 6 vector level 2 continuous structure, the serial port, working within crystals and horological circuit. In addition, 0Hz AT89S52 can drop to the static logic operation, support two software can choose power saving mode. Idle mode, the CPU to stop working, and allows the RAM, timer/c oun ters, serial, continu ous to work. Protectio n asa na patter n, RAM content is survival, vibrators frozen, SCM, until all the work under a continuous or hardware reset. 8-bit microcontrollers 8K bytes in the system programmable Flash AT89S52 devices. Mouth: P0 P0 mouth is a two-way ope n drain I/O. As export, each can drive eight TTL logic level. For P0 port to write "1", foot as the high impeda nee in put. When access to exter nal programs and nu merical memory, also known as

51单片机实例(含详细代码说明)

1.闪烁灯 1.实验任务 如图4.1.1所示:在P1.0端口上接一个发光二极管L1,使L1在不停地一亮一灭,一亮一灭的时间间隔为0.2秒。 2.电路原理图 图4.1.1 3.系统板上硬件连线 把“单片机系统”区域中的P1.0端口用导线连接到“八路发光二极管指示模块”区域中的L1端口上。 4.程序设计内容 (1).延时程序的设计方法 作为单片机的指令的执行的时间是很短,数量大微秒级,因此,我们要 求的闪烁时间间隔为0.2秒,相对于微秒来说,相差太大,所以我们在 执行某一指令时,插入延时程序,来达到我们的要求,但这样的延时程 序是如何设计呢?下面具体介绍其原理:

如图4.1.1所示的石英晶体为12MHz,因此,1个机器周期为1微秒机器周期微秒 MOV R6,#20 2个 2 D1: MOV R7,#248 2个 2 2+2×248=498 20× DJNZ R7,$ 2个2×248 (498 DJNZ R6,D1 2个2×20=40 10002 因此,上面的延时程序时间为10.002ms。 由以上可知,当R6=10、R7=248时,延时5ms,R6=20、R7=248时, 延时10ms,以此为基本的计时单位。如本实验要求0.2秒=200ms, 10ms×R5=200ms,则R5=20,延时子程序如下: DELAY: MOV R5,#20 D1: MOV R6,#20 D2: MOV R7,#248 DJNZ R7,$ DJNZ R6,D2 DJNZ R5,D1 RET (2).输出控制 如图1所示,当P1.0端口输出高电平,即P1.0=1时,根据发光二极管 的单向导电性可知,这时发光二极管L1熄灭;当P1.0端口输出低电平, 即P1.0=0时,发光二极管L1亮;我们可以使用SETB P1.0指令使P1.0 端口输出高电平,使用CLR P1.0指令使P1.0端口输出低电平。 5.程序框图 如图4.1.2所示

51单片机中的汇编语言与C语言.

51单片机中的汇编语言与 C 语言 C 语言, 更多的是为了掌握单片机的应用, C 语言是高效的应用程序开发工具, 与汇编语言比却不是开发高效应用程序的工具。就目前而言, 更多的是为了应用单片机, 开发应用程序, 更多的是强调开发效率, 而不是程序的运行效率 (相对而言。再就是应用程序对单片机内部资源的使用效率, 这在过去, 单片机内部资源紧缺的年代, 特别的强调, 现在已经不是特别重要了。所以, 大多数人都认为,只用 C 语言,就可以应对大多数单片机的应用开发了。 其实,汇编语言跟 C 语言在本质上一样的,只是语言形式不同而已,一个接近底层逻辑, 一个接近人类语言, 本质上都是对寄存器或存储器的读写操作而已。 汇编语言中,用 MOV 来回传送数据, C 语言里,用等号表示数据传送。汇编语言中,用 call 转去执行子过程程序, C 语言里,用个函数名调用子程序。汇编语言中,用 JMP 完成分支转移, C 语言里用 if 、 switch 、 while 、 for 来判断跳转。汇编语言跟 C 一样可以给寄存器指定命名,然后对定义的名称进行操作。汇编语言提供了对很多标志位的操作, C51根据需要也进行了改进, C 语言可以通过 #include给存储器命名来简化操作。 我觉得, C 语言是最接近汇编语言的一种高级语言, 要说不同, 也许具有大量函数的函数库,是 C 语言与汇编语言的最大区别,也是 C 语言比汇编语言有更大开发效率的原因。 在应用汇编语言进行应用程序开发时, 如果精心规划好程序结构, 设计好各种数据结构、子程序、中断程序,积累大量的算法程序(相当于函数库,也可以高效率的用汇编语言进行单片机开发。倒是兼容性、可移植性是汇编语言的最大限制,因为不同单片机有不同的指令系统,而 C 语言把这个问题,交给了机器也就是编译器去解决了。其实, 计算机的发展, 就是把尽可能多的事情交个机器去解决。

外文翻译---51系列单片机的结构和功能

外文翻译---51系列单片机的结构和功能

外文资料翻译 英文原文: Structure and function of the MCS-51 series Structure and function of the MCS-51 series one-chip computer MCS-51 is a name of a piece of one-chip computer series which Intel Company produces. This company introduced 8 top-grade one-chip computers of MCS-51 series in 1980 after introducing 8 one-chip computers of MCS-48 series in 1976. It belong to a lot of kinds this line of one-chip computer the chips have such as 8051, 8031, 8751, 80C51BH, 80C31BH,etc., their basic composition, basic performance and instruction system are all the same. 8051 daily representatives- 51 serial one-chip computers . An one-chip computer system is made up of several following parts: (1) One microprocessor of 8 (CPU). (2) At slice data memory RAM (128B/256B),it use not depositing not can reading /data that write, such as result not middle of operation, final result and data wanted to show, etc. (3) Procedure memory ROM/EPROM (4KB/8KB ), is used to preserve the procedure , some initial data and form in slice. But does not take ROM/EPROM within some one-chip computers, such as 8031 , 8032, 80C ,etc.. (4) Four 8 run side by side I/O interface P0 four P3, each mouth can use as introduction, may use as exporting too. (5) Two timer / counter, each timer / counter may set up and count in the way, used to count to the external incident, can set up into a timing way too, and can according to count or result of timing realize the control of the computer. (6) Five cut off cutting off the control (universal asynchronous receiver/transmitter (UART) ), is it realize one-chip computer or one-chip computer and serial communication of computer to use for. (8) Stretch oscillator and clock produce circuit, quartz crystal finely tune electric capacity need outer. Allow oscillation frequency as 12 megahertz now at most. Every the above-mentioned part was joined through the inside data bus .Among them, CPU is a core of the one-chip computer, it is the control of the computer and command center, made up of such parts as arithmetic unit and controller , etc.. The arithmetic unit can carry on 8 persons of arithmetic operation and unit ALU of logic operation while including one, the 1 storing devices temporarily of 8, storing device 2 temporarily, 8's accumulation device ACC, register B and procedure state register PSW, etc. Person who accumulate ACC count by 2 input ends entered of checking etc. temporarily as one operation often, come from person who store 1 operation is it is it make operation to go on to count temporarily , operation result and loop back ACC with another one. In addition, ACC is often regarded as the transfer station of data transmission on 8051 inside. The same as general microprocessor, it is the busiest register. Help remembering that agreeing with a expresses in the order. The controller includes the procedure counter, the order is deposited, the

基于51单片机的英文论文

the Real-Time Clock Based on AT89S51 Author: Class: ; Name: Abstract: Digital clock has become indispensable in people's daily life, it is widely used in public places such as the family and the office, and it gives people great convenience in study, work and entertainment. Due to the development of digital integrated circuit technology and the advanced quartz technology, the digital clock has advantages of accurate, stable performance and easy to carry. It is also used in automatic control, automatic signal and etc. Although the digital clocks are already sold on the market, but the single chip microcomputer timer function also can complete the design of the digital clock circuit. So it is necessary to the design of the digital clock. By single chip microcomputer internal timer timing precision, the four digital tube display year, month, day, time, minutes and seconds. With the keyboard, users can be preset time, display the time, set the content, set time operation mode, etc. Keywords: AT89S51; clock; digital tube; keyboard switch; function Introduction: AT89S51 is a very suitable for the beginners of the single chip microcomputer, it is fully compatible with the traditional instruction system of 8051,8031. Can realize the following functions: 1. Use the keyboard switch, show respectively the seconds, minutes, hour, day, month, year; 2. Use the keyboard preset year, month, day, time, minutes and seconds; 3. Can the countdown, the countdown units for minutes; 4. Every second , the four decimal point shine once; 5. Timing alarm clock function, a buzzer call reminder. 6. The clock error daily is not more than 1 second. Methods: 1.The minimum single chip microcomputer system AT89S51 has the following standard functions: 8 k bytes Flash, 256 bytes RAM, and 32-bit I/O lines, a watchdog timer, two data pointer, three 16 timer/counter, a level 6 vector 2 interrupt structure, full duplex serial port, piece of crystals and the clock circuit . In idle mode, the CPU stops working, allows RAM, timer/counter, serial port and interrupt continue to work. In fall protection mode, RAM content are stored, has been frozen, single chip microcomputer stops all work, until the next interruption or hardware reset.

相关主题
文本预览
相关文档 最新文档