0% found this document useful (0 votes)
9 views

Embedded Systems Assignment 2

The document discusses the 8051 microcontroller and its features including 6 interrupts, 16-bit timers, 32 I/O lines through 4 ports, and pin configuration. It also discusses interrupts, the oscillator, memory, and provides two case studies - one for a washing machine and one for an anti-lock braking system. Embedded C programs are provided to interface an 8051 microcontroller with a stepper motor to rotate it in different sequences using switches.

Uploaded by

ramrevolt55
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Embedded Systems Assignment 2

The document discusses the 8051 microcontroller and its features including 6 interrupts, 16-bit timers, 32 I/O lines through 4 ports, and pin configuration. It also discusses interrupts, the oscillator, memory, and provides two case studies - one for a washing machine and one for an anti-lock braking system. Embedded C programs are provided to interface an 8051 microcontroller with a stepper motor to rotate it in different sequences using switches.

Uploaded by

ramrevolt55
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Embedded Systems

Assignment 2
S Raguraam
RVCE22BME036

The 8051 Microcontroller

Block Diagram of 8051 Microcontroller

8051 is a very popular microcontroller that is capable of real time control applications in
industry. It features 6 interrupts, 16 bit timers, and 32 I/O lines through 4 ports.
Pin Configuration of 8051 Microcontroller:
Pin 40 is Vcc Pin, Pin 20 is Ground Pin.
Pin 9 is RESET pin, which resets the microcontroller to initial state.
Pins 29 and 30 are used to connect to External Memory.
Pins 1 to 8 are Port 1 which is specifically
Input/output Port.
Pins 10 to 17 are Port 3, which has dual functionality
of I/O as well as Interrupt, Timer input, control
signals etc.
Pins 21 to 28 are Port 2, they provide both I/O
functionality as well as multiplexing of Higher order
address and data bus signals.
Pins 32 to 39 are Port 0, they provie I/O funcrionality
as well as Multiplexing of Lower order address and
data bus signals.
Interrupts
Interrupts are commands that change the state of the microcontroller. An interrupt
initiates a request to complete a specific task by the microcontroller before continuing
main program execution.
Interrupts are used to efficiently handle input/output from external devices, Timing
applications, Emergency situations, Multitasking, Real time or event driven
programming.
8051 features an Interrupt Priority register that can handle both serial and external
interrupts based on a priority list

Oscillator
8051 microcontroller features an on chip oscillator which connects to an external ceramic
crystal resonator through XTAL1 and XTAL2 pins.
The oscillator circuit provides clock signals that define machine cycle. Each machine
cycle take 12 clock cycles to execute. The instruction set of 8051 contains up to four
machine cycles.

Memory
8051 contains 4 Kbytes built in program memory with the option of connecting external
ROM.
8051 comes with 128 Bytes of general purpose internal RAM and 128 Bytes of Special
Function registers which include port latches, timer control, CPU registers, stack pointer,
accumulator etc.

Case Study: Washing Machine


A washing machine uses microcontroller or microprocessor based embedded system and
has Manual, Automatic and Semi-Automatic modes of operation.

1. In Manual mode, the user inputs desired parameters such as water volume,
temperature of water, washing and rinsing mode, soap quantity etc. The machine
performs these operations with input from Water level sensor, temperature probe etc. The
motor and gearbox assembly connected to the washing tub is driven by an electronic
speed controller which is controlled by microcontroller.

2. In Automatic Mode, the machine calculates the appropriate wash cycle, water
temperature and soap quantity using several sensors:
(a) Water level sensor: This sensor is used to measure the amount of water in the drum of the
washing machine. It can be used to adjust the water level as needed during the wash cycle, or to
alert the user if the water level is too low or too high.
(b) Temperature sensor: This sensor is used to measure the temperature of the water in the
drum. It can be used to maintain a consistent water temperature during the wash cycle, or to alert
the user if the temperature is too high or too low.
(c) Load sensor: This sensor is used to measure the weight of the clothes in the drum. It can be
used to adjust the wash cycle or the amount of water and detergent used, depending on the size of
the load.
(d) Door lock sensor: This sensor is used to detect when the door of the washing machine is
closed and locked. It is used to prevent the machine from starting if the door is not securely
closed.
(e) Vibration sensor: This sensor is used to detect when the washing machine is vibrating
excessively. It can be used to alert the user if there is a problem with the machine, such as an
unbalanced load or a malfunctioning component.

The Microcontroller in the washing machine controls various electromechanical actuators


to effectively wash clothes:
(a) Water inlet valve: This valve controls the flow of water into the washing machine. It is
opened and closed based on the wash cycle selected and the water level in the drum.
(b) Drain pump: This pump is used to remove the water from the washing machine at the end of
the wash cycle.
(c) Motor: The motor is the primary power source for the washing machine. It is responsible for
turning the drum and agitator, as well as operating the pump and other components of the
machine. It is driven by an Electronic Speed Controller or Motor driver circuit which is controlled
by the microcontroller.
(d) Agitator: The agitator is a device inside the drum that moves the clothes around during the
wash cycle. It helps to loosen dirt and stains from the clothes and promote the circulation of water
and detergent.
(e) Detergent dispenser: This device is used to dispense the appropriate amount of detergent
into the wash water. It is typically activated by the microprocessor in the embedded system, based
on the wash cycle selected and the size of the load.

Block Diagram of Embedded System in Washing Machine


Case Study: Anti-lock Braking System (ABS)
Anti-lock braking systems (ABS) are designed to help prevent the wheels of a car from
locking up when the brakes are applied suddenly or excessively. This can help the driver
maintain control of the vehicle and avoid skidding or sliding on slippery surfaces.
Block Diagram

Working
The ABS system works by constantly monitoring the speed of the wheels using sensors.
When the brakes are applied, the system compares the speed of the wheels to the speed of the
vehicle. If the wheels are about to lock up, the ABS system will automatically pulse the
brakes to help prevent them from locking.
Some of the common types of sensors used in ABS systems include:

(a) Wheel speed sensors: These sensors are used to measure the rotational speed of the
wheels. They are typically located near the hubs of the wheels, and they use magnetically-
induced pulses to measure the speed of the rotating wheel. The ABS system uses the data
from the wheel speed sensors to determine whether the wheels are about to lock up when the
brakes are applied.
(b) Brake pressure sensors: These sensors are used to measure the pressure being applied to
the brakes. They are typically located in the brake lines, and they use a pressure-sensitive
element to measure the brake pressure. The ABS system uses the data from the brake pressure
sensors to determine how hard the brakes are being applied.
(c) Steering angle sensor: This sensor is used to measure the angle of the steering wheel. It is
typically located in the steering column, and it uses a rotary potentiometer to measure the
angle of the wheel. The ABS system uses the data from the steering angle sensor to determine
the direction that the vehicle is turning.
(d) Yaw rate sensor: This sensor is used to measure the rotational rate of the vehicle around
its vertical axis. It is typically located in the center of the vehicle, and it uses a gyroscopic
element to measure the yaw rate. The ABS system uses the data from the yaw rate sensor to
determine the stability of the vehicle.

The braking system is controlled by a microcontroller, which receives input from the wheel
speed sensors and other sensors around the vehicle. When the computer detects that a wheel
is about to lock up, it sends a signal to a valve in the brake system. The valve then rapidly
opens and closes, allowing a small amount of brake fluid to flow through the system and
pulse the brakes. This causes the brake pads to rapidly release and re-apply pressure to the
rotors, helping to prevent the wheels from locking up.

Embedded C Programs
Embedded C program for 8051 stepper motor interface to rotate stepper
motor using switch connected to port 2.5
#include<reg51.h>
#define sequence1 0x01
#define sequence2 0x08
#define sequence3 0x04
#define sequence4 0x02

void delay(int);
void main()
{
unsigned char direction;
while(1) {
direction=P2;
direction=direction && 0x05;
if(direction==0x08)
{
P1=sequence1;
delay(2500);
P1=sequence2;
delay(2500);
P1=sequence3;
delay(2500);
P1=sequence4;
delay(2500);
}
else
{
P1=sequence4;
delay(2500);
P1=sequence3;
delay(2500);
P1=sequence2;
delay(2500);
P1=sequence1;
delay(2500);
}
}
void delay(int delayvalue)
{
int i;
for(i=0; i<delayvalue, i++);
}

Embedded C program for 8051 stepper motor interface to rotate stepper


motor in one direction continuously
#include<reg51.h>
#define sequence1 0x01
#define sequence2 0x08
#define sequence3 0x04
#define sequence4 0x02

void delay(int);
void main()

{
P1=sequence1;

delay(2500);
P1=sequence2;
delay(2500);
P1=sequence3;
delay(2500);
P1=sequence4;
delay(2500);
}
void delay(int delayvalue)
{
int i;
for(i=0; i<delayvalue, i++);
}

You might also like