0% found this document useful (0 votes)
6 views58 pages

Unit 1 PDF

notes
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views58 pages

Unit 1 PDF

notes
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

SYLLAB

US
22IT602 EMBEDDED SYSTEMS AND INTERNET OF THINGS L T P C
(Lab Integrated) 2 0 2 3
COURSE OBJECTIVES:
The Course will enable learners:
• To learn the internal architecture and programming of an embedded
processor.
• To introduce interfacing I/O devices to the processor.
• To introduce the evolution of the Internet of Things (IoT).
• To build a small low-cost embedded and IoT system using
Arduino/Raspberry
• Pi/ open platform.
To apply the concept of Internet of Things in real world scenario.

UNIT 1 8-BIT EMBEDDED PROCESSOR


6+6

8-Bit Microcontroller – Architecture – Instruction Set and Programming –


Programming
Parallel Ports – Timers and Serial Port – Interrupt Handling.

UNIT II EMBEDDED C PROGRAMMING


6+6

Memory And I/O Devices Interfacing – Programming Embedded Systems in C –


Need For RTOS – Multiple Tasks and Processes – Context Switching – Priority
Based Scheduling Policies.

UNIT III IOT AND ARDUINO PROGRAMMING


6+6

Introduction to the Concept of IoT Devices – IoT Devices Versus Computers –


IoT Configurations – Basic Components – Introduction to Arduino – Types of
Arduino – Arduino Toolchain – Arduino Programming Structure – Sketches –
Pins – Input/Output From Pins Using Sketches – Introduction to Arduino
Shields – Integration of Sensors and Actuators with Arduino.

UNIT IV IOT COMMUNICATION AND OPEN PLATFORMS


6+6

IoT Communication Models and APIs – IoT Communication Protocols –


Bluetooth – WiFi – ZigBee – GPS – GSM modules – Open Platform (like
Raspberry Pi) – Architecture – Programming – Interfacing – Accessing GPIO
Pins – Sending and Receiving Signals Using GPIO Pins – Connecting to the
Cloud.

UNIT V APPLICATIONS DEVELOPMENT


6+6

Complete Design of Embedded Systems – Development of IoT Applications –


Home
Automation – Smart Agriculture – Smart Cities – Smart Healthcare.
UNIT I
8-BIT EMBEDDED PROCESSOR

Microcontrollers for Embedded system:

A Microcontroller is a single chip computer.

A CPU with all the peripherals like RAM, ROM, I/O Ports, Timers, and
ADCs etc. on the
same chip. For Ex: Motorola 6811, Intel 8051, Zilog Z8 and PIC 16X etc…

Microcontrollers are small, low-power computers designed for specific


tasks. They are widely used in embedded systems such as household
appliances, automotive systems, medical devices, and industrial control
systems. Microcontrollers are available in various configurations and
architectures, and they differ in terms of processing power, memory,
and I/O capabilities.8-bit and 16-bit microcontrollers are two common
types of microcontrollers that differ in terms of the number of bits they
can process at once. An 8- bit microcontroller can process 8 bits of data
at a time, while a 16-bit microcontroller can
process 16 bits of
data at a time.

What is Microcontroller ?

Microcontroller is a chip with a processor on it. It essentially provides


something for the processor to read from. A processor is basically
useless without a microcontroller. So an
8-bit microcontroller can read 8 bits of information. A 16-bit
microcontroller is 16 bits, a
32-bit microcontroller is 32 bits, and so on.

What is 8-bit Microcontroller ?

An 8-bit microcontroller is one with a data word length of 8 bits. The


number of bits that a microprocessor can process at once is referred to
as its word length or word size. 8-bit microcontrollers are commonly
used in low-end applications that do not require a lot of processing
power, such as remote controls, toys, and simple sensors. They
typically have
limited memory and I/O capabilities, and they are
relatively inexpensive.

Key Features of an 8-bit Microcontroller

Data Width: Called 8 bits wide, it means that the microcontroller works
with data in 8 bits
at a time.

Memory Access: A limited addressing capability normally up to a


maximum of 64KB of
memory.

Power Consumption: Low this makes it suitable for the use in battery
operated devices.

Speed: Work at lower frequencies because just fewer numbers of


interconnects power
these circuits.

Microprocessor:

A CPU built into a single VLSI chip is called a microprocessor.

It is a general-purpose device and additional external circuitry is added


to make it a
microcomputer.

The microprocessor contains arithmetic logic unit (ALU), Control unit,


Instruction register,
Program counter (PC), clock circuit (internal or external), reset
circuit (internal or
external) and registers.

But the microprocessor has no on chip I/O Ports, Timers, Memory etc. For
example, Intel
8085 is an 8-bit microprocessor and Intel 8086/8088 a 16-bit
microprocessor. The block diagram of the Microprocessor is shown in
Fig.1
MICROCONTROLLER : A microcontroller is an integrated single chip,
which consists of CPU, RAM, EPROM/PROM/ROM, I/O ports, timers,
interrupt controller. For example, Intel 8051 is 8-bit microcontroller and
Intel 8096 is 16-bit microcontroller. The block
diagram of Microcontroller is
shown in Fig.2.
Distinguish between Microprocessor and Microcontroller
8-Bit Microcontroller – Architecture

CPU (Central Processing Unit): CPU act as a mind of any processing


machine. It synchronizes and manages all processes that are carried out
in microcontroller. User has no power to control the functioning of CPU.
It interprets the program stored in ROM and carries out from storage
and then performs it projected duty.
CPU manage the different types of registers available in 8051
microcontroller.

Interrupts: Interrupts is a sub-routine call that given by the


microcontroller when some other program with high priority is request
for acquiring the system buses
the n interrupts occur in current running program.

Types of interrupt in 8051 Microcontroller:


Let's see the five sources of interrupts in 8051 Microcontroller:
• Timer 0 overflow interrupt - TF0
• Timer 1 overflow interrupt - TF1
• External hardware interrupt - INT0
• External hardware interrupt - INT1
• Serial communication interrupt - RI/TI

Memory: For operation Micro-controller required a program. This


program guides the microcontroller to perform the specific tasks.
This program installed in

microcontroller required some on chip memory for the storage of the


program.
Microcontroller also required memory for storage of data and
operands for the

short duration. In microcontroller 8051 there is code or program


memory of 4 KB

that is it has 4 KB ROM and it also comprise of data memory (RAM) of


128 bytes.
Bus : Bus is a group of wires which uses as a communication
canal or acts as means of data transfer. The different bus
configuration includes 8, 16 or more

cables. Therefore, a bus can bear 8 bits, 16 bits all together.

Types of buses in 8051 Microcontroller:

Let's see the two types of bus used in 8051 microcontroller:

• Address Bus: 8051 microcontrollers is consisting of 16 bit address


bus. It is generally be used for transferring the data from Central
Processing Unit to Memory.

• Data bus: 8051 microcontroller is consisting of 8 bits data bus. It is


generally be used for transferring the data from one peripherals
position to other peripherals.

Oscillator: As the microcontroller is digital circuit therefore it


needs timer for their operation. To perform timer operation inside
microcontroller it required externally connected or on-chip oscillator.
Microcontroller is used inside an embedded system for managing the
function of devices. Therefore, 8051 uses the two 16 bit counters and
timers. For the operation of this timers and counters the oscillator is
used inside microcontroller.
Explanation

The system bus is used to connect all of the support devices to the CPU.
The system bus is operated by bus control signals, a 16-bit address bus,
and an 8-bit data bus. The system bus is serves as an interface between
the CPU and all other devices, including program memory, ports, data
memory, interrupt control, serial
interface, and
timers.
PIN Diagram of 8051 Microcontroller

Explanation

A microcontroller uses all the functions of a microprocessor into


a single integrated circuit, acting as a miniature computer. It depends
extensively on on- chip features including RAM, ROM, I/O ports,
timers, serial ports, clock circuits, and interrupts to support a variety of
applications. Microcontrollers find application in a wide range of
automatically operated gadgets, including power tools, toys, office
equipment, medical equipment, remote controls, car engine
control
systems, and other embedded
systems.
The microcontroller has all of these peripherals built in,
but the microprocessor requires us to interface extra
circuitry outside for things like RAM, ROM, I/O ports,
timers, serial ports, clock circuits, and other
peripherals. Allow us to briefly examine
the 8051 microcontroller pin
diagram.

Working Principle

The microcontroller retrieves, decodes, and sequentially


executes instructions from memory. It can carry out
operations according to preprogrammed logic by
interacting with external devices via I/O ports and timers.
Componen
ts
The internal basic components of the architecture of the
8051 microcontroller are:
CP
U
The central processing unit, or CPU, functions as any
processing machine's brain. It coordinates and oversees
every operation performed by the microcontroller. The
user has no control over how the CPU operates. It
executes from storage, interprets the program that is
kept in ROM, and then carries out its intended function.
The CPU controls the many register types that the 8051
microcontroller has to offer.
Interrupts: The interrupt subroutine is called by the
microcontroller when a high-priority program requests to
access the system buses. This causes interruptions in
the program that is now executing. An interrupt can be
used to delay the present process using In order to
complete a subroutine task and then resume the main
program.
Different 8051 microcontroller interrupt
types:

Let's look at the 8051 microcontroller's five interrupt sources:

• Timer 0 overflow interrupt (TF0)

• Timer 1 overflow interrupt (TF1)

• External hardware interrupt (INT0)

• External hardware interrupt (INT1)

• Serial communication interrupt (RI/TI)

Memory

To do an operation The microcontroller needed a program. The tasks that the


microcontroller is supposed to accomplish are guided by this software. A
portion of the on-chip memory was needed for the microcontroller's installed
program to be stored. Memory was also needed by the microcontroller in
order to store operands and data for brief periods of time. In addition
to 128 bytes of data memory (RAM), the
microcontroller 8051 includes 4 KB of code or program memory, or
4 KB ROM.

Bus

A Bus is a collection of wires that is used as a data transfer or


communication channel. Eight, sixteen, or more cables are included in the
various bus arrangement. As a result,
a bus can support 8 bits, or 16 bits total.

Bus types in an 8051 microcontroller

Let's show the two bus types that the 8051 microcontroller uses:

• Address Bus: The 16-bit address bus is a component of 8051


microcontrollers.
Transferring data from the central processing unit to memory is its usual use.

• Data bus: The data bus of an 8051 microcontroller has eight bits.
Transferring data from one peripheral place to another is often the
usage for it.

Oscillator

It requires a timer to function because the microcontroller is a digital device.


An on-chip oscillator is externally linked or connected for the microcontroller
to execute timer functions. An embedded system is used a microcontroller to
control device functionality. The two 16-bit counters and timers are operated
by the 8051. The oscillator inside the microcontroller is utilized to operate
the timers and counters.
Construction of 8051 Micro
Controller

The 8051 microcontroller, which is made with CMOS technology,


combines every part into a single silicon chip for dependability and
compactness.

• Central Processing Unit (CPU): executes all instructions.

• Random Access Memory (RAM): Used to store variables and data.

• Program instructions are stored in ROM (Read-Only Memory).

• I/O Ports: Device interfaces with outside sources.

• Timer/Counter: Produces time lags and tally outside occurrences.

• Serial Communication Ports: Enables data communication in serial


fashion.

Disadvantages

• Limited Processing Capacity: Unsuitable for intricate calculations.

• Outdated Interfaces: Certain versions don't follow contemporary


communication
guidelines.

• Ethernet or USB connectivity are essential advanced peripherals.

• The instruction set presents difficulties for code optimization and


programming.

• Code development and debugging are challenging due to the


outdated development tools.

Applications of 8051 MicroControllers

the following industries uses the 8051 microcontroller.

• Industrial Automation: the 8051 microcontroller is used in the


Robotics and control systems.

• Consumer electronics: the microwave ovens, remote controllers


is worked using 8051 microcontroller.

• Automotive: Dashboard screens and engine control devices.


• Medical devices: the infusion pumps, patient monitoring systems is
created using
8051 microcontroller.
Instruction Set

A microcontroller consists of a processor with an instruction set,


these are just machine-level instructions that when processed have a
direct effect on the microcontroller. This is what makes these
instructions the building blocks in writing software that interacts with
hardware, and are important for embedded systems. ARM architecture,
as an example, has a huge list of instructions like arithmetic, logical,
comparison and so on commands which help in performing
intelligence operations over the
data.

DATA Processing Instructions

We use data processing instructions to manipulate data within the


registers.

Types for Data Processing Instructions

1. Arithmetic instructions

2. Logical instructions

3. Multiply instructions

4. Comparison instructions

5. Move instructions

Most of the data processing instructions use a barrel shifter to pre-


process the data of one of their operands. Each operation updates
different flags in the cpsr
(To learn more about ‘CPSR’ search “CPSR in ARM”).

Let us discuss the instructions in detail.


1. Arithmetic Instructions
The arithmetic instructions mainly implement addition and
subtraction of 32bit signed and unsigned values.

Examples –
1. This simple subtract instruction subtracts a value stored in register
r2 from a value stored in register r1. The result is stored in register
r0
PRE
r0 = 0x00000000 ; As this register is a register to hold the
output, that’s
why it is empty before execution
r1 = 0x000000002 ; register r1 holds the value ‘2’
r2 = 0x000000001 ; r2 holds another value ‘1’
SUB r0, r1, r2 ; r0=r1 – r2. Here the subtracted value (r0 – r1)
is moved to r0 after performing operation.
POS
T
r0 = 0x00000001 ; This is the output of above instruction moved
to r0
register

2. This reverse subtract instruction (RSB) subtracts r1 from the constant


value #0, writing the result to r0.
Reverse subtraction is helpful for integer values so that the instruction
can be
subtracted with no complexity.
PRE
r0 = 0x00000000 ; Output register
r1= 0x00000077 ; value to be reverse subtracted
RSB r0, r1, #0 ; Rd = 0x- – r1

POST
r0 = -r1 = 0xffffff89 ; reversed output gets generated and stored in
the
register r0

2. Logical Instruction

Logical instructions perform bitwise logical operations on the two source


registers.
Syntax: <instruction>{<cond>} {S} Rd, Rn, N
Example –
1. This example shows a logical OR operation between
registers r1
and r2, r0 holds the result.
PRE
r0 =
0x00000000 r1
= 0x02040608
r2 =
0x10305070
ORR r0, r1,
r2
POS
T
r0 = 0x12345678

3. Multiply Instruction

The multiply instructions multiply the contents of a pair of


registers depending upon the instruction, and accumulate the
result along with another register . The long multiplies
accumulate onto a pair of registers representing a 64-bit
value. The final result is placed on a
destination register or pair of
registers.

Syntax – MLA{<Cond>}{S} Rd, Rm, Rs, Rn


MUL{<Cond>}{S} Rd, Rm, Rs
4. Comparison
Instructions –
These instructions are used to compare or test a register
with a 32- bit value. They update the cpsr flag bits
according to the result, but do not affect other registers.
After the bits have been set, the information can then be
used to change program flow by using conditional
execution.
Syntax – <instruction>{<cond>}
Rn, N

Example

PR
E
cpsr = nzcvqift_USER
r0 = 4 ; register to be
compared r9 = 4 ; register to
be compared CMP r0, r9

POS
T
cpsr = nzcvqift_USER output generated after comparison
5. Move Instructions –

Move is the simplest ARM instruction. It copies N into a destination register


Rd,
where N is a register or immediate value. This instruction is useful for
setting initial values and transferring data between registers.

Syntax – <instruction>{<cond>}{S} Rd, N

Example –
PRE
r5 = 5 ; register value
r7 = 8 ; register value
MOV r7, r5 ;let r7 = r5
POS
T
r5 = 5 ; data in the register after moving the r5 data
into r7 r7 = 5 ; output after move operation

Advantages of Instruction sets of a microcontroller

• Efficiency: An architectures such as that of ARM uses Reduced instruction


sets (RISC)
that facilitates fast and efficient operations.

• Low Power Consumption: Power consumption is typically very important in


embedded systems and therefore the system has been designed with
optimum power use in mind.
• Versatility: Different forms of instructions are possible to accomplish a
number of
operations.

Disadvantages of Instruction sets of a microcontroller

• Limited Flexibility: Some micro operations involve many instructions as


the level of operation becomes high hence more complex.

• Hardware Dependent: The various microcontroller families around


have their individual instruction sets something that makes them
incompatible.

Programming Parallel Ports

8051 microcontrollers have 4 I/O ports each of 8-bit, which can be


configured as input or output. Hence, total 32 input/output pins allow
the microcontroller to be connected with the peripheral devices.

• Pin configuration, i.e. the pin can be configured as 1 for input and 0 for
output as per the logic state.

• Input/Output (I/O) pin − All the circuits within the


microcontroller must be connected to one of its pins except P0
port because it does not have pull-up resistors built-in.

• Input pin − Logic 1 is applied to a bit of the P register. The


output FE transistor is turned off and the other pin remains
connected to the power supply voltage over a pull-up resistor of
high resistance.

• Port 0 − The P0 (zero) port is characterized by two functions −

• When the external memory is used then the lower


address byte (addresses A0A7) is applied on it, else all bits of
this port are configured as input/output.

• When P0 port is configured as an output then other ports


consisting of pins with built-in pull-up resistor connected by
its end to 5V power supply, the pins of this port have this
resistor left out.
Port 0 as Input : With resistors connected to port 0, in order to
make it an input, the port must be programmed by writing 1 to all
the bits. In the following code, port 0 is configured first as an input
port by writing 1’s to it,
and then data is received from the port and sent
to P1.

MOV A,#0FFH ; A = FF hex


MOV P0,A ; make P0 an input port
BACK: MOV A,P0 ;get data from P0
MOV P1,A ;send it to port 1
SJMP BACK

Dual role of port 0: Port 0 is also designated as AD0-AD7, allowing


it to be used for both address and data. When connecting an
8051/31 to an external memory, port 0 provides both address
and data. The 8051 multiplexes address and data through port 0
to save pins. ALE indicates if P0 has address or data. When ALE =
0, it provides data D0-D7, but when ALE =1 it has address and
data with the help of a 74LS373 latch.
Port 1: Port 1 occupies a total of 8 pins (pins 1 through 8). It can
be used as input or output. In contrast to port 0, this port does not
need any pull-up resistors since it already has pull-up resistors
internally. Upon reset, Port 1 is configured as an output port.
For example, the following code will
continuously send out to port1 the alternating values
55h & AAh

MOV A,#55H ; A = 55 hex


BACK: MOV P1,A ;send it to Port 1
ACALL DELAY ;call delay routine
CPL A ;make A=0
SJMP BACK

Port 1 as input: To make port1 an input port, it must programmed


as such by writing 1 to all its bits. In the following code port1 is
configured first as an input port by writing 1’s to it, then data is
received from the port and
saved in R7 ,R6 &
R5.

MOV A,#0FFH ;A=FF HEX


MOV P1,A ;make P1 an input port by writing all 1’s to it
MOV A,P1 ;get data from P1
MOV R7,A ;save it in register R7
ACALL DELAY ;wait
MOV A,P1 ;get another data from P1
MOV R6,A ;save it in register R6
ACALL DELAY ;wait
MOV A,P1 ;get another data from P1
MOV R5,A ;save it in register R5
Port 2 : Port 2 occupies a total of 8 pins (pins 21- 28). It can
be used as input or output. Just like P1, P2 does not need any
pull-up resistors since it already has pull-up resistors
internally. Upon reset,Port 2 is configured as an output port.
For example, the following code will send out continuously
to port 2 the alternating values 55h and AAH.
That is all the bits of port 2 toggle
continuously.

MOV A,#55H ; A = 55 hex


BACK: MOV P2,A ;send it to Port 2
ACALL DELAY ;call delay routine
CPL A ;make A=0
SJMP BACK

Port 2 as input : To make port 2 an input, it must programmed


as such by writing 1 to all its bits. In the following code, port 2
is configured first as an input port by writing 1’s to it. Then
data is received from
that port and is sent to P1
continuously.

MOV A,#0FFH ;A=FF hex


MOV P2,A ;make P2 an input port by writing all 1’s to
it
BACK: MOV A,P2 ;get data from P2
MOV P1,A ;send it to Port1
SJMP BACK ;keep doing that
Dual role of port 2 : In systems based on the 8751,
8951, and DS5000, P2 is used as simple I/O. However, in
8031-based systems, port 2 must be used along with P0 to
provide the 16-bit address for the external memory. As
shown in pin configuration 8051, port 2 is also designed as
A8-A15, indicating the dual function. Since an 8031 is capable
of accessing 64K bytes of external memory, it needs a path
for the 16 bits of the address. While P0 provides the lower 8
bits via A0-A7, it is the job of P2 to provide bits A8-A15 of
the address. In other words, when 8031 is connected to
external memory, P2 is used for the upper 8 bits of the 16
bit address, and it cannot be used for
I/O.

Port 3 : Port 3 occupies a total of 8 pins, pins 10 through 17. It


can be used as input or output. P3 does not need any pull-up
resistors, the same as P1 and P2 did not. Although port 3 is
configured as an output port upon reset. Port 3 has the
additional function of providing some extremely important
signals such as interrupts. This information applies both
8051 and 8031 chips.
8051 Microcontroller Interrupt

The timer and serial interrupts are internally generated by the


microcontroller whereas, the external interrupts are generated by
additional peripheral devices or switches that are connected to the
microcontroller externally. There are two types of external interrupts:
edge-triggered and level-triggered. The interrupt service routine is carried
out by the microcontroller as a reaction to an interrupt, enabling
memory locations to coincide with interrupts.

Interrupt structure of 8051 Microcontroller

All of the interrupts are disabled by "RESET" thus software is required to


enable all of these interrupts. If any one of these five interrupts or all five
are activated, the relevant interrupt flags are set. The priority, which is
managed by the IP interrupt priority register, determines which of
these interrupts can be set or
cleared bit by bit in a specific function register that is Interrupt
Enabled (IE).
Two SFRs controls the function of interrupts in 8051 microcontrollers. IE
is Responsible for disable/enable the function and IP is Responsible for
priority assignment: The priority list offers 3 levels of interrupt priority:
Reset: When a reset request arrives, everything is stopped and the
microcontroller restarts. Reset can be used to disable the interrupt
priority 1. Interrupt priority 0 can be
disabled by both Reset and
interrupt.

Some of the registers used in this microcontroller are :

• IE (Interrupt Enable) Register

• IP (Interrupt Priority) Register

• TCON (Timer Control) Register

IE (Interrupt Enable) Register

Interrupts can be enabled and disabled using IE Register. It is a


register in the
8051 microcontroller that controls interrupt prioritization and
triggering. It includes many bits, such as:

EA-Global Interrupt Enable/Disable - When it is set it enables all


interrupt, if cleared disables all interrupts

• 0- Disables all interrupt requests

• 1- Enables all interrupt requests

ES (Serial Communication Interrupt Enable)- This bit enables or


disables the interrupt for serial communication.

• 1- Interrupt is enabled by UART system

• 0-Interrupt cannot be generated by UART system


ET0- Bit enables or disables timer 0 interrupt.

1-Timer 0 is enables an interrupt

0-Interrupt cannot be generated by the timer 0

ET1- Bit enables or disables timer 1 interrupt.

1- Interrupt is enabled by timer 1

0-Interrupt is disabled by timer 1

EX0 and EX1 (External Interrupt 0 and External Interrupt 1 Enable)

These bits control the interrupts from external devices.

EX0 - bit enables or disables external 0 interrupt: 0 - change of the INT1


pin logic state cannot generate an interrupt and 1 - enables an external
interrupt on the
pin INT1 state change.

EX1 - bit enables or disables external 1 interrupt: 0 - change of the pin


INT0 logic state cannot generate an interrupt and 1 - enables an
external interrupt on the
pin INT0 state change.

IT0 and IT1 (External Interrupt 0 and External Interrupt 1 Type)-


These bits
determine the type of trigger for external interrupts (level or edge-
triggered).
IP (Interrupt Priority) Register

One cannot predict when one may receive an interrupt request. If


multiple interrupts are enabled, it can happen that a request for another
interrupt is made while the first one is ongoing. There is a priority list
that tells the microcontroller what to do in order to determine whether
to respond to a new interrupt request or to carry on with existing
operations. The microcontroller restarts once everything stops in
response to a reset request. Only Reset has the ability to disable
Interrupt priority 1. Both Reset and interrupt priority 1 have the ability
to disable interrupt priority 0. The interrupt priority register, or IP
Register, indicates which of the current interrupt sources is more
significant than other. The program's start typically defines the
interrupt priority. An interrupt will be immediately paused and given
preference over any other interrupt if the one with greater priority
comes while the other is still in progress. Whenever two interrupt
requests that have different priorities occurs simultaneously, the higher
priority interrupt is handled first. If two interrupt requests with the
same priority level arise one after the other, the subsequent request
needs to wait until the entire
process is
accomplished.

Bit0 (PX0)- External0 interrupt


priority bit

• 0- Sets low priority to external 0 interrupt

• 1- Sets high priority to external 0


interrupt

Bit1 (PT0)- Timer 0 interrupt


priority bit

• 0- Assigns low priority to Timer0


interrupt

• 1- Assigns high priority to Timer0


interrupt
Bit2 (PX1)- External1 interrupt priority bit

• 0- Sets low priority to external1 interrupt

• 1- Sets high priority to external1 interrupt


Bit3 (PT1)- Timer1 interrupt priority bit

• 0- Sets low priority to timer1 interrupt

• 1- Sets high priority to timer1 interrupt

Bit4 (PS)- Serial Input priority bit

• 0- Assigns low priority to serial interrupt

• 1- Assigns high priority to serial interrupt

Bit 5,6 & 7- These bits are called as the Reserved bits.

TCON (Timer Control) Register

The interruptions that the microcontroller interfaces with (external)


devices are known as external interrupts. They are received by the
controller's INTx pins. These may be triggered by edges or levels.
Interrupt is enabled for a low at the INTx pin when it is level triggered,
and for a high to low transition at the INTx pin when it is edge
triggered. The TCON register determines whether the triggering is
edge or level trigger. The INTx pin for a level trigger interrupt needs to
remain low until the interrupt begins and needs to go back to high prior
to the interrupt terminating. An interrupt won't be produced if the low at
the INTx pin rises to a high value before the ISR begins. Additionally, the
interrupt will be created once more if the INTx pin is low even after the
ISR has ended. The level trigger interrupt (low) at the INTx pin must
therefore be four machine cycles long, neither longer nor shorter than
this.

• IE0- External interrupt 0 edge flag- When an external interrupt edge is


detected, hardware sets it. Cleared by the device upon processing the
interrupt.
• IE1- External interrupt 1 edge flag-Set by hardware when external
interrupt edge is detected. Cleared by hardware when the interrupt is
processed.

• TF0- Timer 0 overflow flag-This bit is set whenever timer 0


overflows and is processed by the hardware.

• TF1- Timer 1 overflow flag - This bit is set whenever timer 1


overflows and is processed by the hardware.

• TR0- Timer 0 Run Control- Set this bit to start Timer 0 and clear it to
stop the timer. This is important because the timer needs to be running
for it to generate interrupts.

• TR1 Timer 1 Run Control - Similar to TR0, this bit controls the running
state of
Timer 1.

• IT0- Interrupt 0 type control bit- Set/cleared by the device or software to


indicate falling edge/low-level triggered external interrupts.

• IT1- Interrupt 1 type control bit- Set/cleared by the device or software to


indicate falling edge/low-level triggered external interrupts. Whenever
the IT0 and IT1 bits are set, the external interrupts 0 and 1 edge-
triggered respectively. These bits are cleared by default, which causes
the external interrupt to be level triggered.
PART A
1. Define Embedded System. What are the components of
embedded system? (C01, K1)

An Embedded system is one that has computer hardware with


software embedded in it as one of its most important component. The
three main components of an embedded system are (i) Hardware
(ii) Main application software (iii) RTOS

2. What are the types of embedded system? (C01, K1)


Small scale embedded systems Medium scale embedded
Sophisticated embedded systems
[Link] some of the hardware parts of embedded systems. (C01,
K1)
Power source
Clock oscillator circuit Timers
Memory units DAC and ADC
LCD and LED displays Keyboard/Keypad

4. Classify the processors in embedded system. (C01, K1)

a. General purpose processor


Microprocessor
Microcontroller, Embedded processor,
Digital signal processor,
Media
processor
b. Application specific system processor
c. Multiprocessor system using GPP and ASSP GPP core or ASIP core
integrated into either an ASIC or a VLSI circuit or an FPGA core
integrated with processor unit in a VLSI chip.
5. What is 8-bit
Microcontroller ?
An 8-bit microcontroller is one with a data word length of 8 bits. The
number of bits that a microprocessor can process at once is referred to as its
word length or word size.

6. What do you understand about


Microprocessor:
A CPU built into a single VLSI chip is called a
microprocessor.
It is a general-purpose device and additional external circuitry is added to
make it a microcomputer.

7. Can you Justify why memory is


important?
For operation Micro-controller required a program. This program guides the
microcontroller to perform the specific tasks. This program installed in
microcontroller required some on chip memory for the storage of the
program.

8. What are the two types of bus used in 8051


microcontroller? Address Bus
Data
Bus

[Link] is Address
Bus?
•The 16-bit address bus is a component of 8051 microcontrollers. Transferring
data from
the central processing unit to memory is its
usual use.

[Link] Data
bus?
The data bus of an 8051 microcontroller has eight bits. Transferring data
from one peripheral place to another is often the usage for it.

[Link] do you know about


Oscillator?
It requires a timer to function because the microcontroller is a digital device.
An on-chip oscillator is externally linked or connected for the microcontroller
to execute timer functions. An embedded system is used a microcontroller to
control device functionality.
12. Mention some Applications of 8051
MicroControllers the following industries uses
the 8051 microcontroller.
•Industrial Automation: the 8051 microcontroller is used in the Robotics
and control systems.
•Consumer electronics: the microwave ovens, remote controllers is worked
using 8051 microcontroller.
•Automotive: Dashboard screens and engine control devices.

[Link] is Instruction Set


A microcontroller consists of a processor with an instruction set,
these are just machine-level instructions that when processed have a
direct effect on the microcontroller. This is what makes these instructions
the building blocks in writing software that interacts with hardware, and are
important for embedded systems.

14. What are the different Types for Data Processing Instructions
[Link] instructions
[Link] instructions
[Link] instructions
[Link] instructions
[Link] instructions

[Link] Logical Instruction with its syntax?


Logical instructions perform bitwise logical operations on the two
source registers. Syntax: <instruction>{<cond>} {S} Rd, Rn, N
Mention some Advantages of Instruction sets of a microcontroller
•Efficiency: An architectures such as that of ARM uses Reduced instruction
sets (RISC)
that facilitates fast and efficient operations.
•Low Power Consumption: Power consumption is typically very important in
embedded systems and therefore the system has been designed with
optimum power use in mind.
•Versatility: Different forms of instructions are possible to accomplish a
number of operations.
[Link] is the need of Port 2
P2 is similar to P0 when the external memory is used. Pins of this port occupy
addresses intended for the external memory chip. This port can be used for
higher address byte with addresses A8-A15. When no memory is added then
this port can be used as a general input/output port similar to Port 1.

[Link] Programming Parallel Ports


8051 microcontrollers have 4 I/O ports each of 8-bit, which can be configured
as input or output. Hence, total 32 input/output pins allow the microcontroller
to be connected with the peripheral devices.

18. What are the There are two types of external interrupts: edge-triggered
and level- triggered. The interrupt service routine is carried out by the
microcontroller as a reaction to an interrupt, enabling memory locations to
coincide with interrupts.

19. What is TCON (Timer Control) Register?

The interruptions that the microcontroller interfaces with (external) devices are
known as external interrupts. They are received by the controller's INTx
pins. These may be triggered by edges or levels.

20. What are the Different 8051 microcontroller


interrupt types: Let's look at the 8051 microcontroller's
five interrupt sources:
•Timer 0 overflow interrupt (TF0)
•Timer 1 overflow interrupt (TF1)
•External hardware interrupt (INT0)
•External hardware interrupt (INT1)
•Serial communication interrupt (RI/TI)

•21. List out some of the features of the 8051?


•ROM - 4K bytes RAM - 128 bytes Timer - 2 no I/O Pins - 32 Serial Port - 1
Interrupt sources – 6
22. What is the difference between timer and counter of
microcontroller?
Timer counts internal clock cycles while counter counts
external events

23. Mention what the difference between a microprocessor and a


microcontroller is?
The Microcontroller has integrated I/O, memory, etc., and was
expressly created for control, whereas the microprocessor manages
resources (I/O, memory) outside its architecture.

24. What are the main components of a


microcontroller?

Generally speaking, a microcontroller includes one or more of the


following:

•Input/output
ports;

•Central Processing Unit


(CPU).

•Read-Only Memory
(ROM);

•Counters and
Timers

•Random Access Memory


(RAM);

•Disruption
controls;

•Digital analog converters, analog to digital converters, serial interface


ports, and
oscillatory
circuits

25. Mention a few applications of a


microcontroller?
The voltmeter, ammeter, hand-held metering system, and measuring
rotating objects all employ microcontrollers. Devices for controlling
and sensing light employ microcontrollers. Microcontrollers are
utilized in washing machines,
cameras, and mobile
phone
26. What is an
ALU?
The group of circuit that provides timing and signals to all operation in
the computer and controls data flow

27. Why are the program counter and the stack pointer 16-bit registers?
Memory locations for the program counter and stack pointer have 16-
dit address. So the PC and SP have 16-bit registers.

28. TCON (Timer Control)


Register

A "TCON" (Timer Control) register is a special function register (SFR) in a


microcontroller, typically used to control the operation of timers within
the device, including starting and stopping timers, as well as indicating
when a timer has overflowed (reached its maximum count) through flag
bits

29. What is Timer 0


(T0) ?
Timer 0 is one of the main timers/counters in the 8051 microcontroller,
used for doing timing operations and counting events. It is
divided into two 8- bit registers they are TL0 (Timer 0 Low byte) and
TH0 (Timer 0 High byte). By combining both, these form a 16-bit
timer/counter.

30. What is Counter


Mode ?
The Modes which are used to count the number of events or pulses that
are happening outside the microcontroller are known as Counter modes.
PART B

1. Discuss in detail about the structural units in embedded processor.


[CO1, K2]

2. Explain briefly about 8051 Micro controller architecture . [CO1, K2]

3. Distinguish between Microprocessor and Microcontroller. [CO1, K2]

4. Discuss about PIN Diagram of 8051 Microcontroller with neat


diagram[CO1, K2]

5. Summarize Programming Parallel Ports with its types?[CO1, K2]

6. With suitable examples Explain 8051 Microcontroller Interrupt and


Interrup
Structure[CO1, K2]

7. Draw the 8051 Micro controller architecture diagram and explain in


detail. [CO1, K2]

8. What is Instruction Set? Explain the Types for Data Processing


Instructions in detail[CO1, K2]

9. Explain the design process of Embedded system. [CO1, K2]

10. Explain how CAN controller is useful in automotive applications. [CO1,


K2]

11. With a block diagram explain Interrupt structure of 8051


Microcontroller in detail. [CO1, K2]

12. Explain in brief about TCON (Timer Control) Register. [CO1, K2]

13. Explain Arthimetic Instructions and Logical Instructions in detail. [CO1,


K2]

14. Explain the different phases of Interrupt Handling in 8051


Microcontroller. [CO1, K2]

15. Explain in detail about Applications, Advantages and


Disadvantages in microcontroller. [CO1, K2]

You might also like