Microcontrollers and Microprocessors in UET 102 Module 4
Module 4 Introduction
Welcome to Module 4 of UET 102.
Topic: Microcontrollers and their role in electronic circuits.
Key goals for this lesson:
Understanding Arduino technology.
Explaining how microcontrollers function.
Identifying practical applications of microcontrollers.
Differentiating between analog and digital inputs.
Learning the fundamentals of programming Arduino.
Structure of Module 4:
Lesson 1: Microcontrollers
Lesson 2: Microprocessors
Lesson 3: Hands-on Practice with Microcontroller Basics
Introduction of Microcontroller Board and Architecture (GPIOs and Basic RAM)
Getting Started with Arduino
Digital and Analog Inputs and Outputs
Arduino Programming Basics
Lesson 1: Introduction to a Microcontroller
A microcontroller is a compact integrated circuit designed to govern a specific operation in an embedded system.
Common microcontroller boards include Arduino and Raspberry Pi.
For practical understanding, it is encouraged to have an Arduino board available while studying this module.
Lesson 2: Introduction of a Microcontroller Board and Its Architecture
Architecture of a Microcontroller:
Contains multiple CPUs (processor cores), memory, and programmable input/output peripherals.
Does not require additional components like a GPU for operation.
Microcontroller Specifications:
Storage:
Measured in kilobytes (KB), where 1 KB = 1,000 bytes.
Example: Minimum storage of 8 KB can hold 8,000 bytes of command code, equating to letters and spaces included in commands.
Processing Power:
Represented in bits; functions as the brain of the device.
Responsible for processing commands and controlling microcontroller operations involving arithmetic and logical functions.
Communicates with other components in an embedded system (Massimo, Shiloh, 2015).
Input/Output (I/O) Peripherals:
Interface for connecting to the outside world through input ports and output devices.
Input ports receive binary data from external information; the processor sends commands to output devices.
Core Components of a Microcontroller
Visibility: Core components are invisible without specialized X-ray machines.
Casing and GPIOs: Only visible parts are casing and general-purpose GPIOs.
Key Components:
DAC (Digital-to-Analog Converter):
Converts digital signals to continuous analog signals (e.g., controlling motors, generating audio).
I/O Pins:
Pins for interfacing with sensors and devices; configured as inputs or outputs depending on use.
The number of available I/O pins varies by model.
ROM (Read-Only Memory):
Stores permanent, unalterable data and instructions for device functioning (e.g., boot-up routines). Non-volatile and retains information when powered off.
CPU (Central Processing Unit):
Executes instructions, performs calculations, and manages input/output operations specific to embedded systems.
RAM (Random Access Memory):
Temporary data storage; limited in microcontrollers compared to larger computing devices. Important for program execution space.
Clock:
Generates a synchronized signal for operations, affecting processing speed and power consumption (measured in Hertz). Higher frequency means faster operations but increased power consumption.
ADC (Analog-to-Digital Converter):
Converts analog signals to digital values for processing.
Resolution impacts accuracy; an 8-bit ADC can represent 256 values.
GPIO Pins:
Input/Output interface for external component interactions.
Microcontroller Sizes and Specifications
Not singular in type; increased complexity affects specifications.
Typical operating voltage: 1.8V—3.8V, requiring resistors and capacitors to regulate voltage levels.
Applications:
Found in devices such as microwaves, ovens, TVs, robotics, etc.
Microcontrollers utilize flash memory for programming and operation.
Architecture Types:
Example: AVR microcontroller with Harvard architecture enables simultaneous data access, improving efficiency (Ju & Gurvich, 2007).
Microcontroller Functioning
Control set stores instructions and directs the CPU and RAM for output through I/O pins in the circuit.
Illustrative metaphor: AVR architecture likened to a library with separate collections for instructions and data, enhancing efficiency in executing commands.
Getting Started with Arduino
Arduino is an open-source platform designed for creating interactive physical objects.
Ideal for beginners with minimal technical expertise.
Key components of typical Arduino boards:
Microcontroller (brain of the Arduino): Executes loaded programs.
USB port: Connects Arduino to a computer for programming.
USB to Serial Chip: Facilitates data translation from computer to microcontroller.
Digital Pins: Operate as digital logic switches.
Analog Pins: Read analog values (10-bit resolution).
Power Pins: 5V / 3.3V for powering devices.
Ground (GND): Completes a circuit; represents 0 volts.
VIN: Connection for external power supplies.
Arduino Programming Basics
Arduino uses a simplified version of C/C++ for programming, utilizing an Integrated Development Environment (IDE) for coding, uploading, and testing.
Each Arduino sketch contains two functions:
setup(): Initializes settings once at the start.
loop(): Repeats execution continuously until power is off.
Example Sketch Structure:
Code typically includes variable declarations, functions, and libraries at the beginning, followed by
setup
andloop
definitions.