单片机应用技术(Microcontroller Applicati...

陈宇燕 吴慧芳 张晓培 朱名强 黄宗晓 覃峰 李永顺 宋艳 卢丛媚 黎小萍

目录

  • 1 项目一 入门篇---初识单片机   Project 1  Intro — First Look at Microcontrollers
    • 1.1 安全教育及认识单片机 Safety Education and Understanding of Microcomputers
      • 1.1.1 用电安全 Electrical Safety
      • 1.1.2 认识单片机 Understanding of  Microcomputers
    • 1.2 51系列单片机系统及管脚 51 Series Microcontroller System and Pins
    • 1.3 单片机编辑开发工具 Microcontroller Programming and Development Tools
      • 1.3.1 proteus仿真软件 Proteus Simulation Software
      • 1.3.2 keil c51单片机开发环境  Keil C51 Microcontroller Development Environment
    • 1.4 51系列单片机程序存储器 51 Series Microcontroller Program Memory
    • 1.5 51系列单片机数据存储器 51 Series Microcontroller Data Memory
  • 2 项目二  基础篇---LED 智能指示系统设计  Project 2   Basics — Intelligent LED Indication Design
    • 2.1 任务2.1 闪烁灯/Flashing Light
      • 2.1.1 闪烁灯--硬件电路设计/Hardware Circuit Design
      • 2.1.2 闪烁灯—C51程序设计/C Language Programming
    • 2.2 任务2.2 跑马灯/Running Light
      • 2.2.1 跑马灯—硬件电路/ Running Light - Hardware Circuit
      • 2.2.2 跑马灯—C51程序设计/   Running Light - C51 Program Design
    • 2.3 任务2.3 声光报警器/Sound and light alarm
    • 2.4 任务2.4 步进电机控制/Stepper Motor Control
      • 2.4.1 步进电机控制-硬件电路/hardware circuit
      • 2.4.2 步进电机控制-程序设计/software design
  • 3 项目三 提升篇---智能交互与显示控制   Project 3    Enhancement — Smart Interaction & Display Control
    • 3.1 任务3.1 数码管循环显示0-9     / 7-Segment Display Cycling Through 0-9
    • 3.2 任务3.2 多位数码管显示/Multi-Digit Seven-Segment Display
    • 3.3 任务3.3 按键控制LED灯/ Button-Controlled LED
      • 3.3.1 按键控制LED灯—电路设计/ Button controlled LED lights - circuit design
      • 3.3.2 按键控制LED灯—程序设计 /Button Control LED Light - Program Design
    • 3.4 任务3.4 键盘控制LED数码管/ Keyboard-Controlled LED Seven-Segment Display
      • 3.4.1 键控LED数码管—C51设计/Keyboard-Controlled LED Lights — Program Design
  • 4 项目四 进阶篇---计数定时系统开发   Project 4   Advanced — Counting & Timing Systems
    • 4.1 任务4.1 外部中断闪烁灯/External Interrupt Controlled Blinking LED
      • 4.1.1 外部中断设置/External Interrupt Setting
      • 4.1.2 外部中断控制闪烁灯/External Interrupt Controlled Flashing Light
    • 4.2 任务4.2 工件计数 / Workpiece Counting
    • 4.3 任务4.3  8路抢答器设计/8-Channel Responder Design
    • 4.4 任务4.4 定时器中断闪烁灯/Timer Interrupt Blinking LED
      • 4.4.1 定时器/计数器知识 Knowledge of Timers/Counters
      • 4.4.2 定时器/计数器设置Timer/Counter Settings
      • 4.4.3 定时器闪烁灯程序设计/Program Design of Timer-Controlled Flashing Light
    • 4.5 任务4.5  秒表/Stopwatch
      • 4.5.1 秒表-程序设计/Stopwatch — Program Design
  • 5 项目五  综合篇 —— 智能监测控制实践  Project 5   Comprehensive — Intelligent Monitoring Practice
    • 5.1 任务5.1 模数转换LED显示/ Analog to digital conversion LED display
    • 5.2 任务5.2 数字电压表设计 /Digital Voltmeter Design
    • 5.3 任务5.3 水塔水位远程监控系统 /Remote monitoring system for water level of water tower
    • 5.4 任务5.4 温度测控系统 /Temperature Measurement and Control System
任务4.4 定时器中断闪烁灯/Timer Interrupt Blinking LED

    前面我们用了许多延时子程序delay(),称软件延时,虽然能实现了延时,但不能实现分时延时,分时控制是没有办法实现的,并且软件延时程序占用了CPU资源和时间,在实际工作中这样做不恰当。如用软件延时,当主程序实现了灯的闪烁,就不能再做其他工作了,这在实际复杂程序设计中,难以满足要求。

    因此,在实际工作中常用定时器中断来实现延时、定时中断控制等类似功能。

         Previously, we used many delay subroutines called delay(), also known as software delay. Although it can achieve delay, it cannot achieve time-sharing delay, and time-sharing control cannot be achieved. Moreover, software delay programs occupy CPU resources and time, which is not appropriate in practical work. If software delay is used, when the main program realizes the flashing of the light, no other work can be done, which is difficult to meet the requirements in practical complex program design.

           Therefore, timer interrupts are commonly used in practical work to achieve functions such as delay and timed interrupt control.