1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Programming embedded systems i

10 2 0

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

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 202,7 KB

Nội dung

Created with a trial version of Syncfusion Essential PDF Programming Embedded Systems I A 10-week course, using C Michael J Pont University of Leicester P0.3 P0.2 VCC P1.3 P0.4 P1.0 P1.4 P0.5 P0.1 P1.5 P0.6 P2.0 P2.1 P2.2 P2.3 P2.4 P2.5 P2.6 P2.7 / PSEN ALE / EA P0.7 P1.6 XTL1 XTL2 P3.7 P3.6 P3.5 P3.4 P3.3 P3.2 P3.1 RST P1.7 P0.0 P3.0 P1.1 10 VSS P1.2 11 12 13 14 15 16 17 18 19 20 ‘8051’ 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 [v1.2] I Copyright © Michael J Pont, 2002-2003 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 115 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 116 118 119 120 121 122 126 129 130 132 134 135 137 138 VII Seminar 6: Creating an Embedded Operating System 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 139 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... Operating System Introduction Timer-based interrupts (the core of an embedded OS) The interrupt service routine (ISR) Automatic timer reloads Introducing sEOS Introducing sEOS Tasks, functions

Ngày đăng: 22/10/2022, 14:06