搜档网
当前位置:搜档网 › 基于51单片机的电子数字钟设计的外文翻译

基于51单片机的电子数字钟设计的外文翻译

基于51单片机的电子数字钟设计的外文翻译
基于51单片机的电子数字钟设计的外文翻译

基于51单片机的电子数字钟设计的外文翻译

AT89C51 Family Users Guide

1 Features

Compatible with MCS-51 Products

4K Bytes of In-System Reprogrammable Flash Memory

– Endurance 1000 WriteErase Cycles

Fully Static Operation 0 Hz to 24 MHz

Three-level Program Memory Lock

128 x 8-bit Internal RAM

32 Programmable IO Lines

Two 16-bit TimerCounters

Six Interrupt Sources

Programmable Serial Channel

Low-power Idle and Power-down Modes

2 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 Atmels high-density nonvolatile memory technology and is compatible with the industry-standard MCS-51

instruction set and pin-out 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

3 Pin Configurations

4 Lock Diagram

The AT89C51 provides the following standard features 4K bytes of Flash 128 bytes of RAM 32 IO lines two 16-bit timercounters 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 timercounters 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

5 Pin Description

VCC Supply voltage

GND Ground

Port 0

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be used as high-impedance inputs

Port 0 may also be configured to be the multiplexed low-order addressdata bus during accesses to external program and data memory In this mode P0 has internal pull-ups

Port 0 also receives the code bytes during Flash programming and

outputs the code bytes during program verification External pull-ups are required during program verification

Port 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1 output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins they are pulled high by the internal pull-ups and can be used as inputs As inputs Port 1 pins that are externally being pulled low will source current IIL because of the internal pull-ups Port 1 also receives the low-order address bytes during Flash programming and verification

Port 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2 output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins they are pulled high by the internal pull-ups and can be used as inputs As inputs Port 2 pins that are externally being pulled low will source current IIL because of the internal pull-ups Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 16-bit addresses MOVX DPTR In this application it uses strong internal pull-ups when emitting 1s During accesses to external data memory that uses 8-bit addresses MOVX RI Port 2 emits the contents of the P2 Special Function Register Port 2 also receives the high-order address bits and some control

signals during Flash programming and verification

Port 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3 output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins they are pulled high by the internal pull-ups and can be used as inputs As inputs Port 3 pins that are externally being pulled low will source current IIL because of the pull-ups Port 3 also serves the functions of various special features of the AT89C51 as listed below Port Pin Alternate Functions P30 RXD serial input port

P31 TXD serial output port P32 INT0 external interrupt 0

P33 INT1 external interrupt 1 P34 T0 timer 0 external input P35 T1 timer 1 external input P36 WR external data memory write strobe P37 RD external data memory read strobe Port 3 also receives some control signals for Flash programming and verification RST

Reset input A high on this pin for two machine cycles while the oscillator is running resets the device

ALE

Address Latch Enable output pulse for latching the low byte of the address during accesses to external memory This pin is also the program pulse input PROG during Flash programming In normal operation ALE is emitted at a constant rate of 16 the oscillator frequency and may be used

for external timing or clocking purposes Note however that one ALE pulse is skipped during each access to external Data Memory If desired ALE operation can be disabled by setting bit 0 of SFR location 8EH With the bit set ALE is active only during a MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode

Program Store Enable is the read strobe to external program memory When the AT89C51 is executing code from external program memory is activated twice each machine cycle except that two activations are skipped during each access to external data memory

VPP

External Access Enable must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH Note however that if lock bit 1 is programmed will be internally latched on reset should be strapped to VC C for internal program executions This pin also receives the 12-volt programming enable voltage VPP during Flash programming for parts that require 12-volt VPP XTAL1

Input to the inverting oscillator amplifier and input to the internal clock operating circuit

XTAL2

Output from the inverting oscillator amplifier

6 Oscillator Characteristics

XTAL1 and XTAL2 are the input and output respectively of an inverting amplifier which can be configured for use as an on-chip oscillator as shown in Figure 1 Either a quartz crystal or ceramic resonator may be used To drive the device from an external clock source XTAL2 should be left unconnected while XTAL1 is driven as shown in Figure 2 There are no requirements on the duty cycle of the external clock signal since the input to the internal clocking circuitry is through a divide-by-two flip-flop but minimum and imum voltage high and low time specifications must be observed

Oscillator Connections

Note C1 C2 30 pF±10 pF for Crystals

40 pF±10 pF for Ceramic Resonators

External Clock Drive Configuration

7 Idle Mode

In idle mode the CPU puts itself to sleep while all the on-chip peripherals remain active The mode is invoked by software The content of the on-chip RAM and all the special functions registers remain unchanged during this mode The idle mode can be terminated by any enabled interrupt or by a hardware reset It should be noted that when idle is terminated by a hard ware reset the device normally resumes program execution from

where it left off up to two machine cycles before the internal reset algorithm takes control On-chip hardware inhibits access to internal RAM in this event but access to the port pins is not inhibited To eliminate the possibility of an unexpected write to a port pin when Idle is terminated by reset the instruction following the one that invokes Idle should not be one that writes to a port pin or to external memory

8 Power-down Mode

In the power-down mode the oscillator is stopped and the instruction that invokes power-down is the last instruction executed The on-chip RAM and Special Function Registers retain their values until the power-down mode is terminated The only exit from power-down is a hardware reset Reset redefines the SFRs but does not change the on-chip RAM The reset should not be activated before VCC is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize

9 Programming the Flash

The AT89C51 is normally shipped with the on-chip Flash memory array in the erased state that is contents FFH and ready to be programmed The programming interface accepts either a high-voltage 12-volt or a low-voltage VCC program enable signal The low-voltage programming mode provides a convenient way to program the AT89C51 inside the users system while the high-voltage programming mode is compatible with conventional

third party Flash or EPROM programmers The AT89C51 is shipped with either the high-voltage or low-voltage programming mode enabled The respective top-side marking and device signature codes are listed in the following table

The AT89C51 code memory array is programmed byte-by-byte in either programming mode To program any nonblank byte in the on-chip Flash Memory the entire memory must be erased using the Chip Erase Mode

10 Flash Programming and Verification Characteristics

TA 0°C to 70°C VCC 50±10

Note 1 Only used in 12-volt programming mode

11 DC Characteristics

TA -40°C to 85°C VCC 50V±20 unless otherwise noted

Notes

1 under steady state non-transient conditions IOL must be externally limited as follows

imum IOL per port pin 10 mA

imum IOL per 8-bit port Port 0 26 mA

Ports 1 2 3 15 mA

imum total IOL for all output pins 71 mA

If IOL exceeds the test condition VOL may exceed the related specification Pins are not guaranteed to sink current greater than the listed test conditions

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单片机数字时钟设计

题目:简单51单片机数字时钟设计 院系: 物理与电气工程学院 专业:自动化专业 班级:10级自动化 姓名:苏吉振 学号:2 老师:李艾华

引言 20世纪末,电子技术获得了飞速的发展,在其推动下,现代电子产品几乎渗透了社会的各个领域,有力地推动了社会生产力的发展和社会信息化程度的提高,同时也使现代电子产品性能进一步提高,产品更新换代的节奏也越来越快。 时间对人们来说总是那么宝贵,工作的忙碌性和繁杂性容易使人忘记当前的时间。忘记了要做的事情,当事情不是很重要的时候,这种遗忘无伤大雅。但是,一旦重要事情,一时的耽误可能酿成大祸。 目前,单片机正朝着高性能和多品种方向发展趋势将是进一步向着CMOS 化、低功耗、小体积、大容量、高性能、低价格和外围电路内装化等几个方面发展。下面是单片机的主要发展趋势。 单片机应用的重要意义还在于,它从根本上改变了传统的控制系统设计思想和设计方法。从前必须由模拟电路或数字电路实现的大部分功能,现在已能用单片机通过软件方法来实现了。这种软件代替硬件的控制技术也称为微控制技术,是传统控制技术的一次革命。 单片机模块中最常见的是数字钟,数字钟是一种用数字电路技术实现时、分、秒计时的装置,与机械式时钟相比具有更高的准确性和直观性,且无机械装置,具有更更长的使用寿命,因此得到了广泛的使用。 数字钟是采用数字电路实现对时,分,秒数字显示的计时装置,广泛用于个 人家庭,车站, 码头办公室等公共场所,成为人们日常生活中不可少的必需品,由于数字集成电路的发展和石英晶体振荡器的广泛应用,使得数字钟的精度,远远超过老式钟表, 钟表的数字化给人们生产生活带来了极大的方便,而且大大地扩展了钟表原先的报时功能。诸如定时自动报警、按时自动打铃、时间程序自动控制、定时广播、自动起闭路灯、定时开关烘箱、通断动力设备、甚至各种定时电气的自动启用等,所有这些,都是以钟表数字化为基础的。因此,研究数字钟及扩大其应用,有着非常现实的意义。

基于51单片机的数字钟

专业课程设计报告 专业班级 课程 题目基于51单片机的数字钟的设计报告学号 学生姓名 指导教师 成绩 2013年6月20日

基于A T89C51的数字钟总体设计说明书 目录 1. 51单片机设计数字钟设计的现实意义 (2) 2. 总体设计 (2) 2.1.开发与运行环境 (2) 2.2.硬件功能描述 (2) 2.3.硬件结构 (3) 3. 硬件模块设计 (3) 3.1.描述 (3) 3.1.1. AT89C51单片机简介 (3) 3.1.2. 键盘电路的设计 (4) 3.1.3. 显示器的选择 (5) 3.1.4. 蜂鸣器驱动电路 (5) 3.1.5. 各部分功能 (6) 4. 嵌入式软件设计 (7) 4.1.流程逻辑 (7) 4.2.算法 (7) 4.2.1. 中断定时器的设置 (27) 4.2.2. 闹钟子函数 (28) 4.2.3. 计时函数 (29) 4.2.4. 键盘扫描函数 (31) 4.2.5. 时间和闹钟的设置 (32) 5. 实验器材清单 (33) 6. 测试与性能分析 (33) 6.1.测试结果 (33) 6.2.优点 (33) 6.3.结论 (34) 7. 心得体会 (36) 8. 致谢 (36) 9. 参考文献 (37)

1.51单片机设计数字钟设计的现实意义 20世纪末,电子技术获得了飞速的发展,在其推动下,现代电子产品几乎渗透了社会的各个领域,有力地推动了社会生产力的发展和社会信息化程度的提高,同时也使现代电子产品性能进一步提高,产品更新换代的节奏也越来越快。时间对人们来说总是那么宝贵,工作的忙碌性和繁杂性容易使人忘记当前的时间。忘记了要做的事情,当事情不是很重要的时候,这种遗忘无伤大雅。但是,一旦重要事情,一时的耽误可能酿成大祸。例如,许多火灾都是由于人们一时忘记了关闭煤气或是忘记充电时间等造成的。而钟表的数字化给人们生产生活带来了极大的方便。数字钟是通过数字电路实现时,分,秒数字显示的计时装置,广泛用于个人家庭、车站、码头办公室等公共场所,成为人们日常生活中不可少的必需品。由于数字集成电路的发展和石英晶体振荡器的广泛应用,使得数字钟的精度,远远超过老式钟表,钟表的数字化给人们生产生活带来了极大的方便,而且大大地扩展了钟表原先的报时功能,诸如定时自动报警、按时自动打铃、时间程序自动控制、定时广播、自动起闭路灯、定时开关烤箱、通断动力设备、甚至各种定时电气的自动启用等。所有这些,都是以钟表数字化为基础的。因此,研究数字钟及扩大其应用,有着非常现实的意义。 2.总体设计 2.1.开发与运行环境 在硬件方面,除了CPU外,使用八个七段LED数码管来进行显示,LED采用的是动态扫描显示。通过LED能够较为准确地显示时、分、秒。四个简单的按键实现对时间的调整。软件方面采用C语言编程。使用Keil单片机模拟调试软件,测试程序的可行性并用Proteus进行仿真。 2.2.硬件功能描述 硬件部分设置了的三个按键S1、S2、S3、S4。当按键S1第一次按下时,停止计时进

基于单片机的数字钟设计-(1)

基于单片机的数字时钟摘要 20世纪末,电子技术获得了飞速的发展,在其推动下,现代电子产品几乎渗透了社会的各个领域,有力地推动了社会生产力的发展和社会信息化程度的提高,同时也使现代电子产品性能进一步提高,产品更新换代的节奏也越来越快。 单片机模块中最常见的是数字钟,数字钟是一种用数字电路技术实现时、分、秒计时的装置,与机械式时钟相比具有更高的准确性和直观性,且无机械装置,具有更更长的使用寿命,因此得到了广泛的使用。 本课题主要研究的是基于单片机的数字钟设计,采用AT89C51单片机作为系统的主控芯片,外接LED显示电路,按键电路,晶振电路,复位电路模块构成一个简单的数字钟。通过按键电路能对时、分、秒分别进行设置和实时调整,并将结果显示在数码管上。 关键词:数字钟,单片机,数码管

Abstract Author:cheng dong Tutor:wang xin Electronic technology has been developed rapidly in the 20 century,with its modern electronic products, pushed by almost permeated every area of society has vigorously promoted social productive forces development and improvement of social informatization level, also make modern electronic product performance further improved, and the rhythm of upgrade its products is becoming more and more quickly. The most common SCM module is a digital clock, a digital clock is a kind of digital circuit technology implementation, minutes and seconds, the timing device with mechanical clock compared with higher accuracy and intuitive and no mechanical device, has more longer service life, so it has been widely used. This topic research is the digital clock design based on SCM, AT89C51 SCM as the main control chip system, external LED display circuit, key circuits, crystals circuit, reset circuit module constitute a simple digital clock. Through the key circuits can respectively the diffculties, minutes and seconds setting and real-time adjustment, and the result showed that in the digital tube. Key words:digital clock SCM ; digital

基于51单片机的多功能电子钟设计

基于51单片机的多功能电子钟设计 【摘要】数字电子时钟是人们日常生活中不可或缺的必需品。本文以STC89C52为核心控制芯片,DS12887为时钟芯片,DS18B20为温度传感器,通过液晶显示器LCD1602实时显示时间及温度,通过按键设置年月日和星期以及定时闹钟,定时闹钟时间到自动发出警报。本设计的+5V电源采用LM1117电压转换元件,将电源适配器转换得到的12V电压直接变成5V电压供系统使用。程序的下载则是通过普中科技公司自制的PZ-ISP软件完成。经过测试,系统可以正常完成预定的功能。 【关键词】电子时钟;单片机;DS12887;DS18B20;

Design of Multi-function Clock Based on 51 MCU 【Abstract】Digital electronic clock is an integral, necessary part of daily life.In this paper, STC89C52 chip is used as the core control chip, DS12887chip is used as the clock chip, DS18B20 chip is used as the temperature sensor and LCD1602 was used to diaplay time and temperature。You can set year, month and time alarm clock through the four buttons.When the real time reach to the time clock,the system will warn automatically. The +5V power of the system is supplied by LM1117 voltage conversion device. The 12V voltage get from power adapter was transformed directly into 5V voltage for the system. The download of the process is accomplished through the PZ-ISP software made by Puzhong technology company. After testing, the system can complete the scheduled function normally. 【key words】electronic clock;MCU;DS12887;DS18B20

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单片机数字时钟

计算机硬件综合课程 设计报告 课目: 学院: 班级: 姓名: 指导教师: 目录 1 设计要求 功能需求 设计要求

2 硬件设计及描述 总体描述 系统总体框图 Proteus仿真电路图 3 软件设计流程及描述 程序流程图 函数模块及功能 4 心得体会 附:源程序 设计要求 功能需求 实现数字时钟准确实时的计时与显示功能; 实现闹钟功能,即系统时间到达闹钟时间时闹铃响; 实现时间和闹钟时间的调时功能; 刚启动系统的时候在数码管上滚动显示数字串(学号)。设计要求 应用MCS-51单片机设计实现数字时钟电路; 使用定时器/计数器中断实现计时; 选用8个数码管显示时间;

使用3个按钮实现调时间和闹钟时间的功能。按钮1:更换模式(模式0:正常显示时间;模式1:调当前时间的小时;模式2;调当前时间的分钟;模式3:调闹钟时间的小时;模式4:调闹钟时间的分钟);按钮2:在非模式0下给需要调节的时间数加一,但不溢出;按钮3:在非模式0下给需要调节的时间数减一,但不小于零; 在非0模式下,给正在调节的时间闪烁提示; 使用扬声器实现闹钟功能; 采用C语言编写程序并调试。 2 硬件设计及描述 总体描述 单片机采用AT89C51型; 时间显示电路:采用8个共阴极数码管,P1口驱动显示数字,P2口作为扫描信号; 时间设置电路:、、分别连接3个按键,实现调模式,时间加和时间减; 闹钟:口接扬声器。 系统总体框图 Proteus仿真电路图

3 软件设计流程及描述 程序流程图

函数模块及功能 void display_led() 学号的滚动显示函数; void display() 显示时间以及显示调节时间和闹钟时间的闪烁; void key_prc() 键盘功能函数,实现3个按键有关的模式转换以及数字加一减一; void init() 初始化设置中断;

基于51单片机的数字钟设计

20世纪末,电子技术获得了飞速的发展,在其推动下,现代电子产品几乎渗透了社会的各个领域,有力地推动了社会生产力的发展和社会信息化程度的提高,同时也使现代电子产品性能进一步提高,产品更新换代的节奏也越来越快。 单片机模块中最常见的是数字钟,数字钟是一种用数字电路技术实现时、分、秒计时的装置,与机械式时钟相比具有更高的准确性和直观性,且无机械装置,具有更更长的使用寿命,因此得到了广泛的使用。 本课题主要研究的是基于单片机的数字钟设计,采用AT89C51单片机作为系统的主控芯片,外接LED显示电路,按键电路,晶振电路,复位电路模块构成一个简单的数字钟。通过按键电路能对时、分、秒分别进行设置和实时调整,并将结果显示在数码管上。

1 引言 (3) 2 单片机介绍 (4) 3 数字钟硬件设计 (4) 3.1系统方案的确定 (4) 3.2功能分析 (4) 3.3数字钟设计原理 (5) 3.3.1键盘控制电路 (5) 3.3.2晶振电路 (6) 3.3.3复位电路 (7) 3.3.4数码显示电路 (7) 4.数字钟的软件设计 (8) 4.1程序设计内容 (8) 4.2源程序 (9)

1 引言 在单片机技术日趋成熟的今天,其灵活的硬件电路和软件电路的设计,让单片机得到广泛的应用,几乎是从小的电子产品,到大的工业控制,单片机都起到了举足轻重的作用。单片机小的系统结构几乎是所有具有可编程硬件的一个缩影,可谓是“麻雀虽小,肝胆俱全”,单片机的学习和研究是对微机系统学习和研究的简捷途径。基于单片机的定时和控制装置在许多行业有着广泛的应用,而数字钟是其中最基本的,也是最具有代表性的一个例子[1],用数字电路实现对时、分、秒数字显示的计时装置。因为机具有体积小、功耗低、功能强、性价比高、易于推广应用的优点,在自动化装置、智能仪器表、过程控制、通信、家用电器等许多领域得到日益广泛的应用[2],因此具有很大的研究价值。

基于51单片机多功能电子时钟设计论文报告-毕设论文

单片机课程设计报告 多功能电子数字钟 姓名: 学号: 班级: 指导教师:

目录 一课程设计题目-------------------------------- 3 二电路设计--------------------------------------- 4 三程序总体设计思路概述------------------- 5 四各模块程序设计及流程图---------------- 6 五程序及程序说明见附录------------------- ** 六课程设计心得及体会---------------------- 11 七参考资料--------------------------------------- 12

一题目及要求 本次单片机课程设计在Proteus软件仿真平台下实现,完成电路设计连接,编程、调试,仿真出实验结果。具体要如下:用8051单片机设计扩展6位数码管的静态或动态显示电路,再连接几个按键和一个蜂鸣器报警电路,设计出一个多功能电子钟,实现以下功能: (1)走时(能实现时分秒,年月日的计时) (2)显示(分屏切换显示时分秒和年月日,修改时能定位闪 烁显示) (3)校时(能用按键修改和校准时钟) (4)定时报警(能定点报时) 本次课程设计要求每个学生使用Proteus仿真软件独立设计制作出电路图、完成程序设计和系统仿真调试,验收时能操作演示。最后验收检查 结果,评定成绩分为: (1)完成“走时+显示+秒闪”功能----及格 (2)完成“校时修改”功能----中等 (3)完成“校时修改位闪”----良好 (4)完成“定点报警”功能,且使用资源少----优秀

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单片机的数字时钟的设计

基于51单片机的数字时钟的设计 摘要:现代生活中,对于数字电子钟的使用情况已经远远大于对于机械表的使用。数字时钟不仅仅是使用方便,而且由于单片机的引入,额外增加了自动控制和闹钟报时等功能,十分便利。本次毕业设计,是以STC89C52芯片为核心,添加适当外围电路,辅以C语言,所形成的数字电子钟。除了51单片机芯片,还主要用到了时钟芯片DS1302和型号是1602的液晶显示屏。 关键词:STC89C52;数字电子钟;C语言。

Design of Digital Clock System Based on MSC-51 Singlechip Abstract: In modern life, the use of digital electronic clock has been far greater than for the use of mechanical watches. Digital Clock is not just easy to use, and because of the introduction of single-chip, additional automatic control and alarm clock timekeeping functions, is very convenient. The graduation project is based STC89C52 chip as the core, adding the appropriate external circuit, supplemented by the C language, the formation of digital electronic clock. In addition to 51 single-chip, is also largely used in the clock chip DS1302 and models are 1602 LCD display. Keywords: STC89C52; digital electronic clock; C language.

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 语言把这个问题,交给了机器也就是编译器去解决了。其实, 计算机的发展, 就是把尽可能多的事情交个机器去解决。

基于单片机的数字时钟之C51单片机

山东大学威海分校 基于单片机的数字时钟 C51单片机 王若愚 学号200800800307 2010/7/18

概述 AT89C51是美国ATMEL公司生产的低功耗,高性能CMOS8位单片机,片内含4K的可编程的Flash只读程序存储器,器件采用ATMEL公司的高密度、非易失性存储技术生产,兼容标准8051指令系统及引脚。它集Flash程序存储器既可在线编程(ISP)也可用传统方法进行编程及通用8位微处理器于单片机芯片中,ATMEL公司的功能强大,低价位AT89S51单片机可为您提供许多高性价比的应用场合,可灵活应用于各种控制领域。 功能特性概述 AT89S51提供以下标准功能:4K字节闪速存储器,128字节内部RAM,32个I/O口线,看门狗(WDT),两个数据指针,两个16位定时/计数器,一个5向量两级中断结构,一个全双工串行通信口,片内振荡器及时钟电路。同时,AT89S51可降至0HZ的静态逻辑操作,并支持两种软件可选的节电工作模式。空闲方式停止CPU的工作,但允许RAM,定时/计数器,串行通信口及中断系统继续工作。掉电方式保存RAM中到内容,但振荡器停止工作并禁止其它所有工作部件直到下一个硬件复位。

AT89S51硬件电路原理 复位及振荡电路 复位电路由按键复位和上电复位两部分组成,如图2所示。AT89S系列单片及为高电平复位,通常在复位引脚RST上连接一个电容到VCC,再连接一个电阻到GND,由此形成一个RC 充放电回路保证单片机在上电时RST脚上有足够时间的高电平进行复位,随后回归到低电平进入正常工作状态,这个电阻和电容的典型值为8.2K和10uF。 按键复位就是在复位电容上并联一个开关,当开关按下时电容被放电、RST也被拉到高电平,而且由于电容的充电,会保持一段时间的高电平来使单片机复位。 MCS51 LITE使用22.1184MHz的晶体振荡器作为振荡源,由于单片机内部带有振荡电路, 所以外部只要连接一个晶振和两个电容即可,电容容量一般在15pF至50pF之间。

51单片机数字钟

目录 1 设计任务与要求................................................... I 2 设计方案 (1) 3 硬件设计 (2) 3.1 AT89C51单片机简介 2 3.2单片机型号的选择 (6) 3.3数码管显示工作原理 (6) 4 软件设计 (7) 4.1主程序模块介绍 (7) 4.2主程序 (7) 5 仿真调试 ........................................ 错误!未定义书签。 5.1K EIL仿真结果................................. 错误!未定义书签。 5.2仿真结果分析 (13) 6 小结 ............................................ 错误!未定义书签。

1 设计任务与要求 1. 设计一个基于单片机的电子时钟,并且能够实现时分秒的现实和调节。 2. 设计出硬件电路。 3. 设计出软件编程方法,并写出源代码。 4. 用PROTEUS进行仿真。 5.用汇方式实现目的。 7.系统的各各功能模块要编语言编实现程序设计。 6.利用查表,中断等清楚,有序。 8.程序运行时有友好的用户界面。 2 设计方案 本设计主要设计了一个基于AT89C51单片机的电子时钟。并在数码管上显示相应的时间。并通过一个控制键用来实现时间的调节和是否进入省电模式的转换。应用Proteus的ISIS软件实现了单片机电子时钟系统的设计与仿真。该方法仿真效果真实、准确,节省了硬件资源。 该设计的硬件部分主要包括89C51多功能接口芯片用于开发电子时钟芯片、LED七段数码显示器用于显示时间、8031集成定时器用于定时、0.125W、8欧姆的扬声器用于定时发声。软件部分包括主程序、定时计数中断程序、时间调整程序、延时程序四大模块。通过中断程序进行定时器计数,时间调整程序是当键按下时间小于1秒,关闭显示(省电)进入调节时间状态,延时程序用于时间的延迟。先设计个秒钟程序,在秒钟程序中先不设计按钮,直接通电运行,使用40H 存放计数值,从00—59,一直循环,把40H中的数值拆分成个位和十位,分别存在30H与31H中,要求动态扫描时,使用21H当标志位,用指令JB控制显示个位与十位,程序中使用中间寄存器R0与R1用于存放拆分后的字型,再传到30H与31H中去,再设计时钟程序。

相关主题