Autor: Michael J. Pont – University of Leicester
Contains material from: Pont, M.J. (2002) „Embedded C”, Addison-Wesley
An aparitie: 2003
Ce prezinta lucrarea?
Cursul prezinta detaliat metodele de programare a microcontroller-ului Intel 8051 folosind mediul de dezvoltare C. Acesta este structurat in 10 seminare.
Microcontrollerul Intel 8051 este implementat cu o structura pe 8 biti, fiind produs in mai multe variante, in functie de cantitatea si tipul de memorie inclusa precum si in functie de capacitatile structurale.
Majoritatea firmelor producatoare de microcontrolere produc modele compatibile cu standardul 8051, cu diverse imbunatatiri.
Caracteristicile principale ale familiei 8051:
- CPU pe 8 biti;
- 128 octeti de RAM intern;
- 4 kocteti de ROM intern;
- Posibilitate de adresare a 64 kocteti de memorie program;
- Posibilitate de adresare a 64 kocteti de memorie de date;
- 32 de linii I/O bidirectionale adresabile individual;
- 2 timere/countere pe 16 biti;
- 5 surse de intrerupere cu doua nivele de prioritati;
- Generator de tact intern;
- Posibilitate de lucru full-duplex prin interfata seriala;
- Posibilitate de lucru pe biti.
Structura cursului
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
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
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
- Dealing with switch bounce
- Example: Reading switch inputs (basic code)
- Example: Counting goats
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
Seminar 5: Meeting Real-Time Constraints
- Introduction
- Creating „hardware delays”
- The TCON SFR- The TMOD SFR 120
- 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
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
- Tasks, functions and scheduling
- Setting the tick interval
- Saving power
- Using sEOS in your own projects
- Is this approach portable?
- Example: Milk pasteurization
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
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
Seminar 9: Case Study: Intruder Alarm System
- Introduction
- System Operation
- Key software components used in this example
- Running the program
- The software
- Extending and modifying the system
Seminar 10: Case Study: Controlling a Mobile Robot
- Overview
- What can the robot do?
- The robot brain
- How does the robot move?
- Pulse-width modulation
- Software PWM
- The resulting code
- More about the robot
Bibliografie: