550 likes | 704 Views
Chapter 26. Microcontrollers. Objectives. Define microcontroller. Explain the difference between a computer and a microcontroller. Explain the function of main microcontroller parts. Objectives. Identify various types of ROM. Name the general types of programming languages.
E N D
Chapter 26 Microcontrollers
Objectives • Define microcontroller. • Explain the difference between a computer and a microcontroller. • Explain the function of main microcontroller parts. Permission granted to reproduce for educational use only.
Objectives • Identify various types of ROM. • Name the general types of programming languages. • Name some common components found on a microcontroller module. Permission granted to reproduce for educational use only.
Overview of the Microcontroller • Programmable • Thought of as a “tiny computer” on one chip • Used in many applications, in almost all electronic devices • Replaced many relays and solid-state devices in industry Permission granted to reproduce for educational use only.
Microcontrollers vs. Computers • Both have microprocessors, memory location for data storage, and input and output facilities • Microprocessors have different limitations, amount of memory is different, and permanent storage differs Permission granted to reproduce for educational use only.
Microcontrollers vs. Computers (Cont.) • Microprocessors in computers are more powerful • Microprocessors are limited to specific applications in microcontrollers • Both use RAM to store applications • Both must have ROM • Microcontrollers are smaller and can be part of other devices Permission granted to reproduce for educational use only.
Advantages of Using Microcontrollers in Industry • Reusable • Dependable • Cost effective • Energy efficient Permission granted to reproduce for educational use only.
Reusability of Microcontrollers • Good for prototyping control circuitry • Control circuit can be modified by programming, instead of completely rewiring Permission granted to reproduce for educational use only.
Dependability of Microcontrollers • More dependable than relays • Control circuitry formerly relied on relays and timers • Have no moving parts • Do not wear out due to friction or contaminants Permission granted to reproduce for educational use only.
Cost Effectiveness of Microcontrollers • Can be produced at lower costs than electromechanical parts • Can be reprogrammed, instead of being replaced Permission granted to reproduce for educational use only.
Energy Efficiency of Microcontrollers • Less energy consumed for one microcontroller than for several individual components Permission granted to reproduce for educational use only.
Disadvantages of Using Microcontrollers in Industry • Programming complexity • Electrostatic sensitivity Permission granted to reproduce for educational use only.
Programming Complexity • Higher level of training required to program microcontrollers • Many programming languages • Compatibility problem for merging multiple systems into one control system Permission granted to reproduce for educational use only.
Electrostatic Sensitivity • Static charges easily damage CMOS ICs • Static precautions must be obeyed Permission granted to reproduce for educational use only.
Review What is a microcontroller? An integrated circuit (IC) that can be programmed to perform a set of functions to control a collection of electronic devices Permission granted to reproduce for educational use only.
Review What are the major differences between a computer and a microcontroller? Limitations of microprocessor, amount of memory for data and program manipulation, and type of storage available to permanently store a program Permission granted to reproduce for educational use only.
Review How is using a microcontroller more cost effective than using multiple electromechanical parts? Microcontrollers are produced at lower costs, and if they do not work, they can be reprogrammed Permission granted to reproduce for educational use only.
Review What are two disadvantages to using microcontrollers? The complex programming required and the electrostatic sensitivity Permission granted to reproduce for educational use only.
Microcontroller Components • Ports • Registers • Stack pointers • Program counters • Arithmetic/logic units (ALUs) • Oscillators • Watchdog timers • Memory • Programmable memory Permission granted to reproduce for educational use only.
Ports • Can correspond to the input and output pin assignments of the chip • Can contain information sent to the pins on microcontroller chip from sensors or switches Permission granted to reproduce for educational use only.
Registers • Can hold contents of data being manipulated Permission granted to reproduce for educational use only.
Stack Pointers • Stacks • Responsible for keeping track of sequence of memory locations Permission granted to reproduce for educational use only.
Program Counters • Interrupts can interrupt the processor while it is processing instructions so a different task can be performed • Information is transferred from the stack to program counter Permission granted to reproduce for educational use only.
ALUs • Perform mathematical and logical operations • Similar to digital devices • AND, OR, NOT, NOR, and NAND gates Permission granted to reproduce for educational use only.
Oscillators • Complex digital devices • Require steady digital pulse for timing • Separate functions controlled by one timing system • Source of steady pulse rate is oscillator circuit Permission granted to reproduce for educational use only.
Watchdog Timers • Used when one process cannot be completed before going to the next process • Use a routine based on timing • Within a certain amount of time, any processes that have not ended are reset Permission granted to reproduce for educational use only.
Memory • RAM • Temporarily stores programs and data • Loses contents when no electrical power is supplied • Volatile memory • ROM • Permanently stores programs or data • Retains information when power is disconnected • Nonvolatile memory Permission granted to reproduce for educational use only.
Programmable Memory • Masked ROM • Programmable read-only memory (PROM) • Erasable programmable read-only memory (EPROM) • Electrically erasable programmable read-only memory (EEPROM) Permission granted to reproduce for educational use only.
Review What are ports and registers used for? They are special memory locations dedicated to a specific function Permission granted to reproduce for educational use only.
Review What is a stack? Area in memory used to store data and program information Permission granted to reproduce for educational use only.
Review What does a stack pointer do? Keeps track of the last stack location used while the processor is busy manipulating data values, checking ports, or checking interrupts Permission granted to reproduce for educational use only.
Review What is an ALU used for? It performs common mathematical and logical operations on data Permission granted to reproduce for educational use only.
Review When is PROM programmed? After it is manufactured Permission granted to reproduce for educational use only.
Review What kind of memory is a special type of PROM that can be erased with an ultraviolet light and reprogrammed many times? Erasable programmable read-only memory (EPROM) Permission granted to reproduce for educational use only.
Programming Microcontrollers • Languages • C • C++ • BASIC • Visual BASIC • Quick BASIC • Editors Permission granted to reproduce for educational use only.
Machine Language • Also called machine code, object code, or executable code • Binary codes and digital voltage pulse levels • Closest form of code to the machine • Inefficient for writing programs • Advantage is that these programs run quickly Permission granted to reproduce for educational use only.
Assembly Language • Faster programming language than machine code • Mnemonics are used • Assembler program is used • Converted to machine code Permission granted to reproduce for educational use only.
High-Level Language • Easier and faster to write • Can be assembled into machine code by using a compiler program • Uses more memory and executes more slowly than assembly language • Not as restrictive as assembly language Permission granted to reproduce for educational use only.
Word size Opcodes Operands Source codes Object codes Interpreters Libraries Macros Programming Terminology Permission granted to reproduce for educational use only.
Review What type of language is the closest to the computer itself without needing further conversion? Machine code, or machine language Permission granted to reproduce for educational use only.
Review What type of language do most programmers use today? High-level language Permission granted to reproduce for educational use only.
Review What is an opcode? The part of a word in programming that contains the instruction to be carried out Permission granted to reproduce for educational use only.
Review When source code is assembled or compiled, what is it known as? Object code, executable code, or machine code Permission granted to reproduce for educational use only.
Review What is a macro? A set of assembler instructions represented by a single word Permission granted to reproduce for educational use only.
The Microcontroller Module • Mounted with other components • Microcontroller • Power source • Interface for connecting to a programming device • I/O ports • Additional memory • Microcontroller board • Microcontroller interface Permission granted to reproduce for educational use only.
Microcontroller Relay Circuits • Used when device controlled by microcontroller exceeds electrical power limits • Special circuit built to drive load of higher current connects to an optic coupler Permission granted to reproduce for educational use only.
Microcontroller Interface • Serial or parallel port • 9-pin serial port, or DB-9 • PC is allowed to automatically detect communications on the port by two pins being connected together Permission granted to reproduce for educational use only.
Review When a microcontroller is mounted on a circuit board with other components, what is it called? A module, or microcontroller board Permission granted to reproduce for educational use only.
Review When is a microcontroller relay circuit used? When the device or devices to be controlled by a microcontroller far exceed the electrical power limits of the controller Permission granted to reproduce for educational use only.