Tài liệu Programming Embedded System I ppt

284 313 0
Tài liệu Programming Embedded System I ppt

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

P0.0 P1.2 P0.1 P1.3 P0.2 P1.4 P0.3 P1.5 P0.4 P1.6 P0.5 P1.7 P0.6 11 12 13 14 15 16 17 18 19 20 P3.1 RST P3.0 P0.7 / EA ALE P3.2 / PSEN P3.3 P2.7 P3.4 P2.6 P3.5 P2.5 P3.6 P2.4 P3.7 P2.3 XTL2 P2.2 XTL1 P2.1 VSS P2.0 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 Further info: http://www.le.ac.uk/engineering/mjp9/ VCC P1.1 ‘8051’ P1.0 I [v1.2a] Michael J Pont University of Leicester A 10-week course, using C Programming Embedded Systems I 10 Copyright © Michael J Pont, 2002-2006 This document may be freely distributed and copied, provided that copyright notice at the foot of each OHP page is clearly visible in all copies II Seminar 1: “Hello, Embedded World” Overview of this seminar Overview of this course By the end of the course … Main course textbook Why use C? Pre-requisites! The 8051 microcontroller The “super loop” software architecture Strengths and weaknesseses of “super loops” Example: Central-heating controller Reading from (and writing to) port pins SFRs and ports SFRs and ports Creating and using sbit variables Example: Reading and writing bytes Creating “software delays” Using the performance analyzer to test software delays Strengths and weaknesses of software-only delays Preparation for the next seminar 10 11 12 13 14 15 16 17 18 19 20 III Seminar 2: Basic hardware foundations (resets, oscillators and port I/O) Review: The 8051 microcontroller Review: Central-heating controller Overview of this seminar Oscillator Hardware How to connect a crystal to a microcontroller Oscillator frequency and machine cycle period Keep the clock frequency as low as possible Stability issues Improving the stability of a crystal oscillator Overall strengths and weaknesses Reset Hardware More robust reset circuits Driving DC Loads Use of pull-up resistors Driving a low-power load without using a buffer Using an IC Buffer Example: Buffering three LEDs with a 74HC04 What is a multi-segment LED? Driving a single digit Preparation for the next seminar 21 22 23 24 25 27 28 29 30 31 32 34 35 36 38 39 40 41 42 43 44 IV Seminar 3: Reading Switches Introduction Review: Basic techniques for reading from port pins Example: Reading and writing bytes (review) Example: Reading and writing bits (simple version) Example: Reading and writing bits (generic version) The need for pull-up resistors The need for pull-up resistors The need for pull-up resistors Dealing with switch bounce Example: Reading switch inputs (basic code) Example: Counting goats Conclusions Preparation for the next seminar 45 46 47 48 49 51 56 57 58 59 61 68 74 75 V Seminar 4: Adding Structure to Your Code Introduction Object-Oriented Programming with C Example of “O-O C” The Project Header (Main.H) The Port Header (Port.H) Re-structuring a “Hello World” example Example: Re-structuring the Goat-Counting Example Preparation for the next seminar 77 78 79 82 85 92 96 104 114 VI Seminar 5: Meeting Real-Time Constraints Introduction Creating “hardware delays” The TCON SFR The TMOD SFR Two further registers Example: Generating a precise 50 ms delay Example: Creating a portable hardware delay The need for ‘timeout’ mechanisms - example Creating loop timeouts Example: Testing loop timeouts Example: A more reliable switch interface Creating hardware timeouts Conclusions Preparation for the next seminar 115 116 118 119 120 121 122 126 129 130 132 134 135 137 138 VII Seminar 6: Creating an Embedded Operating System 139 Introduction Timer-based interrupts (the core of an embedded OS) The interrupt service routine (ISR) Automatic timer reloads Introducing sEOS Introducing sEOS Tasks, functions and scheduling Setting the tick interval Saving power Using sEOS in your own projects Is this approach portable? Example: Milk pasteurization Conclusions Preparation for the next seminar 140 144 145 146 147 148 153 154 157 158 159 160 174 175 VIII Seminar 7: Multi-State Systems and Function Sequences Introduction Implementing a Multi-State (Timed) system Example: Traffic light sequencing Example: Animatronic dinosaur Implementing a Multi-State (Input/Timed) system Example: Controller for a washing machine Conclusions Preparation for the next seminar 177 178 180 181 189 195 197 208 209 IX Seminar 8: Using the Serial Interface Overview of this seminar What is ‘RS-232’? Basic RS-232 Protocol Asynchronous data transmission and baud rates RS-232 voltage levels The software architecture Overview Using the on-chip U(S)ART for RS-232 communications Serial port registers Baud rate generation Why use 11.0592 MHz crystals? PC Software What about printf()? RS-232 and 8051: Overall strengths and weaknesses Example: Displaying elapsed time on a PC Example: Data acquisition Conclusions Preparation for the next seminar 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 235 239 240 X ... 175 VIII Seminar 7: Multi-State Systems and Function Sequences Introduction Implementing a Multi-State (Timed) system Example: Traffic light sequencing Example: Animatronic dinosaur Implementing... reading from port pins Example: Reading and writing bytes (review) Example: Reading and writing bits (simple version) Example: Reading and writing bits (generic version) The need for pull-up resistors... understand issues of reliability and safety and how software design and programming decisions may have a positive or negative impact in this area COPYRIGHT © MICHAEL J PON T, 2001-2006 Contains material

Ngày đăng: 13/12/2013, 11:15

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan