Theory - Basic Electrical and Electronic Components
-
Upload
k-p-prasad-holla -
Category
Documents
-
view
220 -
download
0
Transcript of Theory - Basic Electrical and Electronic Components
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 1/150
Tuesday, July 10, 2012
WELCOME
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 2/150
Tuesday, July 10, 2012
BASIC ELECTRICAL AND
ELECTRONIC COMPONENTS
• RESISTORS
• DIODES
• CAPACITORS
• INDUCTORS
• TRANSISTORS
• BATTERY
• TRANSFORMER • VOLTAGE REGULATORS
• LDR (LIGHT DEPENDENT RESISTOR)
• RELAYS
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 3/150
Tuesday, July 10, 2012
The first band gives the first digit
The second band gives the second digit
The third band indicates the number of zeroes.
RESISTOR:
A resistor is a device which opposes the flow of
current.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 4/150
Tuesday, July 10, 2012
Colour Number
Black 0
Brown 1
Red 2
Orange 3 Yellow 4
Green 5
Blue 6
Violet 7
Grey 8
White 9
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 5/150
Tuesday, July 10, 2012
DIODE:
A Diode is a two terminal electronic component that
conducts electric current only in one direction.
Based on applications diodes are divided into two
types
-> PN junction
-> ZENER diode
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 6/150
Tuesday, July 10, 2012
PN junction diode:
The most common function of a diode is toallow an electric current in one direction (called
the forward direction) while blocking current in
the opposite direction (the reverse direction).
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 7/150
Tuesday, July 10, 2012
ZENER DIODE:
A Zener diode is a type of diode that permits current inthe forward direction like a normal diode, but also in the
reverse direction if the voltage is larger than the
breakdown voltage known as "Zener knee voltage" or
"Zener voltage".
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 8/150
Tuesday, July 10, 2012
LIGHT EMITTING DIODE (LED)
A light-emitting diode (LED) is a semiconductor light
source. LEDs are used as indicator lamps in many
devices, and are increasingly used for lighting.
k
A
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 9/150
Tuesday, July 10, 2012
capacitors easily pass AC (changing) signals.
capacitor block DC (constant) signals.
s
CAPACITOR:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 10/150
Tuesday, July 10, 2012
INDUCTOR:
• An inductor or a reactor can store energy in a
magnetic field created by the electric currentpassing through it. It is denoted in Henry.
• Typically an inductor is a conducting wire shaped
as a coil, the loops helping to create a strongmagnetic field inside the coil due to Faraday'sLaw of Induction.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 11/150
Tuesday, July 10, 2012
TRANSISTORS:
A transistor is a semi conductor device commonly used
to amplify or switch electronic signals. A voltage orcurrent applied to one pair of the transistor's terminals
changes the current flowing through another pair of
terminals. Because the controlled (output) power can be
much more than the controlling (input) power, the
transistor provides amplification of a signal.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 12/150
Tuesday, July 10, 2012
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 13/150
Tuesday, July 10, 2012
Transformer:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 14/150
Tuesday, July 10, 2012
VOLTAGE REGULATOR:
• A voltage regulator is an electrical regulator designed
to automatically maintain a constant voltage level.
• It may use an electromechanical mechanism, or passive or active electronic components. Depending
on the design, it may be used to regulate one or more
AC or DC voltages.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 15/150
Tuesday, July 10, 2012
The voltage regulators are classified into two types.
positive series(7805)
negative series(7905)
7805
I/P GND O/P
7805SERIES Output
voltage
7905
I/P O/PGND
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 16/150
Tuesday, July 10, 2012
Light Dependent Resistor (LDR):
An LDR is an input transducer (sensor)which converts brightness (light) to
resistance. It is made from cadmium
sulphide (CdS) and the resistance
decreases as the brightness of lightfalling on the LDR increases.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 17/150
Tuesday, July 10, 2012
RELAY:
A Relay is an electrically controllable switch widelyused in industrial controls, automobiles, etc…
inductor
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 18/150
Tuesday, July 10, 2012
OPERATION OF RELAY:
• The relay's switch connections are usually labeled COM,
NC and NO:• COM = Common, always connect to this, it is the
moving part of the switch.
• NC = Normally Closed, COM is connected to this whenthe relay coil is off.
• NO = Normally Open, COM is connected to this whenthe relay coil is on.
• Connect to COM and NO if you want the switchedcircuit to be on when the relay coil is on.
• Connect to COM and NC if you want the switchedcircuit to be on when the relay coil is off.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 19/150
Tuesday, July 10, 2012
N/C
COM
N/O
AC230V
BULB
I ND U C T OR
IRON
ARM
ON
OFF
Diagrammatic explanation:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 20/150
Tuesday, July 10, 2012
WINE YARDT E C H N O L O G I E S
REGULATED POWER SUPPLY:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 21/150
Tuesday, July 10, 2012
7812
7805
C1
C2
5V
12V
REGULATED POWER SUPPLY CIRCUIT:
C
C=1000uF C1,C2=104pF R1,R2=330
R
R2
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 22/150
Tuesday, July 10, 2012
RECTIFIER:
• The primary application of rectifiers is to derive usable
DC power from an AC supply. Virtually all electronics
except simple motor circuits such as fans require a DC
supply but mains power is AC so rectifiers find usesinside the power supplies of virtually all electronic
equipment.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 23/150
Tuesday, July 10, 2012
FILTERS:
• Electronic filters are electronic circuits which
perform signal processing functions, specifically toremove unwanted frequency components from thesignal, to enhance wanted ones, or both.
RECTIFIER
OUTPUT FILTER PURE DC
AC+DC DC
AC
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 24/150
Tuesday, July 10, 2012
How the Transistor act as a switch ?
what is a transistor?
A transistor is a semi conductor device commonlyused to amplify or switch electronic signals.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 25/150
Tuesday, July 10, 2012
What is a switch? In electronics, a switch is an electrical component
that can break an electrical circuit, interrupting
the current or diverting it from one conductor to
another.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 26/150
Tuesday, July 10, 2012
Transistor as a switch:
• Transistor can be used as an electronic switch, in
grounded-emitter configuration.
• Transistors are commonly used as electronic
switches, for both high power applicationsincluding switched mode power supply and low
power applications such as logic gates.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 27/150
Tuesday, July 10, 2012
• In a grounded-emitter transistor circuit, such as
the light-switch circuit shown, as the base voltage
rises the base and collector current rise
exponentially, and the collector voltage drops
because of the collector load resistor.
• If the emitter-base and base-collector are in
forward bias then it act as a switch.• At that instant the collector to emitter is shorted,
it act as a closed switch.
V
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 28/150
Tuesday, July 10, 2012
N/C
COM
N/O
LDR
100K
PRESET
Vcc
relay
330
LED
LIGHT VB<0.7V
T-OFF
NO
LIGHT
VB>0.7VT-ON
R
LOAD
Transistor as a switch
example
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 29/150
Tuesday, July 10, 2012
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 30/150
Tuesday, July 10, 2012
• In general, "embedded system" is not a strictly
definable term, as most systems have some element
of extensibility or programmability.
• For example, handheld computers share some
elements with embedded systems such as the
operating systems and microprocessors which power
them, but they allow different applications to be
loaded and peripherals to be connected or a few
dedicated functions", and is thus appropriate to call
"embedded".
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 31/150
Tuesday, July 10, 2012
• Moreover, even systems which don't expose
programmability as a primary feature generally
need to support software updates. On a continuum
from "general purpose" to "embedded", large
application systems will have subcomponents atmost points even if the system as a whole is
"designed to perform one or a few dedicated
functions", and is thus appropriate to call
"embedded".
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 32/150
Tuesday, July 10, 2012
Embedded system
• An embedded system is a special purpose computer
system designed to perform one or a few dedicatedfunctions, often with real time computing
constraints.
• It is usually embedded as part of a complete device
including hardware and mechanical parts.
• Since the embedded system is dedicated to specific
tasks, design engineers can optimize it, reducing the
size and cost of the product, or increasing thereliability and performance.
• Embedded systems span all aspects of modern life.
Ch i i
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 33/150
Tuesday, July 10, 2012
Characteristics:
• Embedded systems are designed to do some
specific task, rather than be a general-purposecomputer for multiple tasks.
• Embedded systems are not always standalone
devices. Many embedded systems consist of small, computerized parts within a larger device
that serves a more general purpose.
• The program instructions written for embedded
systems are referred to as firmware, and arestored in read-only memory or Flash memory
chips.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 34/150
Tuesday, July 10, 2012
Applications:
• Telecommunications• Consumer electronics like PDA’s, mp3 players,
mobile phones, digital cameras, DVD's, ovens,
washing machine, to control lights, to provide
security, climate, etc..
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 35/150
Tuesday, July 10, 2012
User Interface
• Embedded systems range from no user interface
at all — dedicated only to one task — to
complex graphical user interfaces that resemble
modern computer desktop operating systems.
• Simple embedded devices use buttons, LEDs,
graphic or character LCDs (for example popular
HD44780 LCD) with a simple menu system.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 36/150
Tuesday, July 10, 2012
• A more sophisticated devices use graphical
screen with touch sensing or screen-edge
buttons provide flexibility while minimizing space
used: the meaning of the buttons can change
with the screen, and selection involves the
natural behavior of pointing at what's desired.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 37/150
Tuesday, July 10, 2012
• Serial Communication Interfaces (SCI): RS-232,RS-422, RS-485 etc
• Synchronous Serial Communication Interface: I2C,
SPI, SSC and ESSI (Enhanced Synchronous Serial
Interface)
• Universal Serial Bus (USB)
• Multi Media Cards (SD Cards, Compact Flash etc)
Peripherals
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 38/150
Tuesday, July 10, 2012
• Networks: Ethernet, Controller Area Network,
LanWorks, etc
• Timers: PLL(s), Capture/Compare and Time
Processing Units
• Discrete IO: aka General Purpose Input/Output
(GPIO)
• Analog to Digital/Digital to Analog (ADC/DAC)
• Debugging: JTAG, ISP, ICSP, BDM Port, BITP DP9
port …
Peripherals
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 39/150
Tuesday, July 10, 2012
• Embedded system means the processor is embeddedinto that application.
• An embedded product uses a microprocessor or
microcontroller to do one task only.
• In an embedded system, there is only one applicationsoftware that is typically burned into ROM.
• Example: printer, keyboard, video game player.
Overview of Embedded System
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 40/150
Tuesday, July 10, 2012
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 41/150
Tuesday, July 10, 2012
Contents
IntroductionBlock Diagram and PinDescription of the 8051
I/O Port Description
Led InterfacingSwitch Interfacing
Led And switch Interfacing
LCD Interfacing
Serial communicationRelay Interfacing
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 42/150
Tuesday, July 10, 2012
Why do we need to learn
Microprocessors/controllers?
• The microprocessor is the core of computer
systems.
• Nowadays many communication, digital
entertainment, portable devices, are controlledby them.
• A designer should know what types of
components he needs, ways to reduce
production costs and product reliable.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 43/150
Tuesday, July 10, 2012
Aspects of a microprocessor/controller
• Hardware :
Interface to the real world. Ex- LCD, LED,printers, keyboard etc.
• Software :
order how to deal with inputs. By usingsoftware we can control the hardware to
obtain the desired outputs.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 44/150
Tuesday, July 10, 2012
Tools for a microprocessor/controller:
• CPU: Central Processing Unit
• I/O: Input /Output
• Bus: Address bus & Data bus
• Memory: RAM & ROM• Timer
• Interrupt
• Serial Port
• Parallel Port
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 45/150
Tuesday, July 10, 2012
CPU
General-
Purpose
Micro-
processor
RAM ROM I/O
PortTimer
Serial
COM
Port
Data Bus
Address Bus
General-Purpose Microprocessor System
• CPU for Computers.
• No RAM, ROM, I/O on CPU chip itself.
• Example: Intel's x86, Motorola’s 680x0.
Many chips on mother’s board
General-purpose microprocessor:
Microprocessors:
Microcontroller:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 46/150
Tuesday, July 10, 2012
RAM ROM
I/O
PortTimer
Serial
COM
PortMicrocontroller
CPU
• A smaller computer.
• On-chip RAM, ROM, I/O ports...• Example: Motorola’s 6811, Intel’s 8051, Zilog’s Z8 and
PIC 16X.
A single chip
Microcontroller:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 47/150
Tuesday, July 10, 2012
Microprocessor
• CPU is stand-alone,RAM, ROM, I/O,timer are separate
• designer can decideon the amount of ROM, RAM andI/O ports.
• Expansive,versatility.
• general-purpose
Microcontroller
• CPU, RAM, ROM, I/O
and timer are all on a
single chip
• fix amount of on-chipROM, RAM, I/O ports
• for applications inwhich cost, power and
space are critical
• single-purpose
Microprocessor vs Microcontroller
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 48/150
Tuesday, July 10, 2012
1. Meeting the computing needs of the task efficientlyand cost effectively
• speed, the amount of ROM and RAM, the numberof I/O ports and timers, size, packaging, power
consumption• easy to upgrade
• cost per unit
2. Availability of software development tools
• assemblers, debuggers, C compilers, emulator,simulator, technical support
3. Wide availability and reliable sources of themicrocontrollers.
Three criteria in Choosing a
Microcontroller:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 49/150
Tuesday, July 10, 2012
Block Diagram:
CPU
On-chip
RAM
On-chip
ROM for
program
code
4 I/O Ports
Timer 0
Serial
PortOSC
Interrupt
Control
External interrupts
Timer 1
Timer/Counter
Bus
Control
TxD RxDP0 P1 P2 P3
Address/Data
Counter
Inputs
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 50/150
Tuesday, July 10, 2012
Feature 8051 8052 8031
ROM (program space in bytes) 4K 8K 0K
RAM (bytes) 128 256 128
Timers 2 3 2
I/O pins 32 32 32Serial port 1 1 1
Interrupt sources 6 8 6
Comparison of the 8051 Family Members
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 51/150
Tuesday, July 10, 2012
4K Bytes On Chip ROM
128 bytes On Chip RAM
6 Interrupts
32 I/O channels
Bit Addressability
2 Timers
Features of 8051:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 52/150
Tuesday, July 10, 2012
Pin Description of the 8051:
1
23
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
40
3938
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
P1.0
P1.1P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
RST
(RXD)P3.0
(TXD)P3.1
(T0)P3.4
(T1)P3.5
XTAL2
XTAL1
GND
(INT0)P3.2
(INT1)P3.3
(RD)P3.7
(WR)P3.6
Vcc
P0.0(AD0)P0.1(AD1)
P0.2(AD2)
P0.3(AD3)
P0.4(AD4)
P0.5(AD5)
P0.6(AD6)
P0.7(AD7)
EA/VPP
ALE/PROG
PSENP2.7(A15)
P2.6(A14)
P2.5(A13)
P2.4(A12)
P2.3(A11)
P2.2(A10)
P2.1(A9)
P2.0(A8)
8051
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 53/150
Tuesday, July 10, 2012
8051 Description:
Vcc, gnd and xtal:
• Vcc pin 40
–Vcc provides supply voltage to the chip.
–The voltage source is +5V.
• GND: pin 20 ground
• XTAL1 and XTAL2 pins 19,18
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 54/150
Tuesday, July 10, 2012
8051 Description:
• Reset: pin 9 reset
– It is an input pin and is active high normally low .
• The high pulse must be high at least 2 machine
cycles. – It is a power-on reset.
• Upon applying a high pulse to RST, the
microcontroller will reset and all values in
registers will be lost.• Reset values of some 8051 registers
Figure (b). Power-On RESET Circuit:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 55/150
Tuesday, July 10, 2012
Figure (b). Power On RESET Circuit:
30 pF
30 pF
8.2 K
10 uF
+
Vcc
11.0592 MHz
EA/VPP
X1
X2
RST
31
19
18
9
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 56/150
Tuesday, July 10, 2012
Pins of 8051:
• EA: pin 31 external access – There is no on-chip ROM in 8031 and 8032 .
– The EA pin is connected to GND to indicate the
code is stored externally.
– PSEN ALE are used for external ROM.
– For 8051, EA pin is connected to Vcc.
• PSEN: pin 29 program store enable
– This is an output pin and is connected to the OE
pin of the ROM.
Pins of 8051:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 57/150
Tuesday, July 10, 2012
Pins of 8051:
• ALE: pin 30 address latch enable
– It is an output pin and is active high.
– 8051 port 0 provides both address and data.
– The ALE pin is used for de-multiplexing the
address and data by connecting to the G pin of the 74LS373 latch.
• I/O port pins
–
The four ports P0, P1, P2, and P3. – Each port uses 8 pins.
– All I/O pins are bi-directional.
Pi f I/O P t
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 58/150
Tuesday, July 10, 2012
Pins of I/O Port:
• The 8051 has four I/O ports
– Port 0: pins 32-39, P0 P0.0-P0.7 – Port 1: pins 1-8 , P1 : P1.0-P1.7
– Port 2: pins 21-28, P2 : P2.0-P2.7
– Port 3: pins 10-17, P3 : P3.0-P3.7
– Each port has 8 pins.
• Named P0.X ,X=0,1,...,7, P1.X, P2.X, P3.X
• Ex: P0.0 is the bit 0, LSB of P0
• Ex: P0.7 is the bit 7, MSB of P0
• These 8 bits form a byte.
• Each port can be used as input or output (bi-direction).
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 59/150
Tuesday, July 10, 2012
Other Pins:
• P1, P2, and P3 have internal pull-up resisters.
– P1, P2, and P3 are not open drain.
• P0 has no internal pull-up resistors and does notconnects to Vcc inside the 8051.
– P0 is open drain.
• However, for a programmer, it is the same to
program P0, P1, P2 and P3.• All the ports upon RESET are configured as
output.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 60/150
Tuesday, July 10, 2012
Port 0 with Pull-Up Resistors:
Pull-up resistors are used in electronic logic circuits to
ensure that inputs to logic systems settle at expected logic
levels if external devices are disconnected.
Pull-up resistors may also be used at the interface
between two different types of logic devices, possibly
operating at different power supply voltages.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 61/150
Tuesday, July 10, 2012
P0.0P0.1
P0.2P0.3P0.4P0.5P0.6P0.7
DS5000
8751
8951
Vcc
10 K
P or t
0
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 62/150
Tuesday, July 10, 2012
Port 3 Alternate Functions:
17RDP3.7
16WR P3.615T1P3.5
14T0P3.4
13INT1P3.3
12INT0P3.2
11TxDP3.1
10RxDP3.0
PinFunctionP3 Bit
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 63/150
Tuesday, July 10, 2012
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 64/150
Tuesday, July 10, 2012
ADDRESSING MODES:
There are five addressing modes available in the8051:
• Register
• Direct
• Indirect
• Immediate
• Indexed
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 65/150
Tuesday, July 10, 2012
REGISTER ADDRESSING:
• 8051 has access to eight working registers (R0
to R7)
• Some instructions are specific to a certain
register, such as the accumulator etc.
Example: ADD A,R7Example: MUL AB
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 66/150
Tuesday, July 10, 2012
Direct Addressing:
• Direct addressing is so-named because thevalue to be stored in memory is obtained by
directly retrieving it from another memory
location.
Example: MOV A,30h
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 67/150
Tuesday, July 10, 2012
Indirect Addressing:
• In 8051 assembly language, indirect addressing is
represented by an @ before R0 or R1.
Example: MOV A, @R0
Moves a byte of data from internal RAM atlocation whose address is in R0 to the
accumulator.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 68/150
Tuesday, July 10, 2012
Immediate Addressing:
• In assembly language, immediate operands are
preceded by #.
• Operand my be a numeric constant, a symbolic
variable or an arithmetic expression using
constants, symbols and operators.
Example: MOV A,#12
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 69/150
Tuesday, July 10, 2012
Indexed Addressing:
• Indexed addressing uses a base register (either the
program counter or data pointer) and an offset
(the accumulator) in forming the effective address
for a JMP or MOVC instruction.
Example: MOVC A, @A+DPTR
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 70/150
Tuesday, July 10, 2012
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 71/150
Tuesday, July 10, 2012
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 72/150
Tuesday, July 10, 2012
LED (Light Emitting Diode):
• Light-emitting diodes are elements for light
signalization in electronics.
• They are manufactured in different shapes, colors and
sizes.• Low price, low consumption and simple use
• These LED’s are used for indication purpose i.e., ON
& OFF.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 73/150
Tuesday, July 10, 2012
Symbol of LED:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 74/150
Tuesday, July 10, 2012
Some different colors of LED:
H i f LED i h
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 75/150
Tuesday, July 10, 2012
How to interface LED with
microcontroller ?
• Anode is connected through a resistor to Vcc &
the Cathode is connected to the Microcontroller
pin.
• So when the Port Pin is HIGH the LED is OFF &
when the Port Pin is LOW the LED is turned ON.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 76/150
Tuesday, July 10, 2012
Can we connect like this?
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 77/150
Tuesday, July 10, 2012
Can we connect like this?
• When the port Pin is HIGH the Anode is positive
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 78/150
Tuesday, July 10, 2012
• When the port Pin is HIGH the Anode is positivewith respect to the Cathode so the LED shouldturn ON right?
• But the internal pull-up resistor comes in serieswith the resistor thus limiting the current flowingthrough the LED. This current is not sufficientenough to Turn ON the LED.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 79/150
Tuesday, July 10, 2012
A Simple Program to glow an LED:
ORG 0000H
CLR P1.0 //Turn ON LED
CLR P1.1
CLR P1.2END
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 80/150
Tuesday, July 10, 2012
A program using port to glow an LED :
ORG 0000H
MOV p1,#OOH //Copy P1 to A
END
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 81/150
Tuesday, July 10, 2012
A program to ON &OFF the LED:
CASE1:
ORG 0000H
MOV P1,#OFFH
MOV P1,#OOH
END
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 82/150
Tuesday, July 10, 2012
CASE 2:
ORG 0000H
MOV P1,#OFFH
MOV A,P1
CPL A //ComplimentEND
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 83/150
Tuesday, July 10, 2012
SWITCH INTERFACING
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 84/150
Tuesday, July 10, 2012
SWITCH INTERFACING
An electrical switch is any device used to interrupt
the flow of electrons in a circuit. Switches areessentially binary devices: they are eithercompletely on ("closed") or completely off ("open").
• CPU accesses the switches through ports.Therefore these switches are connected to amicrocontroller. This switch is connected between
the supply and ground terminals.
• These switches are connected to an input port.
• In 8051 PORT 1, PORT 2 & PORT 3 have
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 85/150
Tuesday, July 10, 2012
In 8051 PORT 1, PORT 2 & PORT 3 have
internal 10k Pull-up resistors whereas this Pull-up
resistor is absent in PORT 0. Hence PORT 1, 2
& 3 can be directly used to interface a switch
whereas we have to use an external 10k pull-up
resistor for PORT 0 to be used for switch
interfacing or for any other input.
• When no switch is pressed, reading the input port
will yield 1s since they are all connected to high
(Vcc). But if any switch is pressed, one of the input
port pins will have 0 since the switch pressedprovides the path to ground.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 86/150
Tuesday, July 10, 2012
P2.1
Vcc
R
GND
Interfacing switch with the microcontroller
8
0
5
1
Thus now the two conditions are to be
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 87/150
Tuesday, July 10, 2012
remembered:
• When the switch is open, i.e., when not pressed thetotal supply i.e., Vcc appears at the port pin P2.0
P2.0 = 1
• When the switch is closed i.e., when it is pressed,
the total supply path is provided to ground. Thus
the voltage value at the port pin P2.0 will be zero.
P2.0 = 0
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 88/150
Tuesday, July 10, 2012
P2.1
Vcc
R
GND
Interfacing Led And Switch with the Microcontroller
8
0
5
1
Vcc
P1.0
Simple program to turn on led when
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 89/150
Tuesday, July 10, 2012
Simple program to turn on led when
switch is pressed:
ORG 0000H
SETB P1.0
LOOP:JB P2.1, LOOP
CLR P1.0
END
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 90/150
Tuesday, July 10, 2012
Liquid crystal display (LCD):
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 91/150
Tuesday, July 10, 2012
• A liquid crystal display (LCD) is a thin, flat panel
used for electronically displaying information suchas text, images, and moving pictures.
• Its uses include monitors for computers,
televisions, instrument panels, and other devices
ranging from aircraft cockpit displays, to every-day consumer devices such as gaming devices,
clocks, watches, calculators, and telephones.
• Among its major features are its lightweight
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 92/150
Tuesday, July 10, 2012
• Among its major features are its lightweight
construction, its portability, and its ability to be
produced in much larger screen sizes than arepractical for the construction of cathode ray tube
(CRT) display technology.
Why we are using LCD ?
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 93/150
Tuesday, July 10, 2012
• Its low electrical power consumption enables it to
be used in battery-powered electronic equipment.
It is an electronically-modulated optical device
made up of any number of pixels filled with liquid
crystals and arrayed in front of a light source
(backlight) or reflector to produce images in color
or monochrome.
Why we are using LCD ?
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 94/150
Tuesday, July 10, 2012
Liquid Crystal Display (LCD )is finding wide spread use
replacing LEDs (seven segment LEDs or other multi
segment LEDs) because of the following reasons:
The declining prices of LCD’s.
The ability to display numbers, characters ,graphics
and limited to numbers and a few characters
Ease of programming for characters and graphics.
Pin Description of LCD:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 95/150
Tuesday, July 10, 2012
1. Ground
2. Vcc +5V
3. Contrast control
4. Register select (RS)5. Read/Write (RD/WR)
6. Enable (EN)
7 – 14 pins all are data pins D0 – D715. Vcc +5V }
16. Ground }
Pin Description of LCD:
For backlight purpose
RS (register select):
Th i t l t i i d f th l ti f
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 96/150
Tuesday, July 10, 2012
The register select pin is used for the selection of the required register either data or command
registerIf RS=0 ; command register is selected
If RS=1 ; data register is selected
R/W (read or write):
This pin is for the selection of read or write mode
If R/W=0 ; write mode is selected
If R/W=1 ; read mode is selected
EN (enable):• Enable pin is a active high to low pin used for
writing the data to the LCD.
LCD COMMAND CODES:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 97/150
Tuesday, July 10, 2012
• 01 Clear display screen
• 06 Increment cursor
• 38 2lines and 5 by 7 matrix
• 80 Force cursor to beginning of 1st line
• 0E Display on, cursor blinking
• C0 Force cursor to beginning 0f 2nd line
LCD COMMAND CODES:
LCD INTERFACING WITH MICRO
CONTROLLER:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 98/150
Tuesday, July 10, 2012
P0.0P0.1
P0.2
P0.3
P0.4
P0.5
P0.6
P0.7
D0D1
D2
D3
D4
D5
D6
D7RS R/W E
P2.0
P2.1
P2.2
Vss
Vee
Vss
10k
POT
8
05
1
LCD
GND
CONTROLLER:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 99/150
Tuesday, July 10, 2012
How To Send Commands To LCD:
COMMAND:
CLR RS
CLR R/W
SETB EN
CLR EN
C
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 100/150
Tuesday, July 10, 2012
How to send Data to LCD:
DATA:SETB RS
CLR R/W
SETB ENCLR EN
A Si l P Of LCD
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 101/150
Tuesday, July 10, 2012
A Simple Program Of LCD:
ORG OOH
MOV A,#38H
ACALL COMMAND
MOV A,#0EH
ACALL COMMANDMOV A,# ’H’
ACALL DATA
MOV A,# ‘I’
ACALL DATA
COMMAND : CLR RS
CLR R/W
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 102/150
Tuesday, July 10, 2012
CLR R/W
SETB EN
CLR ENRET
DATA:
SETB RSCLR R/W
SETB EN
CLR ENRET
END
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 103/150
Tuesday, July 10, 2012
Relay Interfacing With
Mi ll
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 104/150
Tuesday, July 10, 2012
Microcontroller
Relay: It can be defined as an electrical switch that opensand closes under the control of another electrical circuit.
The switch is operated by an electromagnet to open or
close one or more of contacts. A relay is able to control an
output circuit of higher power than the input circuit.Relays are devices which allow low power circuits to
switch a relatively high Current/Voltage ON/OFF.
For a relay to operate a suitable pull-in & holding currentshould be passed through its coil.
Generally relay coils are designed to operate from a
particular voltage often its 5V or 12V.
Types:
There are many types of relays which are as
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 105/150
Tuesday, July 10, 2012
There are many types of relays which are as
follows:
SPDTDPDT
Symbol Of Relay:
• The relay's switch connections are usually labelled
COM NC and NO:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 106/150
Tuesday, July 10, 2012
COM, NC and NO:
• COM = Common, always connect to this, it is the
moving part of the switch.
• NC = Normally Closed, COM is connected to this
when the relay coil is off.
• NO = Normally Open, COM is connected to thiswhen the relay coil is on.
• Connect to COM and NO if you want the switched
circuit to be on when the relay coil is on.
• Connect to COM and NC if you want the switched
circuit to be on when the relay coil is off.
Advantages of relays:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 107/150
Tuesday, July 10, 2012
g y
• Relays can switch AC and DC, transistors
can only switch DC.
• Relays can switch high voltages, transistors
cannot.
• Relays are a better choice for switching
large currents (> 5A).
• Relays can switch many contacts at once.
Di d Of R l
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 108/150
Tuesday, July 10, 2012
Disadvantages Of Relay:
• Relays are bulkier than transistors for
switching small currents.
• Relays cannot switch rapidly , transistorscan switch many times per second.
• Relays use more power due to the current
flowing through their coil.
SPDT Relay (Single Pole Double Throw) :
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 109/150
Tuesday, July 10, 2012
An electromagnetic switch, consist of a coil , 1
common terminal , 1 normally closed terminal ,and one normally open terminal.
When the coil of the relay is at rest (not
energized), the common terminal and thenormally closed terminal have continuity. When
the coil is energized, the common terminal and the
normally open terminal have continuity.
DPDT (Double Pole Double Throw):
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 110/150
Tuesday, July 10, 2012
• Can be used to isolate float switches from spiking
voltage or excessive current.
• Avoids risk that spiking pump voltage will hurt
float switches.
Specifications:
• Coil voltage: 12VDC
• Coil resistance: 160 Ohms
• Contact rating: 10A at 250VAC or 30VDC.
Why do I want to use a relay and do I really
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 111/150
Tuesday, July 10, 2012
need to?
• The coil of an SPDT relay that we most commonly
use draws very little current (less than 200
milliamps) and the amount of current that you can
pass through a relay's common, normally closed,and normally open contacts will handle up to 30 or
40 amps. This allows you to switch devices such as
headlights, parking lights, horns, etc.,
SPDT & DPDT:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 112/150
Tuesday, July 10, 2012
SPDT & DPDT:
Relay Interfacing with the Microcontroller:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 113/150
Tuesday, July 10, 2012
1 U 16
2 L 15
3 N 14
4 2 13
5 8 12
6 0 117 3 10
8 9
RELAY LOAD
Ground Vcc
AT 89S52
P1.0
ULN2003 CURRENT DRIVER:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 114/150
Tuesday, July 10, 2012
• The ULN2003 current driver is a high voltage, high
current Darlington arrays each containing sevenopen collector Darlington pairs with common
emitters. Each channel is rated at 500mA and can
withstand peak currents of 600mA.
ULN DRIVER CIRCUIT
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 115/150
Tuesday, July 10, 2012
This ULN2003 driver can drive seven relays at a
time. The pins 8 and 9 provide ground and Vcc
respectively.
Working Of ULN Driver:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 116/150
Tuesday, July 10, 2012
Working Of ULN Driver:
• It can accept seven inputs at a time and produces
seven corresponding outputs. If the input to any
one of the seven input pins is high, then the value
at its corresponding output pin will be low, forexample if the input at pin 6 is high, then the value
at the corresponding output i.e., output at pin 11
will be low. Similarly if the input at a particular
pin is low, then the corresponding output will be
high.
• Thus for the output to be low, the input applied at
that corresponding input pin should be high The
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 117/150
Tuesday, July 10, 2012
that corresponding input pin should be high. The
input to the ULN driver is provided by the
microcontroller. Thus the instruction required tooperate the relay through the microcontroller is
SETB PX.Y
• Where X is the port number (P0, P1, P2and P3).
• And Y is the pin number of Port X.
Applications:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 118/150
Tuesday, July 10, 2012
Applications:
• To control a high-voltage circuit with a low-
voltage signal
• To control a high-current circuit with a low-
current signal,• To detect and isolate faults on transmission and
distribution lines by opening and closing circuit
breakers.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 119/150
Tuesday, July 10, 2012
What is communication?
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 120/150
Tuesday, July 10, 2012
What is communication?
• Communication is nothing but sharing of data or
transferring the data from one system to another.
system1 system2
Types of communication:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 121/150
Tuesday, July 10, 2012
In Serial communications means informationis transmitted from source to destination over a
single pathway.
In Parallel Communication, often 8 or more
lines are used to transfer data to a device that is
only a few feet.
COMPUTERS TRANSFER DATA IN
TWO WAYS:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 122/150
Tuesday, July 10, 2012
TWO WAYS:
Sender Receiver Sender Receiver
Serial Transfer Parallel Transfer
D0-D7D0
Other control lines
Other control lines
Why we prefer serial transmission
ll l t i i ?
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 123/150
Tuesday, July 10, 2012
over parallel transmission?
• In Parallel data transfers, often 8 or more lines
are used to transfer data to a device that is only
a few feet.
• Where as serial transmission uses only single
line to transmit the same data over long
distances
• There are chances of loosing data in parallelcommunication rather than in serial
communication.
Simplex vs Duplex Transmission
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 124/150
Tuesday, July 10, 2012
Simplex vs. Duplex Transmission
• Simplex transmission: the data can sent in one
direction.
– Example: the computer only sends data to the
printer.
• Duplex transmission: the data can be transmitted
and received.
Transmitter Receiver
Transmitter
Receiver Receiver
Transmitter
Half vs Full Duplex
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 125/150
Tuesday, July 10, 2012
Half vs. Full Duplex
• Half duplex: if the data is transmitted one way at
a time.
• Full duplex: if the data can go both ways at the
same time. Two wire conductors for the data lines.
Transmitter
Receiver
Receiver
Transmitter
Transmitter
Receiver
Receiver
Transmitter
Registers Used in Serial Transfer Circuit
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 126/150
Tuesday, July 10, 2012
Registers Used in Serial Transfer Circuit
• SBUF (Serial data buffer)
• SCON (Serial control register)
• TMOD (Timer mode register)
SBUF
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 127/150
Tuesday, July 10, 2012
SBUF
• This is an 8-bit register used for serial
communication in 8051.For a byte of data to be
transferred it must be placed in sbuf register and
in similar way sbuf holds the data when it isreceived.
SCON Register (serial control)
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 128/150
Tuesday, July 10, 2012
SM0 SM1 SM2 REN TB8 RB8 TI RI
It used to program the start bit, stop bit and data
bits of data framing
SM0 , SM1:
These two bits determine the framing of data by
specifying the number of bits per character, and
the start and stop bits.
SM0 SM1
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 129/150
Tuesday, July 10, 2012
SM0 SM1
0 0 Serial Mode 0
0 1 Serial Mode 1, 8-bit data, 1 stop bit,
1 start bit
1 0 Serial Mode 2
1 1 Serial Mode 3
RECEIVE - Data receive through the RXD pin starts
upon the two following conditions are met: bit REN=1
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 130/150
Tuesday, July 10, 2012
and RI=0
(both of them are stored in the SCON register). When all8 bits have been received, the RI bit of the SCON register
is automatically set indicating that one byte receive is
complete.
TRANSMIT - Data transmit is initiated by writing data
to the SBUF register. In fact, this process starts after any
instruction being performed upon this register. When all
8 bits have been sent, the TI bit of the SCON register isautomatically set.
TMOD
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 131/150
Tuesday, July 10, 2012
TMOD
• TMOD is an 8 bit register in which the lower 4 bits
are set aside for Timer0 and the upper 4 bits for
Timer1.
GATE C/T M0 M1 GATE C/T M1 M0
TMOD -Timers
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 132/150
Tuesday, July 10, 2012
Bit Number Type Working Timer Type
7 GATE1
Gating Control when
set 1
6 C/T1
To decide whether
timer is used as a
delay generator or
as an event counter
1
5 M1 Timer mode bit 1
4 M0 Timer mode bit 1
3 GATE0Gating Control
Purpose0
2 C/T0
To decide whether
timer is used as a
delay generator or as an event counter
0
1 M1 Timer mode bit 0
0 M0 Timer mode bit 0
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 133/150
Tuesday, July 10, 2012
M1 M0 Timer ModeDescription
of Mode
0 0 0 13-bit Timer.
0 1 1 16-bit Timer
1 0 28-bit auto-
reload
1 1 3Split timer
mode
RS232
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 134/150
Tuesday, July 10, 2012
RS232
To ensure fast and reliable data transmission
between two devices
In RS232 it consists of 9 pins but we generally
use only three pins 2,3 and 5 namely TXD RXD
GND respectively.
MAX232To convert TTL or CMOS voltages to RS232
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 135/150
Tuesday, July 10, 2012
g
voltages, and vice versa
Complementary metal – oxide – semiconductor
(CMOS)
CMOS uses complementary and symmetrical
pairs of p-type and n-type metal oxide
semiconductor field effect transistors (MOSFET’s)
for logic functions.
Two important characteristics of CMOS devicesare high noise immunity and low static power
consumption.
TTL (Transistor transistor logic)
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 136/150
Tuesday, July 10, 2012
( s s o s s o og c)
• TTL integrated circuits were a standard method
of construction for the processors of mini-
computer and mainframe processors
• Transistor – transistor logic (TTL) is a class of digital circuits built from bipolar junction
transistors (BJT) and resistors. It is called
transistor – transistor logic because both the logic
gating function (e.g., AND) and the amplifying
function are performed by transistors
Baud Rates in the 8051:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 137/150
Tuesday, July 10, 2012
• Baud rate is the number of signal changes per
second
• The 8051 transfers and receives data serially atmany different baud rates by using UART.
• UART divides the machine cycle frequency by 32and sends it to Timer 1 to set the baud rate.
• Signal change for each roll over of timer 1.
XTAL
oscillator ÷ 12
÷ 32
By UART
Machine cycle frequency28800 Hz
To timer 1
To set the
Baud rate
921.6 kHz
11.0592 MHz
Timer 1
MAX 232 INTERFACING WITH MICRO
CONTROLLER
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 138/150
Tuesday, July 10, 2012
135
14TxD0(P3.1)
RxD0(P3.0)
11 11
10 12
2
3
8
0
5
1
M
A
X
2
3
2
D
B
9 GND
CONTROLLER
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 139/150
Tuesday, July 10, 2012
ANALOG TO DIGITAL CONVERTER
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 140/150
Tuesday, July 10, 2012
• Analog-to-digital converters are among the most
widely used devices for data acquisition. Digitalsystems use binary values, but in the physical world
everything is continuous i.e., analog values.
Temperature, pressure (wind or liquid), humidity
and velocity are the physical analog quantities.
• These physical quantities are to be converted into
digital values for further processing. Thus, an
analog-to-digital converter is needed to convertthese electrical signals into digital values so that the
microcontroller can read and process them.
ADC0804:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 141/150
Tuesday, July 10, 2012
• The ADC chip that is used in this project is
ADC0804. The ADC0804 IC is an 8-bit parallelADC in the family of the ADC0800 series from
National Semiconductor. It works with +5 volts
and has a resolution of 8 bits. In the ADC0804, the
conversion time varies depending on the clocking
signals applied to the CLK IN pin, but it cannot be
faster than 110µs.
PIN Diagram of ADC
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 142/150
Tuesday, July 10, 2012
Pin description of ADC
CS (Chi l ti )
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 143/150
Tuesday, July 10, 2012
CS (Chip selection):
Chip select is a active low input used to activatethe ADC 0804.
RD (read):
This is also a active low pin used to get theconverted data out of the ADC 0804.
WR (write):
This is also active low used to inform the ADC tostart the conversion process.
CLK IN & CLK R:
CLK IN is connected to external clock when
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 144/150
Tuesday, July 10, 2012
external clock is used and if internal clock is used
both clocks are connected to capacitor and aresistor.
INTR (INTERRUPT):
It is an active low output pin using for stop theconversion.
Vin(+) & Vin(-):Vin(+) is used for the conversion of analog todigital by connecting Vin(-) to the ground.
Vcc:It is the +5v power supply to the chip.
Vref/2:
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 145/150
Tuesday, July 10, 2012
Vref/2:
Pin 9 is used for the reference voltage. If we needthe input range 0-4V, Vref/2 is connected to 2V.
D0-D7:
These are the digital data output pins.
D7 is the MSB.Analog ground & Digital ground:
Analog ground is connected to ground of analogVin while taking the inputs in the same way digital
ground is also used for the digital outputs.
ADC INTERFACE WITH MICROCONTROLLER
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 146/150
Tuesday, July 10, 2012
89C51
20P2.5P2.6
A P2.7D P1.7
C P1.60 P1.58 P1.40 P1.34 P1.2
P1.1
P1.0
Keypads are a part of HMI or Human Machine Interface and
KEYPAD INTERFACING
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 147/150
Tuesday, July 10, 2012
Keypads are a part of HMI or Human Machine Interface and
play really important role in a small embedded system where
human interaction or human input is needed. Matrix keypadsare well known for their simple architecture and ease of
interfacing with any microcontroller.
Interfacing the Keyboard to the 8051
At the lowest level, keypads are organized in a matrix of rows
and columns. The CPU accesses both rows and column
through ports; therefore, an 4*4 matrix of keys can be
connected to a microprocessor. When a key pressed, a row andcolumn make a connect; otherwise, there is no connection
between row and column.
Constructing a Matrix Keypad:
Construction of a keypad is really simple. As per the
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 148/150
Tuesday, July 10, 2012
yp y p p
outline shown in the figure below we have four rows and
four columns. In between each overlapping row andcolumn line there is a key.keeping this outline we can
construct a keypad using simple SPST Switches as
shown below:
Consider an example
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 149/150
Tuesday, July 10, 2012
Row4-row1 = 1110
Col4-col1 = 1011
That means the row 1 and the col 3 intersected i.e.
sw3 is pressed.
7/28/2019 Theory - Basic Electrical and Electronic Components
http://slidepdf.com/reader/full/theory-basic-electrical-and-electronic-components 150/150