Bec Unit 2
Bec Unit 2
Unit II
UNIT 2
Logic Gates
▪ Logic Systems consists of Gates and Flip-flops
▪ Logic gates are electronic circuits designed to produce the basic logic
functions such as AND, OR, etc.
0 1 1 0
1 0 0 1
BISTABLES
•
R-S BISTABLES
•
OPERATION OF AN R-S BISTABLE
1 0 0 0
0
0 1 1
0 0 1
1
1 0 0 0
OPERATION OF AN R-S BISTABLE
1 0
1 0
1 1
0
0
INPUTS OUTPUT
COMMENTS
CLEAR PRESET
0 0 ? Indeterminate
0 1 0 Q is reset
1 0 1 Q is set
1 1 Clocked operation Enables clocked
operation
INPUT AND OUTPUT STATES (CLOCKED
OPERATION)
1
INPUTS OUTPUT COMMENTS
J K
0 Q
0 0 Q No change in state of the Q
output
0 0 1 0 Q is reset
1 1 0 1 Q is set
1 1 Q output changes to the
opposite state
CLOCKED OPERATION OF A J-K BISTABLE
1
INPUTS OUTPUT COMMENTS
0 0
J K
0 0
1
CLOCKED OPERATION OF J-K BISTABLE
INPUTS OUTPUT COMMENTS
J K
1
•Binary(Base 2)
•Large binary numbers are inconvenient to handle
•Hence convert to hexadecimal
•Hexadecimal(Base 16)
•Easy to comprehend
•Offers advantage over decimal (base 10)
•Conversion from binary to hexadecimal and vice versa is easy
•A single hexadecimal character(range is 0 to F) represents 4 binary digits
Nibble, byte, word, double word
hex-make
groups of
four bits
(nibble)-
then
Ex:
•Each
represent
$64H=0110
hexadecim
each
0100 nibble
in
al number
in
is hex.
binary
represente
=100 in
d using $
decimal
before the
$7FH
number = or
0111
add
•Ex. H
A31111
to
in
the
in
hex end
binary
= of
1010
the
=127
0011 in
in
number
decimal
binary
•11101000
Data Types
• One byte of data can be stored at each address of the memory space
in a microprocessor
• For a 16 bit address bus, total memory locations =65,536
• Within a byte, bits are numbered 0 (Least Significant Bit) to 7(Most
Significant Bit)
• For 16 bit words, 15 is the MSB bit
• Negative(signed) numbers are represented using 2’s complement
notation.
• Here MSB indicates the sign of the number(1=negative, 0= positive)
• Only bits 0 to 6 represent the magnitude of the number
•Ex: signed 8 bit number 10000001 = -1(denary)
Range of Integer Data values
Data Storage
•Semiconductor ROM
•Provides storage for the program code
•Stores any permanent data
•These are non-volatile
•They remain intact when power supply is off
•Semiconductor RAM
•Provides storage for transient data, variables used by the program
•Part of RAM temporarily stores data while doing normal tasks
•CMOS RAM
•Data stored in RAM is lost when power switched off
•In CMOS RAM, data is kept alive using a small battery
•It retains important data- time and date
Data Storage
• The data stored in the memory device is represented in kilobytes(KB)
• 1 Kilobyte = 1024 bytes . It is nearest power of 2.(210 =1024)
• Semiconductor ROM capacity = address range * number of bits stored
at each address
• Ex: 2k x 8 bits(2KiloBytes) , 4k x 8 bits (4 Kilobytes)
Microcontroller system
Microcontroller system
Typical Microcontroller system
• The sensed quantities(temperature, position) are converted to
electrical signals using sensors
• Sensor outputs are either digital or analogue in nature
• These signals passed to microcontroller. Microcontroller also accepts
user options
• Software instructions control the operation of the microprocessor
and output signals sent to controlled devices
• Controlled device converts electrical energy from one form into
another form
• In real world, systems are self regulating called closed loop system
Ex. Heating control system
Typical Microcontroller system
• Micro controllers have a CPU which performs arithmetic, logical and
timing operations
• Some input sources are switches, sensors, keypads
• Some output devices are LED indicators, LED 7 segment displays,
motors and actuators, relays, transistor drivers and other solid-state
switching devices
Input devices
• Input device is keyboard, mouse scanner and modem
• Switches or contacts which make and break
• Sensors which provide logic level outputs
• To connect an input device to a microcontroller, the device must
provide a logic compatible signal.
• In microcontroller inputs can only accept digital input signals
0v= logic 0 and 5v = logic 1 signal
• Some devices sense analogue quantities
• Some microcontrollers provide ADC and provide digital data.
• Resolution of the ADC depends on the number of bits used (8, 10 or
12 bits)
Output devices
• They are used to communicate information to the outside world
• Common output devices are flat screen display, printers and modems
• Microcontroller uses output devices such as LEDs, piezoelectric
sounders, relays and motors
• DAC are required at the output of the microcontroller
• The resolution of the DAC also depends on the number of bits
Interface Circuit
• When the output and input signals are not logically compatible
interface circuits are needed
• Also, when a load requires more current than is available from
standard logic device or output port
• They provide the additional current drive
• JK flip-flop with active low Preset and Clear is used to construct the
4-bit shift register.
• Negative edge of the clock is used to trigger the operation of the
flip-flops
• 4-bit data of 1010 is sent to the shift register serially (1-bit per clock )
through serial in. Data 1010 is fed in with LSB first
• Each bit is shifted to the through the 4 flip-flops and output through
serial out after the occurrence of 4 negative edges of the clock.
Operation of Shift Register:
Register types