Software Layers
• The software controls the operation and functionality of the computer
• There are many "layers" of software in the computer.
4
What is firmware ?
Firmware is also a piece of software. But the context of
firmware is different. It is usually a small program that directly
controls the hardware. Hence, firmware is sometime known as
Low-Level Software.
5
Examples of Devices with Firmware
Computers: BIOS or UEFI firmware manages hardware
initialization during the boot process.
Smartphones: Firmware controls components like touchscreens,
cameras, and modems.
Home Appliances: Microwaves, washing machines, and TVs
rely on firmware for operation.
6
Embedded Systems: Devices like car control systems, IoT
6
devices, and medical equipment depend heavily on firmware.
Microcomputers and Microprocessors
There are three main components of a Computer System.
• Central Processing Unit (CPU): Also simply called as the microprocessor
acts as the brain coordinating all activities within a computer.
• Memory: The program instructions and data are primarily stored.
• Input/output (I/O) Devices: Allow the computer to input information for
processing and then output the results. I/O Devices are also known as
computer peripherals.
▪ The integrated Circuit (IC) chip containing the CPU is called
the microprocessor.
▪ A microcomputer is a relatively smaller computer with a central
processing unit (CPU) as a microprocessor. A microcomputer is
typically used as a personal computer (PC) which is smaller
than a mainframe computer.
7
Microcomputers and Microprocessors
There are three main components of a Computer System.
• Central Processing Unit (CPU): Also simply called as the microprocessor
acts as the brain coordinating all activities within a computer.
• Memory: The program instructions and data are primarily stored.
• Input/output (I/O) Devices: Allow the computer to input information for
processing and then output the results. I/O Devices are also known as
computer peripherals.
▪ The integrated Circuit (IC) chip containing the CPU is called
the microprocessor.
▪ A microcomputer is a relatively smaller computer with a central
processing unit (CPU) as a microprocessor. A microcomputer is
typically used as a personal computer (PC) which is smaller
than a mainframe computer.
8
8086 Microcomputers and Microprocessors
The CPU is connected to memory and I/O devices through a strip of wires called a
bus. The bus inside a computer carries information from place to place. There are
three types of busses:
1. Address Bus: The address bus is used to identify the memory location or I/O device the
processor intends to communicate with.
Data Bus: Data bus is used by the CPU to get data from / to send data to the memory
or the I/O devices. The width of a microprocessor is used to classify the microprocessor.
The size of data bus of Intel microprocessors vary between 8-bit (8085) to 64-bit
(Pentium).
3. Control Bus: How can we tell if the address on the bus is memory address or an I/O
device address? This is where the control bus comes in. Each time the processor outputs
an address it also activates one of the four control bus signals: Memory Read, Memory
Write, I/O Read and I/O Write.
The address and control bus contains output lines only, therefore it is unidirectional,
but the data bus is bidirectional.
9
Practical Example of Address Bus Usage:
CPU to Memory Communication:
When a CPU executes an instruction like LOAD R1, [0x0010],
the address bus is used to send the address 0x0010 to the
memory controller, indicating the specific memory location to
retrieve the data.
LOAD typically means "read data from a memory location and store it in a register.“
Peripheral Addressing:
In a microcontroller, the address bus might carry the address of
an I/O device, like an ADC (Analog-to-Digital Converter), to
10
access its registers.
10
Practical Example of Data Bus Usage:
LOAD R1, [0x2000], Step-by-Step Data Bus Usage:
Address Setup (Address Bus):
• The CPU places the memory address 0x2000 on the address bus.
• The address is sent to the memory controller to specify the memory
location.
Control Signal (Control Bus): The CPU sends a read signal on the control
bus to indicate it wants to read data from the specified memory address.
Memory Access: The memory controller retrieves the data stored at address
0x2000.
Data Transfer (Data Bus):The retrieved data (e.g., the byte 0x7F) is placed
on the data bus by the memory controller.
11
The CPU reads this data from the data bus and stores it in register R1. 11
8086
Microcomputers and Microprocessors
There two types of memory used in microcomputers:
▪ RAM (Random Access Memory/ Read-Write memory) is used by the computer
for the temporary storage of the programs that is running. Data is lost when the
computer is turned off. So known as volatile memory.
• ROM (Read Only Memory) the information in ROM is permanent and not lost
when the power is turned off. Therefore, it is called nonvolatile memory.
Note that RAM is sometimes referred as primary storage, where magnetic /optical disks
are called secondary storage.
Address Bus
RAM ROM Printer Disk Monitor Keyboard
CPU
Data Bus
Read/
Write Control Bus
12
Internal organisation of a microcomputer
8086
Microcomputers and Microprocessors
Inside the CPU:
A program stored in the memory provides instructions to the CPU to perform a
specific action. This action can be a simple addition. It is function of the CPU to fetch
the program instructions from the memory and execute them.
▪ The CPU contains a number of registers to store information inside the CPU
temporarily. Registers inside the CPU can be 8-bit, 16-bit, 32-bit or even 64-bit
depending on the CPU.
▪ The CPU also contains Arithmetic and Logic Unit (ALU). The ALU performs
arithmetic (add, subtract, multiply, divide) and logic (AND, OR, NOT)
functions.
▪ The CPU contains a program counter also known as the Instruction Pointer to
point the address of the next instruction to be executed.
▪ Instruction Decoder is a kind of dictionary which is used to interpret the meaning
of the instruction fetched into the CPU. Appropriate control signals are generated
according to the meaning of the instruction.
13
8086
Microcomputers and Microprocessors
Inside the CPU:
Address Bus
Instruction Pointer
Instruction Register
Instruction Decoder Control Bus
Timing and control
Flags ALU signals are generated
Data Bus
Internal Register A
Busses Register B
Register C
Register D
Internal block diagram of a CPU
14
Microcomputers and Microprocessors
8086
Disadvantages of microprocessor:
▪ It cannot handle the ANALOG signal, but only digital, and the solution to this
problem is to use ADC circuit to switch from analog to digital to expose the
micropressor on the signal.
▪ It is not possible to link it to the computer because the currency of connecting
the computer to anything external is done through the SERIAL PORT, or
USB PORT. Serial port receiving data sequentially, while the microprocessor
receives data once (receive it parallel), and to solve this problem, we use a
serial interface to convert the data parallel coming out of the microprocessor to
data serial understood by the computer or vice versa
▪ Doesn’t connect to the internet.
▪ The microprocessor does not contain an internal memory, but it needs a hard
disk and RAM.
15
Microcomputers and Microprocessors
8086
▪ Processor became microprocessor
▪ Hard-disk became small ROM
▪ Large RAM in computer Became small RAM size
16
Microcomputers and Microprocessors
8086
17
Microcontroller based system
18
EENG410: MICROPROCESSORS I
8086
Microcomputers and Microprocessors
Main function of oscillator
▪ An oscillator is an electronic circuit or device that generates a periodic
signal, typically in the form of a sine wave, square wave, or other
waveform, without requiring an external input signal.
▪ The main function of an oscillator connected to a CPU is to provide a
stable clock signal that synchronizes and regulates the operations of
the CPU and other components in the system. This clock signal is
critical for the proper functioning of a computer or electronic device, as
it determines the timing of all data processing and communication.
19
8086
EENG410: Microcomputers and Microprocessors
▪
MICROPROCESSORS I
Processor became microprocessor
▪ Hard-disk became small ROM
▪ Large RAM in computer Became small RAM size
20
What is an embedded system?
An embedded system is an
electronic/electro-mechanical system
designed to perform a specific function using
a combination of both hardware and firmware
(software).
An Embedded System is a computerized
system that is purpose built for it’s application
An embedded system uses a microprocessor
(or microcontroller) to do one task and one FIG 1. A TV Remote control
task only.
A remote control is an example of embedded
system since the processor inside it performs
only one task
What is an embedded system? 1 / 11
21
Common Input Devices for Microcontrollers
© Ahmad El- Banna
❑ Sensors convert physical phenomena into electrical signals.
Examples include:
• Temperature Sensors: LM35, DHT11, DS18B20
• Light Sensors: LDR (Light Dependent Resistor), photodiodes
RTES, Lec#3 , Spring 2015
• Motion Sensors: PIR (Passive Infrared), accelerometers,
gyroscopes
• Proximity Sensors: Ultrasonic sensors (e.g., HC-SR04), IR
sensors
• Gas Sensors: MQ-series sensors (e.g., MQ-2 for smoke detection)
33
• Pressure Sensors: BMP180, MPX series
Common Input Devices for Microcontrollers
© Ahmad El- Banna
❑ Switches and Buttons:
• Push buttons
• Toggle switches
• Rotary encoders
• Keypads (matrix or single key)
RTES, Lec#3 , Spring 2015
Push buttons
Toggle switches 35
Common Output Devices for Microcontrollers
© Ahmad El- Banna
❑ Analog Input Devices: Devices providing continuous signals
•Potentiometers (variable resistors)
•Joysticks (analog axes)
RTES, Lec#3 , Spring 2015
36
Types of Microcontrollers
RTES, Lec#3 , Spring 2015
51
How the microcontroller is programming
126
127
1. Set Up the Development Environment
© Ahmad El- Banna
• IDE (Integrated Development Environment): Install an
IDE such as Arduino IDE, MPLAB X, Keil uVision, or
PlatformIO depending on the microcontroller you’re
using.
RTES, Lec#3 , Spring 2015
• Compiler/Toolchain: Install a toolchain that supports the
microcontroller's architecture (e.g., GCC for ARM,
AVR-GCC for Atmel)
• .Device Libraries: Install libraries or frameworks for the
specific microcontroller to simplify coding.
12
2. Write the Code 8
1. Compile the code
© Ahmad El- Banna
• Use the IDE's built-in compiler or an external one to
generate a machine-readable binary file (e.g., HEX or
BIN).The compiler converts the high-level code into
assembly/machine code for the microcontroller.
RTES, Lec#3 , Spring 2015
2. Upload the code
Connect the microcontroller to your computer using a
programmer or debug tool (e.g., USB to UART
converter, JTAG, or ISP, MPLAB ICD, PICkit).Use
software tools like AVRDUDE, 12
STM32CubeProgrammer, or the Arduino IDE to upload 9
the firmware to the microcontroller.
programmer or debug tool
Embedded Software Fundamentals
Communication Interfaces for Programming:
© Ahmad El- Banna
• USB: Used by Arduino and similar boards for easy
programming.
• UART (Serial): Often used with FTDI or CH340 USB-
to-serial converters.
RTES, Lec#3 , Spring 2015
• ISP (In-System Programming): Common for AVR
microcontrollers.
• JTAG/SWD: Used for advanced debugging and
programming (e.g., ARM Cortex-M)
13
1
FIG 5. Embedded System Development Platform
The host machine contains the build environment for an embedded system. It contains a cross
compiler and a cross debugger. The debug allows communication between the target processor
through a special processor interface, the JTAG
Embedded Software Fundamentals
Embedded software development
Embedded Software Fundamentals
Embedded software development
Embedded Software Fundamentals
Embedded software development
Host Machine
Development Environments
Compiler Toolchain
Debuggers
Development Kits
Version Control
Embedded Software Fundamentals
Embedded software development
Host Machine
Development Environments
Compiler Toolchain
Debuggers
Development Kits
Version Control
Embedded Software Fundamentals