Professional Documents
Culture Documents
Tma2 Eex4436
Tma2 Eex4436
Tma2 Eex4436
By
Submitted to
Department of Electrical and Computer Engineering
Faculty of Engineering Technology
At
Colombo Regional Center
On
01/09/2023.
[Q1]
(a)
Rotation Speed
Rotation Angle
Mechanisms
Motor Type
Application
Techniques
parameters
Interfacing
Direction
Rotation
Control
Other
H-bridge By using
circuit, an By
PWM, H- By Voltage,
DC Robotics, motor encoder regulating
bridge reversing current,
Motor toys, fans driver ICs or a supply
circuit polarity torque
(L293D potentiom voltage
or L298) eter
PWM PWM, By
By
signal to closed- varying
Robotics, varying
control loop the PWM Using the
toys, the PWM Voltage,
Servo wire, control signal duration
remote signal current,
Motor motor system sent to of the
control sent to the torque
driver ICs with the pulse
vehicles control
(L293D positional control
wire
or L298) feedback wire
By
altering By
By
Motor Full-step the varying
Printers, varying
driver ICs drive, sequence the
CNC the Voltage,
Stepper (ULN200 half-step in which number
machines, frequency current,
Motor 3A), H- drive and the of input
hard of the step angle
bridge microstep motor’s pulses
drives input
circuit ping windings sent to
pulses
are the motor
energized
By
By
Electroni PWM, altering
varying
c speed closed- the By using
Drones, the
controller loop sequence an
electric frequency Voltage,
BLDC (ESC), control in which encoder
vehicles, of the current,
motor motor system the or a
HVAC input torque
driver ICs with motor’s potentiom
systems pulses
(L6234 or positional windings eter
sent to the
L293D) feedback are
motor
energized
By
Industrial
Variable swapping By
machiner
frequency any two varying
AC y and VFD or Cannot be Voltage,
drive of its the
Inductio appliance inverter precisely current,
(VFD) or phase frequency
n Motor s such as drive. controlled frequency
inverter connectio of the AC
pumps
drive. ns (For 3- supply
and fans.
phase)
(b) Current limiting resistors: These are used to limit the current flowing through the motor and
prevent damage to the microcontroller’s output pins. The value of the resistor is chosen based on
the maximum current rating of the microcontroller’s output pin and the motor’s current
requirement.
Fly-back diodes: These are used to protect the microcontroller from voltage spikes generated by
the motor when it is turned off. The fly-back diode is connected in parallel with the motor, with
its cathode connected to the positive terminal of the motor and its anode connected to the negative
terminal.
Optocouplers: These are used to electrically isolate the microcontroller from the motor circuit.
The optocoupler has an LED on one side and a phototransistor on the other. When a signal is sent
from the microcontroller to the LED, it turns on and causes the phototransistor to conduct,
allowing current to flow through the motor circuit.
Motor driver ICs: These are used to amplify the control signals from the microcontroller and
provide sufficient current to drive the motor. Motor driver ICs such as L293D or L298 have built-
in protection mechanisms such as thermal shutdown and short-circuit protection.
ORG 0H
MAIN:
MOV P1, #08H ; Step 1
ACALL DELAY
MOV P1, #04H ; Step 2
ACALL DELAY
MOV P1, #02H ; Step 3
ACALL DELAY
MOV P1, #01H ; Step 4
ACALL DELAY
SJMP MAIN
DELAY:
MOV R0, #FFH
DJNZ R0, DELAY
RET ; Return from subroutine
Direction – Anti-Clockwise:
ORG 0H
MAIN:
MOV P1, #01H ; Step 1
ACALL DELAY
MOV P1, #02H ; Step 2
ACALL DELAY
MOV P1, #04H ; Step 3
ACALL DELAY
MOV P1, #08H ; Step 4
ACALL DELAY
SJMP MAIN
DELAY:
MOV R0, #FFH
DJNZ R0, DELAY
RET ; Return from subroutine
Speed:
ORG 0H
MOV A, #066H ; load step sequence
BACK:
MOV P1, A ; issue sequence to motor
RR A ; rotate right clockwise
ACALL DELAY
SJMP BACK
DELAY:
MOV R2, #100
H1: MOV R3, #255
H2: DJNZ R3, H2
DJNZ R2, H1
RET
END
; Initialize timer 0
MOV TMOD, #00000010B ; Set timer 0 mode to 8-bit auto-reload
MOV TH0, #0FFH - PWM_PERIOD + 1 ; Set timer 0 reload value
SETB TR0 ; Start timer 0
MAIN:
; Stage 1: Full speed
MOV R7, #255 - PWM_PERIOD ; Set duty cycle to 100%
ACALL DELAY
SJMP MAIN
SKIP_PWM_ON:
SETB P1.0 ; Turn off PWM output
MOV TL0, #0FFH - PWM_PERIOD + R7 + 1 ; Set timer 0 compare value for PWM
ontime
TIMER0_ISR_EXIT:
CLR TF0 ; Clear timer 0 overflow flag
RETI ; Return from interrupt
(II) For DC motors, PWM is used to control the speed of the motor. The average voltage applied
to the motor is controlled by varying the duty cycle of the PWM signal. A higher duty cycle
results in a higher average voltage and a faster motor speed, while a lower duty cycle results
in a lower average voltage and a slower motor speed. The frequency of the PWM signal for
DC motors is typically in the range of a few kHz.
For servo motors, PWM is used to control the position of the motor. Servo motors have an
internal feedback mechanism that allows them to rotate to a specific angle based on the width
of the input PWM pulse. The pulse width determines the position of the servo, with a longer
pulse width resulting in a larger angle of rotation. The frequency of the PWM signal for servo
motors is typically around 50Hz.
[Q2]
(a) The SOC signal is used to initiate the conversion process in the A/D converter. When the
microcontroller sends a pulse to the SOC pin, the A/D converter starts converting the analog input
voltage (Vin) into a digital value.
The EOC signal is used to indicate when the conversion process is complete. When the conversion
is finished, the A/D converter sends a pulse to the EOC pin to notify the microcontroller that the
digital output value is ready to be read.
(b) The reference voltage provided by the 4-bit DAC determines the range of input voltages that can
be accurately measured by the A/D converter. If the reference voltage is too low, then input
voltages above the reference voltage will be clipped and cannot be accurately measured. If the
reference voltage is too high, then the resolution of the A/D converter will be reduced, and small
changes in the input voltage may not be accurately detected. Therefore, it is important to choose
an appropriate reference voltage to ensure accurate A/D conversion.
(c) After the A/D conversion process is complete and the EOC signal is received by the
microcontroller, the microcontroller can read the digital output value from the A/D converter.
This value can then be stored in external data memory for later use. The specific method for
capturing and storing data in external data memory will depend on the specific microcontroller
and memory devices being used.
In the case of a 2K x 8 external data memory, the memory is organized as 2K (2048) locations,
each capable of storing 8 bits of data. The microcontroller can write the digital output value from
the ADC to a specific location in the external data memory by sending the appropriate address
and data signals to the memory device.
(d)
Set sample Send SOC Wait for EOC
Start
counter to 0 pulse to ADC pulse from ADC
Is sample
counter
<200? Yes
No
End
[Q3]
(a)
Memory Use and Access
Type Characteristics Reference link
Type Purpose Time
Rom
- Mask ROM Video games,
Non-volatile
Industrial https://www.velocenetwo
memory,
control Non- rk.com/tech/what-is-
Fast Reliable, High-
systems, erasable mask-
density, Low-
Automotive rom/#google_vignette
cost, Permanent
electronics
-OTP ROM Storing a few
bits of
authentication
One-
information,
time
calibration or Non-volatile https://en.wikipedia.org/w
Fast program
even firmware memory iki/Programmable_ROM
mable
for today's
NVM
system-on-
chip (SoC)
designs
-PROM Non-
Cell phones,
volatile
video game
memory
consoles, https://www.javatpoint.co
Slow (one Permanent
RFID labels, m/prom-full-form
time
medical
program
devices
mable)
-EPROM Some
microcontroll
ers, from
before the era
of EEPROMs Non-
https://en.wikipedia.org/w
and flash Slow volatile Erasable
iki/EPROM
memory, use memory
an on-chip
EPROM to
store their
program
-EEPROM https://www.techtarget.co
m/whatis/definition/EEPR
Used to store OM-electrically-erasable-
small amounts programmable-read-only-
of data in Non- Electrically memory#:~:text=EEPRO
computing Slow volatile erasable, M%20(electrically%20era
and other memory Reprogrammable sable%20programmable%
electronic 20read%2Donly%20mem
devices ory)%20is%20a,that%20i
s%20higher%20than%20
normal.
-Flash Used for https://www.techtarget.co
Electrically
Memory storage and Non- m/searchstorage/definitio
erasable,
data transfer Fast volatile n/flash-
Reprogrammable
in consumer memory memory#:~:text=Flash%2
, High-density
devices, 0memory%2C%20also%
enterprise 20known%20as,enterpris
systems and e%20systems%20and%20
industrial industrial%20applications
applications .
RAM
-SRAM Industrial and
scientific Good
https://en.wikipedia.org/w
subsystems, Volatile performance and
Fast iki/Static_random-
automotive memory reliability, Less-
access_memory
electronics, in density
computers,
-DRAM Used as main Slow
Volatile High-density, https://beebom.com/what-
memory of than
memory cheaper is-dram/
computer SRAM
-SDRAM Widely used
in computers Uses one edge of https://ecomputernotes.co
and other Volatile the clock, sends m/fundamental/input-
Fast
computing memory signals once per output-and-
related clock cycle memory/sdram
technology
-P-SRAM Smartphones
and Tablets,
Low power
Wearables, https://en.wikipedia.org/w
Volatile consumption,
storing critical Fast iki/Dynamic_random-
memory High
data of access_memory#PSRAM
performance
various
applications
-NV RAM Used to
storing
configuration
settings, Non- Random Access, https://en.wikipedia.org/w
system Fast volatile Endurance, iki/Non-volatile_random-
parameters, memory power-efficient access_memory
and other
critical
information
-MRAM Storage Magnetic
devices, Storage, Fast
automotive Non- Read and Write https://en.wikipedia.org/w
electronics, Fast volatile Speeds, Low iki/Magnetoresistive_RA
industrial memory Power M
control Consumption,
systems Rad-Hardness
XRAM Robotics,
industrial Separates from
automation, Slow the main https://www.atpinc.com/b
Volatile
and other than processing unit, log/computer-memory-
memory
memory- IRAM various types-dram-ram-module
intensive capacities
applications
IRAM Used to store
data and
Volatile On-Chip https://en.wikipedia.org/w
variables Fast
memory Memory iki/Internal_RAM
temporarily
during
program
execution
(b) Assume that the external RAM is connected to the 8051 microcontroller using the standard
memory interface, with the address lines A0-A7 connected to port 2 and the data lines D0-D7
connected to port 0.
Assume that the external ROM is connected to the 8051 microcontroller using the standard
memory interface, with the address lines A8-A15 connected to port 3 and the data lines D0-D7
connected to port 0.
; Define constants for the base addresses of the internal and external memory.
INT_RAM_BASE EQU 30H
EXT_RAM_BASE EQU 8000H
INT_ROM_BASE EQU 0000H
EXT_ROM_BASE EQU F000H
(d)
Address Range
Memory Type Chip Number Address Lines
(Hex)
00000 - 03FFF ROM 1 A0 - A14
04000 - 07FFF ROM 2 A0 - A14
08000 - 0BFFF ROM 3 A0 - A14
0C000 - 0FFFF ROM 4 A0 - A14
10000 - 13FFF ROM 5 A0 - A14
14000 - 17FFF ROM 6 A0 - A14
18000 - 1BFFF ROM 7 A0 - A14
1C000 - 1FFFF ROM 8 A0 - A14
20000 - 2FFFF RAM 1 A0 - A15
30000 - 3FFFF RAM 2 A0 - A15
[Q4]
(a) In the 8051 microcontroller, there are six interrupt sources, each with its own interrupt vector and
priority level. The interrupt sources are:
System RESET (RST)
External Interrupt 0 (IE0)
Timer 0 Interrupt (TF0)
External Interrupt 1 (IE1)
Timer 1 Interrupt (TF1)
Serial Port Interrupt (RI/TI)
The priority level of each interrupt source can be set using the IP (Interrupt Priority) register. The
IP register is a bit-addressable register, with each bit corresponding to the priority level of one of
the interrupt sources. Setting a bit in the IP register to 1 gives the corresponding interrupt source
a high priority, while setting it to 0 gives it a low priority.
Here is an example Assembly Language Program (ALP) code that demonstrates how to set the
priority levels of the interrupt sources and handle multiple interrupts within a program:
; Enable interrupts.
SETB EA
(b) ; Set up the serial port for 9-bit data, 1 stop bit, and no parity.
MOV SCON, #11010000B
END
(c) ; Set up the serial port for 9-bit data, 1 stop bit, and no parity.
MOV SCON, #11010000B
MAIN:
; Do something in the main program loop.
SJMP MAIN
RETI
[Q5]
(a)
(I) For weight measurement of an object, a suitable device for interfacing with the 8051
microcontroller would be a load cell. A load cell is a type of transducer that converts force
or weight into an electrical signal. The electrical signal can then be read by the
microcontroller and converted into a weight measurement. Load cells are commonly used
in scales and other weight measurement devices, and they come in a variety of shapes and
sizes to fit different applications.
(II) To determine the presence of an object at a specific point, a suitable device for
interfacing with the 8051 microcontroller would be an infrared proximity sensor. An
infrared proximity sensor works by emitting infrared light and detecting the reflection of
the light off of nearby objects. If an object is present at the specific point, the sensor will
detect the reflection of the infrared light and send a signal to the microcontroller indicating
that an object is present.
(III) To verify if an object has reached its intended position, a suitable device for interfacing
with the 8051 microcontroller would be an optical encoder. An optical encoder is a type
of sensor that can detect the position and movement of an object by measuring changes in
light intensity. By attaching an optical encoder to the object and monitoring its output, the
microcontroller can determine if the object has reached its intended position.
(b)
• Load cell for weight measurement of an object:
The strain gauge load cell is connected to an amplifier, such as the HX711, which
amplifies the small signal from the load cell and converts it into a digital signal that can
be read by the microcontroller. The amplified signal is then sent to the 8051
microcontroller.
• Simple block diagram illustrating the process of interfacing an infrared proximity sensor
with the 8051 microcontroller:
Infrared 8051
Proximity Sensor Microcontroller
The infrared proximity sensor is connected to the 8051 microcontroller using standard
input/output pins.
• Simple block diagram illustrating the process of interfacing an optical encoder with the
8051 microcontroller:
Optical 8051
Encorder Microcontroller
The optical encoder is connected to the 8051 microcontroller using standard input/output
pins.
[Q5]
Puzzle parking systems are mechanical structures that can shuffle around multiple platforms that
act as individual parking spots for vehicles. This capability makes it possible to add parking spots
in the space above, or below the ground1. The primary electronic components within a puzzle
parking system include:
• Control Panel with PLC (Programmable Logic Controller) control system: The
control panel is the central unit that manages the operation of the puzzle parking system.
It receives input from various sensors and user interfaces, and uses a PLC control system
to control the movement of the parking platforms.
• Sensors: Sensors are used to detect the presence and position of vehicles on the parking
platforms. They provide feedback to the control panel, which uses this information to
control the movement of the platforms.
• User Interface: The user interface allows users to interact with the puzzle parking
system. It can include input devices such as keypads, card readers, or touch screens, which
allow users to enter their credentials and select their desired parking spot.
• Hydraulic Power Pack: The hydraulic power pack provides hydraulic power to drive
the movement of the parking platforms. It includes a hydraulic pump, which pressurizes
hydraulic fluid and sends it to hydraulic cylinders or motors that drive the movement of
the platforms.
OR
• Electric Motors and Motor Drivers: Electric motors are used to drive the movement of
the parking platforms. They provide a high level of precision and control, allowing for
smooth and accurate movement of the platforms.
Power
Supply
Hydraulic
Sensors Power Pack
Control OR
Panel
User Electric
Interface Motors