Page 1
A
PRACTICAL TRAINING SEMINAR
REPORT
ON
“EMBEDDED SYSTEM DESIGN”
(ARMbedded Electronics Pvt. Ltd. Jaipur)
Submitted in partial fulfillment for the award of the degree of
BACHELOR OF TECHNOLOGY
IN
ELECTRONICS & COMMUNICATION ENGINEERING
2014-15
Submitted To:- Submitted By:-
Mr. VISHNU KR. SHARMA NEERAJ KUMAR
Asst. Prof. (E.C.E.) B.Tech ,VIISEM.
JIT, Jaipur 11EJJEC028
RAJASTHAN TECHNICAL UNIVERSITY, KOTA
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
JAIPUR INSTITUTE OF TECHNOLOGY, Group of Institution, Jaipur
Page 2
RAJASTHAN TECHNICAL UNIVERSITY, KOTA
JAIPUR INSTITUTE OF TECHNOLOGY, JAIPUR
(GROUP OF INSTITUTION)
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
CERTIFICATE
This is to certify that the Practical Training Seminar report for Practical
Training taken at “ARMbedded Electronics Pvt. Ltd. Jaipur” From (2-Jun-
2014) To (15-Jul-2014) submitted by “Neeraj Kumar” in partial fulfillment
for the award of degree of Bachelor of Technology in Electronics &
Communication Engineering has been found satisfactory and is approved for
submission.
Mr. Vishnu Kr. Sharma Mr. Vishnu Kr. Sharma
(PTS Coordinator) (PTS Guide)
Assistant Professor Assistant Professor
Dept. of ECE Dept. of ECE
JIT, Jaipur JIT, Jaipur
Ms. Priyanka Agrawal
Head, Dept. of Electronics & Communication Engineering,
JIT, Jaipur
II
Page 4
AKNOWLEDGEMENT
I am deeply thankful to “ARM bedded Electronics Pvt. Ltd. Jaipur” As it
has given me golden opportunity to go through remarkable training on
“Embedded System Design”. Here I have got valuable and detailed knowledge
on real time projects. I owe my gratitude to my faculty cum trainer “Mr.Lalit
Sharma” for his unmatched supports, guidance and inspirations without which I
wouldn’t have learned so many new & innovative things in such a short span of
time.
I would also like to thanks my department i.e. Department of Electronics
& Communication Engineering of my college especially my HOD
“Mrs.Priyanka Agrawal” and all teachers who have suggested me to join this
beneficial summer training. I am highly obliged that I have received all of your
support in such a good way.
Neeraj Kumar
11EJJEC028
ECE, VII Sem.
III
Page 5
ABSTRACT
The objective of my practical training is to learn something about industries,
practically and to be familiar with the working style of a technical worker to adjust
simply according to industry environment.
As a part of academic syllabus of four years degree course in electronics and
communication engineering, every student is required to undergo a practical training
for 45 days. We are student of fourth year electronics and communication and this
report is written on the basis of practical knowledge acquired by me during the period
of practical training taken at “ARM bedded Electronics Pvt. Ltd. Jaipur”.
This report deals with equipment their relation and their general operating
principle.
We hope that this report will be useful for a person to get the basic knowledge
about the “Embedded System Design”.
IV
Page 6
LIST OF CONTENTS
CHAPTER NAME PAGE NO.
CERTIFICATE FROM TRAINING I
CERTIFICATE FROM COLLEGE II
ACKNOWLEDGEMENT III
ABSTRACT IV
LIST OF FIGURE V
LIST OF TABLE VI
1. COMPANY PROFILE 1-3
1.1 Introduction 1
1.2 Training & Skill Development 1
1.3 Products 2
1.4 Organizational Structure 2
1.5 Objective 3
1.6 Highlights 3
2. EMBEDDED SYSTEM 4-10
2.1 Introduction 4
2.2 Scope 5
2.3 Components 7
2.3.1 Hardware Components 7
2.3.2 Software Components 7
2.3.3 Real Time Operating System 7
2.4 Classification of Embedded System 8
2.4.1 Small Scale Embedded System 8
2.4.2 Medium Scale Embedded System 9
2.4.3 Sophisticated Embedded System 9
2.5 The Embedded Environment 10
2.5.1 Reliability 10
2.5.2 Efficiency 10
Page 7
3. MICROCONTROLLER 11-26
3.1 Introduction 11
3.1.1 Microcontroller 12
3.1.2 Microprocessor 13
3.2 Microprocessor v/s Microcontroller 14
3.3 Types of Microcontroller 15
3.3.1 Microcontroller 8031 15
3.3.2 Microcontroller 8051 15
3.3.3 Microcontroller AT89C51 16
3.4 Pin Description of AT89C51 17
3.5 Memory Space Allocation in AT89C51 19
3.5.1 On chip ROM 20
3.5.2 on chip RAM 20
3.5.3 External Code Memory 21
3.5.4 External RAM 21
3.5.5 Code Memory 22
3.5.6 Registers 22
3.5.7 Program Counter & Data Pointer 23
3.5.8 Flag Bits & PSW Registers 23
3.6 Memory Addressing In AT89C51 23
3.6.1 RAM 24
3.6.2 ROM 24
3.6.3 PROM 24
3.6.4 EPROM 25
3.6.5 EEPROM 25
3.6.6 Flash Memory 25
3.6.7 Registers 26
3.7 Fabrication Techniques Of AT89C51 26
3.7.1 CMOS Technology 26
3.7.2 PMP Technology 26
4. ELECTRONICS COMPONENTS 27-42
4.1 Introduction 27
4.1.1 Registers 27
4.1.2 Capacitors 28
4.1.3 Inductor 28
4.1.4 Diode 28
4.1.5 Transistor 29
4.1.6 Potentiometer 29
Page 8
4.1.7 Switches & Push Button 29
4.1.8 Solenoid 30
4.1.9 Motor 30
4.1.10 Relay 30
4.1.11 Buzzer 31
4.1.12 Light Emitting Diode 31
4.1.13 Photo resistor 31
4.1.14 Photodiode 32
4.1.15 Phototransistor 32
4.1.16 7-segement Led Display 33
4.1.17 Transformer 34
4.1.18 IC7805 voltage Regulator IC 34
4.1.19 LM324 IC 35
4.1.20 555 Timers IC 37
4.1.21 RF Module 39
4.1.22 LCD 41
5. “C” PROGRAMMING 43-51
5.1 Introduction 43
5.2 Statement Types 43
5.3 Basic Structure 43
5.4 Statements in “C” 44
5.4.1 Switch Statement 45
5.4.2 WHILE Loop Structure 45
5.4.3 DO-WHILE Loop Structure 45
5.4.4 FOR Loop Structure 45
5.5 Function 47
5.6 Program 49
5.6.1 WAP to Perform Table of Two 49
5.6.2 WAP To ON & OFF Relay 50
6. PROJECT OVERVIEW 52-59
6.1 Introduction 52
6.2 Circuit Components 52
6.3 Circuit Block Diagram 53
6.4 Circuit Flow Chart 54
6.5 Circuit Design 54
6.6 Circuit Description 55
6.6.1 Transmitter Circuit (Infrared) 56
Page 9
6.6.2 Receiver Circuit (sensors) 57
6.7 Operation 57
6.8 Applications 58
6.9 Limitations 58
6.10 Project Program 58
7. CONCLUSION 60-61
7.1 Introduction 60
7.2 Lesson Learned 60
7.3 Knowledge Gain 60
7.4 Suitability of Organization 61
8. REFERENCE 62-62
Page 10
LIST OF FIGURE
FIGURE NO. PAGE NO.
Fig.1.1Company Banner 1
Fig.1.2 Microcontroller Applications Kit 2
Fig.1.3 Recognition of ARMbedded Electronics Pvt. Ltd, Jaipur 3
Fig.2.1 Embedded System Applications 4
Fig.2.2 Function Diagram of Embedded System 5
Fig.2.3 Real-Life Examples of Embedded System 7
Fig.2.4 Hardware Component of Embedded System 8
Fig.2.5 Small Scale Level IC 8
Fig.2.6 Medium Scale Level IC 9
Fig.2.7 Sophisticated Level IC 9
Fig.3.1 Block Diagram of Microcontroller 11
Fig.3.2 Block Diagram of Microprocessor 12
Fig.3.3 Pin diagram & architecture of AT89C51 15
Fig.3.4 ROM & RAM Memory in 8051 Microcontroller 19
Fig.3.5 Some 8-bit & 16-bit Registers 20
Fig.4.1 Resistor Color coding 27
Fig.4.2 Charging, Charged & Discharging Of Capacitor 28
Fig.4.3 Inductor & its Circuit Symbol 28
V
Page 11
Fig.4.4 Diode & its Circuit symbol 28
Fig.4.5 Transistor & its circuit symbol 29
Fig.4.6 Potentiometer & its circuit symbol 29
Fig.4.7 Switches & its circuit symbol 29
Fig.4.8 Solenoid & its circuit symbol 30
Fig.4.9 Motor & its circuit symbol 30
Fig.4.10 Relays & its circuit symbol 30
Fig.4.11 Buzzer Circuit Symbol 31
Fig.4.12 Various Types of LED’s 31
Fig.4.13 Infrared Detector 31
Fig.4.14 Photo resistor & its symbol 32
Fig.4.15 Photodiode & its symbol 32
Fig.4.16 Phototransistor & its Symbol 33
Fig.4.17 7-segement led display &it’s Pin out Diagram 34
Fig.4.18 Transformer & its Circuit Symbol 34
Fig.4.19 LM7805 IC & its Pin out Diagram 35
Fig.4.20 LM324 IC & Its Pin out Diagram 36
Fig.4.21 555Timer IC & Its Pin out Diagram 37
Fig.4.22 RF Transmitter & Receiver circuit 39
Fig.4.23 LCD & Its Pin out Diagram 41
Fig.6.1 Circuit Description of BDVC 52
Fig.6.2 Block Diagram of BDVC 53
Fig.6.3 Flow Chart of BDVC 54
Page 12
Fig.6.4 PCB Layout of BDVC 55
Fig.6.5 Transmitter Circuit of BDVC 56
Fig.6.6 Receiver Circuit of BDVC 57
Page 13
LIST OF TABLE
TABLE NO. PAGE NO.
Tab.1 Embedded System Scope 6
Tab.2 Microcontroller v/s Microprocessor 13
Tab.3Pin Description of 7805 IC 35
Tab.4 Pin Description of LM 324 IC 37
Tab.5 Pin Description of 555 Timers IC 38
Tab.6 Pin Description of RF Transmitter 40
Tab.7 Pin Description of RF Receiver 40
Tab.8 Pin Description Of LCD Display 42
VI
Page 14
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/1
CHAPTER 1
COMPANY PROFILE
1.1 Introduction
Fig.1.1 Company Banner
ARMbedded Electronics Pvt.Ltd. is an embedded design house. It provides out-of-the-
box solution from concept to reality. It is registered under company act. 1956 and ISO
9001:2008 Certified Company.The Company is one of the innovations, dedication and
diversification in the field of Embedded, Advanced Embedded System Design,
Embedded Wireless VLSI, and MATLAB
1.2 Training & Skill Development
Training is imparted in all the four domains. Training is such that it equips an
engineer/student to use the practical knowledge gained here, fully in the field. We also
undertake training for corporate in all the respective domains. Company has a team of
professional service engineers equipped with latest communication system for aneffective
after sales service. Periodical checks are also carried out as preventive maintenance.
Company has state-of-the-art computerized design facilities and a team of design
engineers to develop any equipment as per the customer’s need.
Page 15
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/2
1.3 Product
ARMbedded Electronics Pvt.Ltd. is Manufacture and Deliver Technical Goods as per
customer Requirements and Needs. We develop industrial products and protoboards in
the respective domains, which are used in educational institutes. These protoboards are so
designed that a student working on it develops a complete knowledge from firmware
development to interfacing to various active and passive components.
Fig.1.2 8051 Microcontroller Applications Kit
1.4 Organizational Structure
ARM bedded Electronics Pvt. Ltd., channelizes the formidable global project expertise of
embedded projects, tailored to match industry needs. ARM bedded Electronics Pvt. Ltd
offers job ready training programs for the beginners & skill enhancement program for those
who are already employed in industry. Sample practicing on Real Time Projects makes
participants productive in their jobs. At ARM bedded Electronics Pvt. Ltd we create Global
Professionals.
ARMbedded Electronics Pvt. Ltd.Jaipur employs highly qualified professionals with PhD’s,
M.Tech. &, B.Tech.'s,. We havewell disciplinary team comprising education experts,
subject matter experts, instructional designers, quality experts, Academic advisors,
experienced placement officers, project Managers & team leaders.
Page 16
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/3
Fig.1.3 Recognition of ARMbedded Electronics Pvt. Ltd, Jaipur
1.5 Objective
Gain appropriate knowledge of latest technologies.
Ability to understand embedded technology and evaluates the required projects
and components.
Develop a road map/career plan/strategy for campus placement.
Understanding and support for overall development to address these challenges.
And much more…..
1.6 Highlights
Biggest center in Jaipur in terms of area.
Recipient of best embedded training centre by brand academy.
Experienced and globally certified faculties.
Well equipped class room & labs.
Page 17
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/4
CHAPTER 2
EMBEDDED SYSTEM
2.1 Introduction
Fig.2.1 Embedded System Applications
An Embedded System is one that has computer hardware with software embedded in it as
one of its important components.
An Embedded system is any electronic device that incorporates a computer in its
implementation. The user of an embedded device is often not even aware that a computer
is present in the device. The computer is used primarily to provide flexibility and to
simplify the system design. Unlike PC, program code is usually stored in ROM and not a
hard disk drive. Typically, the end user does not develop new software for the embedded
Page 18
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/5
device. With advances in VLSI technology, embedded systems have become so
inexpensive that they are found in most of today's electronic devices.
Fig.2.2 Function Diagram of Embedded System
2.2 Scope
Aircraft & Military Systems
Aircraft autopilots, avionics and
navigation systems, automatic landing
systems, guidance systems, engine
controls.
Biomedical Systems
CT scan and Ultrasound imaging systems,
patient monitors, heart pacers.
Cars
Engine control, anti-lock braking systems,
traction control systems, air bag controls,
heating and air conditioning controls, GPS
mapping, Satellite Radio, On-board
Page 19
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/6
Diagnostics.
Communications
Communication Satellites, network routers,
switches, hubs.
Consumer Electronic TVs, ovens, dishwashers, DVD players,
stereos, security systems, lawn sprinkler
controls, thermostats, cameras, clock
radios, answering machines, set top boxes,
other appliances.
Computer Input Keyboards, mice, printers, scanners, displays,
modems, hard
Output Devices disk drives, DVD drives, graphics cards, USB devices
Electronic
Instrumentation
Data acquisition systems, oscilloscopes,
voltmeters, signal generators, logic analyzers.
Industrial Devices
Elevator controls, surveillance systems,
robots, CNC machines, Programmable
Logic Controllers, industrial automation
and control systems.
Office Machines
FAX machines, copiers, telephones,
calculators, cashregisters.
Personal Devices
Cell phones, portable MP3 players, Video
players, Personal
Digital Assistants (PDAs), electronic
wrist watches,
Robots
Industrial robots, autonomous vehicles,
space exploration robots (i.e. Mars robots)
Tab.1 Embedded System Scope
Page 20
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/7
Fig.2.3 Real-Life Examples of Embedded System
2.3 Components
2.3.1 Hardware Components:-Processor, Timers, Interrupt controller, I/O Devices,
Memories, Ports, etc.
2.3.2 Software Components: -It has main Application Softwarewhich may perform
concurrently the series of tasks or multiple tasks.
2.3.3 Real Time Operating System:-RTOS defines the way the system work. Which
supervise the application software? It sets the rules during the execution of the application
program. A small scale embedded system may not need an RTOS.
Page 21
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/8
Fig.2.4 Hardware Component of Embedded System
2.4 Classification of Embedded System
2.4.1 Small Scale Embedded System
Fig.2.5 Small Scale Level IC
Single 8 bit or 16bit Microcontroller.
Little hardware and software complexity.
They May even be battery operated.
Usually “C” is used for developing this system.
The need to limit power dissipation when system is running continuously.
Page 22
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/9
Programming tools: Editor, Assembler and Cross Assembler.
2.4.2 Medium Scale Embedded system
Fig.2.6 Medium Scale Level IC
Single or few 16 or 32 bit microcontrollers or Digital Signal Processors (DSP) or
Reduced Instructions Set Computers (RISC).
Both hardware and software complexity.
Programming tools: RTOS, Source code Engineering Tool & Simulator.
2.4.3 Sophisticated Embedded System
Fig.2.7 Sophisticated Level IC
Enormous hardware and software complexity.
Which may need scalable processor or configurable processor and programming logic
arrays?
Constrained by the processing speed available in their hardware units.
Programming Tools: For these systems may not be readily available at a reasonable cost
Page 23
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/10
or may not be available at all. A compiler or retarget able compiler might have to be
developed for this.
2.5 The Embedded Environment
Microcontrollers used in development projects have very limited resources. We are working
close to our target machine and we must be familiar with our target hardware construction
and operation. A good quality C development environment incorporates tools which allow
us to concentrate primarily on our applications and not on the hardware which runs them.
However, we cannot ignore low-level details of our target hardware. The better we
understand our run-time environment, the better we can take advantage of its limited
capabilities and resources.
There are many aspects of embedded systems development which must be considered.
These are as follows:-
2.5.1 Reliability
Embedded systems must be reliable. Personal computer programs such as word processors
and games do not need to achieve the same standard of reliability that a microcontroller
application must. Errors in programs such as word processors may result in errors in a
document or loss of data. An error in a microcontroller application such as a television
remote control or compact disc player will result in a product that does not work and
consequently does not sell. An error in a microcontroller application such as an antilock
braking system or autopilot could be fatal.
2.5.2 Efficiency
Issues of efficiency must be considered in real time applications. A real time application is
one in which must be able to act at a speed corresponding with the occurrence of an actual
process. Many embedded systems must compete in a consumer market and cost is an
important issue in project development.
Page 24
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/11
CHAPTER 3
MICROCONTROLLER
3.1 Introduction
3.1.1 Microcontroller
Fig.3.1 Block Diagram of Microcontroller
A microcontroller is a single-chip computer. Micro suggests that the device is small, and
controller suggests that it is used in control applications. Another term for microcontroller is
embedded controller, since most of the microcontrollers are built into (or embedded in) the
devices they control. All microcontrollers operate on a set of instructions (or the user
program) stored in their memory. A microcontroller fetches the instructions from its
program memory one by one, decodes these instructions, and then carries out the required
operations. Microcontrollers have traditionally been programmed using the assembly
language of the target device. Although the assembly language is fast, it has several
disadvantages. An assembly program consists of mnemonics, which makes learning and
maintaining a program written using the assembly language difficult. Also, microcontrollers
manufactured by different firms have different assembly languages, so the user must learn a
Page 25
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/12
new language with every new microcontroller he or she uses.
Examples- INTEL
8031, 8032, 8051,8052,8751,8752
PIC
8-bit PIC16, PIC18,
16-bit DSPIC33 / PIC24,
PIC16C7x
Motorola
MC68HC11
3.1.2 Microprocessor
Fig.3.2 Block Diagram Of Microprocessor
A microprocessor differs from a microcontroller in a number of ways. The main distinction
is that a microprocessor requires several other components for its operation, such as
program memory and data memory, input-output devices, and an external clock circuit. A
microcontroller, on the other hand, has all the support chips incorporated inside its single
chip.
Page 26
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/13
Examples-
Intel
4004, 4040
8080, 8085
8086, 8088,
80186, 80188
80286, 80386
X86-64
Motorola
6800
6809
68000
G3, G4, G5
Zilog
Z80, Z180, eZ80
Z8, eZ8
3.2Microprocessor V/s Microcontroller
Microprocessor Microcontroller
The functional blocks are ALU, registers,
timing & control units.
It is more faster as compare to
microcontroller
It includes functional blocks of
microprocessors & in addition has timer,
parallel i/o, RAM, EPROM, ADC &DAC.
Rapid movements of code and data
between external memory & MP.
Many type of bit handling instruction.
It is used for designing general purpose
digital computers system.
They are used for designing application
specific dedicated systems.
Page 27
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/14
A microprocessor is a single chip semi
conductor device also which is a computer
on chip, but not a complete computer.
A microcontroller is a functional computer
system-on-a-chip. It contains a processor,
memory, and programmable input/output
peripherals.
Its CPU contains an ALU, a program
counter, a stack pointer, some working
register, a clock timing circuit and
interrupts circuit on a single chip.
Microcontrollers include an integrated
CPU, memory (a small amount of RAM,
program memory, or both) and peripherals
capable of input and output.
Tab.2 Microcontroller v/s Microprocessor
3.3 Types of Microcontroller
3.3.1 Microcontroller 8031
It is Intel's product. Neither a microprocessor nor a microcontroller.
It is a 8-bit controller. Internally no ROM is provided.
3.3.2 Microcontroller 8051
It is a first complete 8-bit microcontroller.
It is a name of a family in which the instruction set, pin configuration, architecture
are same, only memory storage capacity is different.
Internally PROM (programmable read only memory) is provided so it called one
time programmable (OTP).
3.3.3 Microcontroller AT89C51
Page 28
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/15
It is ATMEL's product. It is a similar to 8051 microcontroller i.e., having same
instruction set, pin configuration, architecture
It is a also 8-bit microcontroller. Its cost is only Rs10 more than 8051.
It uses EPROM or FLASH memory.
It is multiple time programmable (MTP) i.e., 1000 times.
In "AT89C51", C‟ stands for CMOS technology used in themanufacturing of the
I.C.
64KB Program Memory address space
4K bytes of on-chip Program Memory
128 bytes of on-chip Data RAM
Fig.3.3 Pin diagram & architecture of AT89C51
3.4 Pin Description of AT89C51
VCC
Supply Voltage
GND
Ground
Page 29
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/16
Port 0
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port each pin can sink
eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high
impedance inputs. Port 0 may also be configured to be the multiplexed low order
address/data bus during accesses to external program and data memory. In this mode P0
has internal pull ups. Port 0 also receives the code bytes during Flash programming, and
outputs the code bytes during program verification. External pull ups are required during
program verification.
Port 1
Port 1 is an 8-bit bidirectional I/O port with internal pull ups. The Port 1 output buffers can
sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled high by the
internal pull ups and can be used as inputs. As inputs, Port 1 pins that are externally being
pulled low will source current (IIL) because of the internal pull ups. Port 1 also receives the
low-order address bytes low-order address bytes during Flash programming and
verification.
Port 2
Port 2 is an 8-bit bidirectional I/O port with internal pull ups. The Port 2 output buffers can
sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled high by the
internal pull ups and can be used as inputs. As inputs, Port 2 pins that are externally being
pulled low will source current (IIL) because of the internal pull ups. Port 2 emits the high-
order address byte during fetches from external program memory and during accesses to
external data memory that uses 16-bit addresses (MOVX @DPTR). In this application it
uses strong internal pull ups when emitting 1s.
Port 3
Port 3 is an 8-bit bidirectional I/O port with internal pull ups. The Port 3 output buffers can
sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled high by the
internal pull ups and can be used as inputs. As inputs, Port 3 pins that are externally being
Page 30
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/17
pulled low will source current (IIL) because of the pull ups. Port 3 also serves the functions
of various special features of the AT89C51 as listed below.
Port Pin Alternate Functions
P3.0 RXD (serial input port)
P3.1 TXD (serial output port)
P3.2 INT0 (external interrupt 0)
P3.3 INT1 (external interrupt 1)
P3.4 T0 (timer 0 external input)
P3.5 T1 (timer 1 external input)
P3.6 WR (external data memorywrite)
P3.7 RD (external data memory read)
RST
Reset input. A high on this pin for two machine cycles while the oscillator is running resets
the device.
ALE/PROG
Address Latch Enable output pulse for latching the low byte of the address during accesses
to external memory. This pin is also the program pulse input (PROG) during Flash
programming. In normal operation ALE is emitted at a constant rate of 1/6 the oscillator
frequency, and may be used for external timing or clocking purposes. Note, however, that
one ALE pulse is skipped during each access to external Data Memory. If desired, ALE
operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is
active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled
high. Setting the ALE-disable bit has no effect if the microcontroller is in external
execution mode.
PSEN
Program Store Enable is the read strobe to external programmemory. When the AT89C51
Page 31
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/18
is executing code from external program memory, PSEN is activated twice each machine
cycle, except that two PSEN activations are skipped during each access to external data
memory.
EA/VPP
External Access Enable. EA must be strapped to GND in order to enable the device to fetch
code from external program memory locations starting at 0000H up to FFFFH. Note,
however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA
should be strapped to VCC for internal program executions. This pin also receives the 12-
volt programming enable voltage (VPP) during Flash programming, for parts that require
12-volt VPP.
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2
Output from the inverting oscillator amplifier.
3.5 Memory space Allocation in AT89C51
The AT89C51 has three very general types of memory. To effectively program the 8051 it
is necessary to have a basic understanding of these memory types. The memory types are
illustrated in the following graphic. They are: On-Chip Memory, External Code Memory,
and External RAM.
3.5.1 on chip ROM
The AT89C51 has 4K bytes of on-chip ROM. This 4K bytes ROM memory has memory
addresses of 0000 to 0FFFh. Program addresses higher than 0FFFh, which exceed the
internal ROM capacity, will cause the microcontroller to automatically fetch code bytes
from external memory. Code bytes can also be fetched exclusively from an external
memory, addresses 0000h to FFFFh, by connecting the external access pin to ground. The
Page 32
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/19
program counter doesn't care where the code is: the circuit designer decides whether the
code is found totally in internal ROM, totally in external ROM or in a combination of
internal and external ROM.
3.5.2 on chip RAM
The 1289 bytes of RAM inside the 8051 are assigned addresses 00 to 7Fh. These 128
bytes can be divided into three different groups as follows: A total of 32 bytes from
locations 00 to 1Fh are set aside for register banks and the stack. A total of 16 bytes from
locations 20h to 2Fh are set aside for bit addressable read/write memory and instructions.
A total of 80 bytes from locations 30h to 7Fh are used for read and write storage, or what
is normally called a scratch pad.
Fig.3.4 ROM & RAM Memory in 8051 Microcontroller
3.5.3 External Code Memory
External Code Memory is code (or program) memory that resides off-chip. This is often in
the form of an external EPROM.
3.5.4 External RAM
External RAM is RAM memory that resides off-chip. This is often in the form of standard
static RAM or flash refers to any memory (Code, RAM, or other) that physically exists on
the microcontroller itself. On- chip memory can be of several types, but we'll get into that
shortly. External RAM As an obvious opposite of Internal RAM, the 8051 also supports
Page 33
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/20
what is called External RAM. As the name suggests, External RAM is any random access
memory which is found off-chip. Since the memory is off-chip it is not as flexible in terms
of accessing, and is also slower. For example, to increment an Internal RAM location by 1
requires only 1instruction and 1 instruction cycle. To increment 1-byte value stored in
External RAM requires 4 instructions and 7 instruction cycles. In this case, external
memory is 7 times slower.
3.5.5 Code Memory
Code memory is the memory that holds the actual 8051 program that is to be run. This
memory is limited to 64K and comes in many shapes and sizes: Code memory may be
found on-chip, either burned into the microcontroller as ROM or EPROM. Code may also
be stored completely off-chip in an external ROM or, more commonly, an external
EPROM. Flash RAM is also another popular method of storing a program. Various
combinations of these memory types may also be used--that is to say, it is possible to have
4K of code memory on-chip and 64k of code memory off-chip in an EPROM.
3.5.6 Registers
Fig.3.5 Some 8-bit & 16-bit Registers
In the CPU, registers are used to store information temporarily. That information could be
a byte of data to be processed, or an address pointing to the data to be fetched. In the 8051
Page 34
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/21
there is only one data type: 8 bits. With an 8- bit data type, any data larger than 8 bits has
to be broken into 8-bit chunks before it is processed. The most commonly used registers of
the 8051 are A (accumulator), B, R0, R1, R2, R3, R4, R5, R6, R7, DPTR (data pointer)
and PC (program counter). All the above registers are 8-bit registers except DPTR and the
program counter. The accumulator A is used for all arithmetic and logic instructions.
3.5.7 Program Counter & Data Pointer
The program counter is a 16- bit register and it points to the address of the next instruction
to be executed. As the CPU fetches op-code from the program ROM, the program counter
is incremented to point to the next instruction. Since the PC is 16 bit wide, it can access
program addresses 0000 to FFFFH, a total of 64K bytes of code. However, not all the
members of the 8051 have the entire 64K bytes of on-chip ROM installed.The DPTR
register is made up of two 8-bit registers, DPH and DPL, which are used to furnish memory
addresses for internal and external data access. The DPTR is under the control of program
instructions and can be specified by its name, DPTR. DPTR does not have a single internal
address; DPH and DPL are assigned an address each.
3.5.8 Flag Bits & PSW Registers
Like any other microprocessor, the 8051 have a flag register to indicate arithmetic
conditions such as the carry bit. The flag register in the 8051 is called the program status
word (PSW) register. The program status word (PSW) register is an 8-bit register. It is also
referred as the flag register. Although the PSW register is 8-bit wide, only 6 bits of it are
used by the microcontroller. The two unused bits are user definable flags. Four of the flags
are conditional flags, meaning they indicate some conditions that resulted after an
instruction was executed. These four are CY (carry), AC (auxiliary carry), P (parity), and
OV (overflow). The bits of the PSW register are shown below: CY PSW.7 Carry flag AC
PSW.6 Auxiliary carry flag -- PSW.5 Available to the user for general purpose RS1 PSW.6
Register bank selector bit 1 RS0 PSW.3 Register bank selector bit 0 OV PSW.2 Overflow
flag F0 PSW.1 User definable bit P PSW.0 Parity flag
Page 35
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/22
CY, the carry flag
This flag is set whenever there is a carry out from the d7 bit. This flag bit is affected after
an 8-bit addition or subtraction. It can also be set to 1 or 0 directly by an instruction such as
"SETB C" and "CLR C" where "SETB C" stands for set bit carry and "CLR C" for clear
carry.
AC, the auxiliary flag
If there is carry from D3 to D4 during an ADD or SUB operation, this bit is set: otherwise
cleared. This flag is used by instructions that perform BCD arithmetic.
P, the parity flag
The parity flag reflects the number of 1s in the accumulator register only. If the register A
contains an odd number of 1s, then P=1. Therefore, P=0 if Ahas an even number of 1s.
OV, the overflow flag
This flag is set whenever the result of a signed number operation is too large, causing the
high order bit to overflow into the sign bit. In general the carry flags are used to detect
errors in unsigned arithmetic operations.
3.6 Memory Addressing in AT89C51
Each microcontroller has a specific addressing range. An addressing range is the number
of addresses a microcontroller can access. The addressing scheme used to access to these
spaces varies from processor to processor, but the underlying hardware is similar.
3.6.1 RAM
Random access memory or RAM consists of memory addresses. The CPU can both read
from and write to RAM is used for data memory and allows the CPU to create and modify
data as it executes the application program. RAM is volatile; it holds its contents only as
long as it has a constant power supply. If power to the chip is turned off, the contents of
RAM are lost. This does not mean that RAM contents are lost during a chip reset. Vital
state information or other data can be recorded in data memory and recovered after an
Page 36
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/23
interrupt or reset. Some chips provide an alternate RAM power supply so that memory
contents can be maintained even when the rest of the chip is without power. This does not
make RAM any less volatile, without a backup power source the contents would still be
lost. This type of RAM is called battery backed-up static RAM.
3.6.2 ROM
ROM, read only memory, is typically used for program instructions. The ROM in a
microcontroller usually holds the final application program. Mask able ROM is memory
space that must be burned in by the manufacturer of the chip as it is constructed. To do
this, we must provide the chip builder with the ROM contents we wish the chip to have.
The manufacturer will then mask out appropriate ROM blocks and hardware the
information you have provided. Since recording chip ROM contents is part of the
manufacturing process, it is a costly one-time expense. If we intend to use a small number
of parts, we may be better off using chips with PROM. If we intend to use a large number
of parts for our application, then the one-time expense of placing our program in ROM is
more feasible.
3.6.3 PROM
Programmable ROM, or PROM, started as an expensive means to prototype and test
application code before burning ROM. In recent years PROM has gained popularity to the
point where many developers consider it a superior alternative to burning ROM. As
microcontroller applications become more specialized and complex, needs for
maintenance and support rise. Many developers use PROM devices to provide software
updates to customers without the cost of sending out new hardware. There are many
programmable ROM technologies available which all provide a similar service. A special
technique isused to erase the contents of programmable ROM then a special method is
used to program new instructions into the ROM. Often, the developer uses separate
hardware to perform each of these steps.
Page 37
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/24
3.6.4 EPROM
EPROM (erasable programmable ROM) is not volatile and is read only. Chips with
EPROM have a quartz window on the chip. Direct exposure to ultra-violet radiation will
erase the EPROM contents. EPROM devices typically ship with a shutter to cover the
quartz window and prevent ambient UV from affecting the memory. Often the shutter is a
sticker placed on the window. Developers use an EPROM eraser to erase memory contents
efficiently. The eraser bombards the memory with high-intensity UV light. To reprogram
the chip, an EPROM programmer is used, a device which writes instructions into EPROM.
The default, blank state for an EPROM device has each block of memory set. When we
erase an EPROM we are really setting all memory blocks to 1. Reprogramming the device
resets or clears the appropriate EPROM bits to 0. Because of the way EPROM storage is
erased, we can't selectively delete portions of EPROM - when we erase the memory we
must clear the entire storage space.
3.6.5 EEPROM
EEPROM (electrically erasable programmable ROM) devices have a significant advantage
over EPROM devices as they allow selective erasing of memory sections. EEPROM
devices use high voltage to erase and re-program each memory block. Some devices
require an external power source to provide the voltage necessary for erasing and writing
and some have an onboard pump which the chip can use to build up a charge of the
required voltage. Developers can reprogram EEPROM devices while the chip is operating.
However, EEPROM that can be rewritten is usually restricted to data memory storage.
EEPROM storage used as program memory typically requires the use of an external power
source and a programmer just like EPROM storage. The most common use for EEPROM is
recording and maintaining configuration data vital to the application. For example, many
modems use EEPROM storage to record the current configuration settings. This makes the
configuration available to the modem user after cycling the power on the modem. Often the
default or factory configuration settings are stored in ROM and the user can issue a
command to restore default settings by overwriting the current contents of EEPROM with
the default information. Sometimes chip manufacturers build EEPROM blocks into the
Page 38
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/25
chip for last-minute configuration options. This saves manufacturers money as they can
design and fabricate a single chip and then set the EEPROM blocks to provide special
purpose versions with specific capabilities. This method is often used to produce
microcontroller versions for use on an evaluation board where chip access to its own
onboard ROM is turned off and replaced with external EPROM or EEPROM storage. This
allows developers to test application code in cycles by downloading it to the board,
programming the code into the EPROM or EEPROM, and debugging it as it executes in
the target hardware.
3.6.6 Flash Memory
Flash memory is an economical compromise between EEPROM and EPROM technology.
As with EEPROM high voltage is applied to erase and rewrite flash memory. However,
unlike EEPROM, you cannot selectively erase portions of flash memory - you must erase
the entire block as with EPROM devices. Many manufacturers are turning to flash
memory. It has the advantages of not requiring special hardware and being inexpensive
enough to use in quantity. Manufacturers often provide customers with microcontroller
products whose ROM is loaded with a boot or configuration kernel where the application
code is written into flash memory. When the manufacturer wants to provide the customer
with added functionality or a maintenance update, the hardware can be reprogrammed on
site without installing new physical parts. The hardware is placed into configuration mode
which hands control to the kernel written in ROM. This kernel then handles the software
steps needed to erase and re-write the contents of the flash memory. Another useful
implementation of flash memory includes a device which can connect electronically to a
computer owned by the manufacturer. The configuration kernel connects to the
manufacturer's computer, downloads the latest version of the control application and writes
this application to flash memory. Such elaborate applications are typically beyond the
resources of an 8 bit microcontroller; we mention the example to show the advantage of
programmable ROM technologies.
Page 39
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/26
3.6.7 Registers
The CPU maintains a set of registers which it uses to store information. Registers are used
to control program execution and maintain intermediate values needed to perform required
calculations. Some microcontrollers provide access to CPU registers for temporary storage
purposes. This can be extremely dangerous as the CPU can at any time overwrite a register
being used for its designated purpose. 8 bit microcontrollers do not often provide resources
for register memory outside the CPU. This means that the C register keyword is
meaningless because the compiler cannot dedicate a CPU register for data storage. Some C
implementations will set aside RAM for special purpose pseudo-registers to use when your
application attempts certain operations. For example, if you attempt a 16 bit math
operation, the compiler can dedicate a portion of base page RAM for 16 bit pseudo-
registers which store values during math operations.
3.7 Fabrication Techniques of AT89C51
3.7.1 CMOS Technology
Complementary Metal Oxide Semiconductor (CMOS) is a technique commonly used to
fabricate microcontrollers. CMOS requires less power and CMOS chips can be static which
allows the implementation of a sleep mode. CMOS microcontrollers must have all inputs
connected to something.
3.7.2 PMP Technology
Post Metal Programming (PMP) allows ROM to be programmed after final metallization.
This allows ROM to be programmed very late in the productions cycle.
Page 40
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/27
CHAPTER 4
ELECTRONICS COMPONENTS
4.1 Introduction
Electronic Components are the major building blocks of all electronic circuits which make up
complete & desirable circuits. Without this we cannot think about electronic circuits design
&development. it is also responsible for size & cost of electronics devices &circuits. There
are some basic electronics components which are very important for about all the electronics
circuits which are as follows:-
4.1.1 Resistor
Resistors restrict the flow of electric current, for example a resistor is placed in series with a
light emitting diode(LED) to limit the current passing through the LED.
Fig.4.1 Resistor Color coding
Page 41
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/28
4.1.2 Capacitor
As the name suggests tend to store electricity like a minibattery.measured in
faradays(F).0.00000F=0.000000001=1pf.also need to note rated voltages.
Fig.4.2Charging, Charged& Discharging Of Capacitor
4.1.3 Inductor
Inductor is used to produce a magnetic field when a certain current is passed through a
coil of wire. The wire is coiled on a soft iron core. Have applications in motors, and tank
circuits. Abbreviated as ‘L’.
Fig.4.3 Inductor & its Circuit Symbool
4.1.4 Diode
A diode is used to allow electric current to flow in only one direction. Abbreviated as
‘D’.
Fig.4.4 Diode & its Circuit symbol
Page 42
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/29
4.1.5 Transistor
It is three terminal semiconductor device developed to switching and amplifying the
electronics circuits. it comes in a large number of different varieties, shapes& sizes.
Fig.4.5 Transistor & its circuit symbol
4.1.6 Potentiometer
It is variable resistors have a resistance that varies according to themechanical position of
one of its wiper.
Fig.4.6 Potentiometer & its circuit symbol
4.1.7 Switches & Push Button
It is used to Connect and disconnect circuits.
Fig.4.7 Switches & its circuit symbol
Page 43
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/30
4.1.8 Solenoid
In solenoid if current is passed through the coil a magnetic field is created. it is used to
release latches, lock parts in place, etc.
Fig.4.8 Solenoid & its circuit symbol
4.1.9 Motor:-
A Family of components that uses sequence electricity and magnetism to make
movement. Voltage, Current, Torque & RPM often specified.
Fig.4.9 Motor & its circuit symbol
4.1.10 Relay
It is a electromechanical switches. on applying a current to the coil the connected
switches are connected and disconnected. Cars use relays to switch 12V, 500A!Silicon
relays also available with no movingparts.
Fig.4.10 Relays & its circuit symbol
Page 44
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/31
4.1.11 Buzzer
It is used to produce an output sound corresponding to the electrical energy in the input.
Fig.4.11 Buzzer Circuit Symbool
4.1.12 Light Emitting Diode (LED)
Led is used to emit light when a current is passed through the device. It is abbreviated as
Led.
Fig.4.12Various Types Of LED’s
Fig.4.13 Infrared Detector
Page 45
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/32
4.1.13 Photo resistor
It is Light sensitive variable resistors. Its resistance depends on the intensity of light
incident upon it. Under dark condition, resistance is quite high. and Under bright
condition, resistance is lowered.
Fig.4.14 Photo resistor& its symbol
4.1.14 Photodiode
• Photodiode is a 2 lead semiconductor device that transforms light energy to electric
current.
• Suppose anode and cathode of a photodiode are wired to a current meter.
-When photodiode is placed in dark, the current meter displays zero current flow.
– When the photodiode is expose to light, it acts a a current source, causing current flow
from cathode to anode of photodiode through the current meter.
• Photodiodes have very linear light v/s current characteristics.
– Commonly used as light meters in cameras.
Fig.4.15 Photodiode & its symbol
Page 46
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/33
4.1.15 Phototransistor
• Phototransistor is a light sensitive transistor.
• In one common type of phototransistor, the base lead of a BJT is replaced by a
lightsensitive surface.
• When the light sensitive surface @ the base is kept in darkness, the collector-emitterpair
of the BJT does not conduct.
• When the light sensitive surface @ the base is exposed to light, a small amount ofcurrent
flows from the base to the emitter. The small base-emitter current controlsthe larger
collector-emitter current.
• Alternatively, one can also use a field-effect phototransistor (Photo FET).
• In a photo FET, the light exposure generates a gate voltage which controls adrain source
current.
Fig.4.16 Phototransistor & its Symbool
4.1.16 7-Segement Led Display
• Used for displaying numbers and other characters.
• 7 individual LEDs are used to make up the display.
• When a voltage is applied across one of the LEDs, a portion of the 8 lights up.
• Unlike liquid crystal displays (LCD), 7-segment LED displays tend to be
morerugged, but they also consume more power.
Page 47
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/34
Fig.4.17 7-segement led display & its Pin out Diagram
4.1.17 Transformer
It is used as an ac power supply. Consists of two coils, the primary and secondary that are
linked together through an iron core. There is no physical connection between the two
coils. The principle of mutual inductance is used to obtain power. Abbreviated as ‘T’.
Fig.4.18 Transformer & its Circuit Symbool
4.1.18 IC 7805 Voltage Regulator IC
7805 is a voltage regulator integrated circuit. It is a member of 78xx series of fixed linear
voltage regulator ICs. The voltage source in a circuit may have fluctuations and would not
give the fixed voltage output. The voltage regulator IC maintains the output voltage at a
constant value. The xx in 78xx indicates the fixed output voltage it is designed to provide.
7805 provides +5V regulated power supply. Capacitors of suitable values can be connected
at input and output pins depending upon the respective voltage levels.
Page 48
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/35
Fig.4.19 LM7805 IC & its Pin out Diagram
Pin Description
Tab.3 Pin Description of 7805 IC
4.1.19 LM324 IC
LM324 is a 14pin IC consisting of four independent operational amplifiers (op-amps)
compensated in a single package. Op-amps are high gain electronic voltage amplifier with
differential input and, usually, a single-ended output. The output voltage is many times
higher than the voltage difference between input terminals of an op-amp. These op-amps
are operated by a single power supply LM324 and need for a dual supply is eliminated.
They can be used as amplifiers, comparators, oscillators, rectifiers etc. The conventional op-
Pin No Function Name
1 Input
voltage
(5v-18v)
input
2 Ground
(0v)
ground
3 Regulated
Output(4.
8v-5.2v)
output
Page 49
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/36
amp applications can be more easily implemented with LM324.
Fig.4.20 LM324 IC& Its Pin out Diagram
Pin description
Pin No Function Name
1 Output of 1st t
comparator
Output1
2 Inverting input of
1st comparator
Input1-
3 No inverting input
of 1st comparator
Input1+
4 Supply voltage 5v
(up to 32v)
vcc
5 No inverting input
of 2nd
comparator
Input2+
6 Inverting input of
2nd
comparator
Input2-
7 Output of 2nd
comparator
Output2
8 Output of 3rd
Output3
Page 50
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/37
comparator
9 Inverting input of
3rd
comparator
Input3-
10 No inverting input
of 3rd
comparator
Input3+
11 Ground (0v) Ground
12 No inverting input
of 4th
comparator
Input4+
13 Inverting input of
4th
comparator
Input4-
14 Output of 4th
comparator
Output4
Tab.4 Pin Description Of LM 324 IC
4.1.20 555 Timers IC
555 is a very commonly used IC for generating accurate timing pulses. It is an 8pin timer IC
and has mainly two modes of operation: monostable and a stable. In monostable mode time
delay of the pulses can be precisely controlled by an external resistor and a capacitor
whereas in a stable mode the frequency & duty cycle are controlled by two external resistors
and a capacitor. 555 is very commonly used for generating time delays and pulses.
Fig.4.21 555Timer IC & Its Pin out Diagram
Page 51
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/38
Pin Description
Pin No Function Name
1 Ground
(0V)
Ground
2 Voltage below 1/3 Vcc
to trigger the pulse
Trigger
3 pulsating
output
output
4 Active low; interrupts the
timing interval at Output
Reset
5 Provides access to the
internal voltage divider;
default 2/3 Vcc
Control voltage
6 The pulse ends when the
voltage is greater than
Control
Threshold
7 Open collector output; to
discharge the capacitor
Discharge
8 Supply voltage; 5V (4.5V -
16 V)
Vcc
Tab.5 Pin Description Of 555 Timer IC
Page 52
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/39
4.1.21 RF Module
The RF module, as the name suggests, operates at Radio Frequency. The corresponding
frequency range varies between 30 kHz & 300 GHz. In this RF system, the digital data is
represented as variations in the amplitude of carrier wave. This kind of modulation is
known as Amplitude Shift Keying (ASK). Transmission through RF is better than IR
(infrared) because of many reasons. Firstly, signals through RF can travel through larger
distances making it suitable for long range applications. Also, while IR mostly operates
in line-of-sight mode, RF signals can travel even when there is an obstruction between
transmitter & receiver. Next, RF transmission is more strong and reliable than IR
transmission. RF communication uses a specific frequency unlike IR signals which are
affected by other IR emitting sources. This RF module comprises of an RF Transmitter
and an RF Receiver. The transmitter/receiver (Tx/Rx) pair operates at a frequency of 434
MHzan RF transmitter receives serial data and transmits it wirelessly through RF
through its antenna connected at pin4. The transmission occurs at the rate of 1Kbps -
10Kbps.The transmitted data is received by an RF receiver operating at the same
frequency as that of the transmitter. The RF module is often used along with a pair of
encoder/decoder. The encoder is used for encoding parallel data for transmission feed
while reception is decoded by a decoderHT12E-HT12D. HT640-HT648, etc. are some
commonly used encoder/decoder pair ICs.
Fig.4.22 RF Transmitter & Receiver circuit
Page 53
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/40
Pin Description
Pin No Function Name
1 Ground (0V) Ground
2 Serial data input pin Data
3 Supply voltage; 5V Vcc
4 Antenna output pin ANT
Tab.6 Pin Description of RF Transmitter
Pin No Function Name
1 Ground (0V) Ground
2 Serial data output pin Data
3 Linear output pin;
not connected
NC
4 Supply voltage; 5V VCC
5 Supply
voltage;
5V
VCC
6 Ground (0V) Ground
7 Ground (0V) Ground
8 Antenna
input
pin
ANT
Tab.7 Pin Description Of RF Receiver
Page 54
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/41
4.1.22 LCD
LCD (Liquid Crystal Display) screen is an electronic display module and find a wide
range of applications. A 16x2 LCD display is very basic module and is very commonly
used in various devices and circuits. These modules are preferred over seven segments and
other multi segment LEDs. The reasons being: LCDs are economical; easily
programmable; have no limitation of displaying special & even custom characters (unlike
in seven segments), animations and so on. A 16x2 LCD means it can display 16 characters
per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel
matrix. This LCD has two registers, namely, Command and Data. The command register
stores the command instructions given to the LCD. A command is an instruction given to
LCD to do a predefined task like initializing it, clearing its screen, setting the cursor
position, controlling display etc. The data register stores the data to be displayed on the
LCD. The data is the ASCII value of the character to be displayed on the LCD.
Fig.4.23 LCD & Its Pin out Diagram
Page 55
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/42
Pin Description
Pin No Function Name
1 Ground
(0V)
Ground
2
3
Supply voltage; 5V (4.7V -
5.3V)
Contrast adjustment; through a variable
resistor
VCC
Vcc
4 Selects command register when low; and data register
when high
Vee
5 Low to write to the register; High to read from the
register
Register Select
6 Sends data to data pins when a high to low pulse is
given
Read/Write
7 8-bit data pins
Enable
8 DB0
9 DB1
10 DB2
11 DB3
12 DB4
13 DB5
14 DB6
15 DB7
16 Backlight
VCC (5V) Led+
17 Backlight
Ground (0V) Led-
Tab.8Pin Description Of LCD Display
Page 56
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/43
CHAPTER 5
“C’’PROGRAMMING
5.1 Introduction
“C” is a general purpose, high-level programming language developed by Kernighan and
Ritchie at& T Bell labs between 1969 and 1973.Several programmer preferred C to other
programming language of that time like PL/1,ALGOL,COBOL,FORTRAN,Pascal,and
APL.soon C become the most popular programming language because it is
reliable,simple,and easy to use. In Embedded system design It is very Important language
for programming of various microcontroller IC’s.The overall working & processing of
Embedded system is only depends upon the program run on its controller IC’s.
5.2 “C” Statement Type
.Simple Variable Assignment
include input/output data transfers
Arithmetic Operations
Logical/Shift Operations
Control Structure
- IF, WHEN, FOR, SELECT
- Function Calls
- User-defined and /or library functions
5.3 Basic Structure
#include<reg51.h>
Intcount, bob;
Intfunction1 (char x)
{
Int i, j;
}
Page 57
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/44
Voidmain ()
{
5.4 Statements in “C”
5.4.1 Switch Statement
Compact alternative to ELSE-IF structure, formultiday decision that tests one
variable or expression for a number of constant values.
/* example equivalent to that on preceding slide */
Switch (n) { //n is the variable to be tested
Case 0: statement1; //do if n==0
Case 1: statement2; //do if n==1
Case 2: statement3; //do if n==2
Default: statement4; //if for any other n value
}
5.4.2 WHILE loop Structure
Repeat a set of statements (a “loop”) as long as some condition is met.
While (a<b)
{
Statement s1;
Statement s2;
…..
}
Example-
/* add two 200-element arrays.*/
Page 58
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/45
Int M [200]; N [200]; P [200];
Int k;
/*method 1-using DO_WHILE */
K=0;
Do
{
M[k]=N[k]+P[k];
K=k+1;
}
While (k<200);
/* method 2-using WHILE loop*/
K=0;
While (k<200);
M[k]=N[k]+P[k];
K=k+1
}
5.4.3 DO-WHILE loop Structure
Repeat a set of statements (one “loop”) until some condition is met.
Do
Statement s1;
Statement s2;
…While (a<b);
Example-
Page 59
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/46
#define MAX_ALLOWED 128
#define LIGHT_ON1
#define LIGHT_OFF0
Do
{
LIGHT_PORT=LIGHT_ON;
Delay ();
LIGHT_PORT=LIGHT_OFF;
Delay ();
}
While (AD_PORT<=MAX_ALLOWED);
5.4.4 FOR loop structure
Repeat a set of statements (one “loop”) while some condition is met.
For (m=0; m<200; m++)
{
Statement s1;
Statement s2;
}
Examples-
/* Nested FOR loops to create a time delay*/
For (i=0; i<100; i++)
{
For (j=0; j<1000; j++)
Page 60
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/47
{
}}
5.5 Function
- Calling Program can pass information to a function in two ways
- -By value: pass a constant or a variable value
Function can use, but not modify the value
- -By reference: pass the address of the variable
Function can both read and update the variable
- -values/addresses are typically passed to the function by pushing them
onto the system stack.
Example (Pass by value)-
/* Function to calculate x2 */
Int square (int x)
{
Int y;
Y=x*x;
Return(x);
}
Void main ()
Int k,n;
N=5;
K=square (n);
Page 61
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/48
N=square (5);
}
Example (pass by reference)-
/* Function to calculate x2 */
Int square (int x,int * y)
{
*y=x*x;
}
Void main ()
{
Int k, n;
N=5;
Square (n, &k);
Square (5, &n);
}
Int rcv_data [10];
Int rcv_count;
Void SCI_receive ()
{
While (SCISR1 & 0x20)==0)
{
}
Page 62
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/49
5.6 Program
5.6.1 WAP to Perform Table of Two
#include<reg51.h>
Char arr [10]={0xbf,0x86,0xdb,0xcf,0xe6,0xed,0xfd,0x87,0xff,0xef};
Void delay ()
{
Int f;
For (f=0; f<500; f++);
}
Void main ()
{
Int a, b, c;
For (a=0; a<2; a++)
{
For (b=0; b<10; b=b+2)
{
For (c=0; c<50; c++)
{
P1=0x01;
P2=arr[b];
Delay();
P1=0x02;
P2=arr[a];
Delay();\
Page 63
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/50
}}}
For (a=2;a<3;a++)
{
For (b=0;b<1;b++)
{
For (c=0;c<50;c++)
{
P1=0x01;
P2=arr[b];
Delay();
P1=0x02;
P2=arr[a];
Delay ();
}}}
5.6.2 WAP To ON & OFF Relay
#include<reg51.h>
Sbit relay1=p1^0;
Sbit relay2=p1^1;
Void delay ()
{
Int I;
For (i=0;i<=30000;i++);
}
Page 64
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/51
Void main ()
{
While (1)
{
Relay1=1; //Relay1 ON
Relay2=1; //Relay2 ON
Delay ();
Relay1=0; //Relay1 is OFF
Relay2=0; //Relay2 is OFF
Delay ();
}}
Page 65
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/52
CHAPTER 6
PROJECT OVERVIEW
6.1 Introduction
Project title is “Automatic Room Light Controller With Bidirectional Visitor
Counter”.The objective of this project is to make a controller based model to count
number of persons visiting particular room and accordingly light up the room. Here we
can use sensor and can know present number of persons in today’s world, there is a
continuous need for automatic appliances. With the increase in standard of living, there is
a sense of urgency for developing circuits that would ease the complexity of life. Also if
at all one wants to know the number of people present in room soaps not to have
congestion, this circuit proves to be helpful.
This project "automatic room light controller with visitor counter using microcontroller"
is a reliable circuit that takes over the task of persons/visitor in the room very accurately.
When somebody enters into the room will be switched ON and when any one. The light
in room will be only switched OFF until all the persons in the room go out. The total
number of person inside the room also displayed on the seven segment displays.
Fig .6.1 Circuit Description of BDVC
6.2 Circuit Components
5 Resistor of 330 ohms
2 Variable Resistor of 20K ohms
Page 66
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/53
2 Variable Resistor of 50Kohms
2 Electrolytic Capacitor
4 Ceramic Capacitor 104
2 Ceramic Capacitor 33 pF
11.0592 MHz crystal Oscillator
AT89S52
7805
7812
3 LED
Reset Key
2 Relay
ULN2803 Relay Driver IC
LM324 IC
IR LED
IR Phototransistor
6.3 Circuit Block Diagram
Fig.6.2 Block Diagram of BDVC
Page 67
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/54
6.4 Circuit Flow Chart
Fig.6.3 Flow Chart Of BDVC
6.5 Circuit Design
The heart of the circuit design lies in designing the microcontroller interface. Here we
use the microcontroller AT89S52.The microcontroller AT89S52 is interfaced to the IR
sensor pairs at two ports pins - P1.0 and P1.1 respectively. The 7 segment display is
interfaced to the microcontroller at port P2.Another important aspect of the design
involves designing the oscillator circuit and the reset circuit. The oscillator circuit is
designed by selecting a 11.0592MHz quartz crystal and two ceramic capacitors- each
33pF. The reset circuit is designed by selecting an electrolyte capacitor of 10uF to ensure
a reset pulse width of 100ms and reset pin voltage drop of 1.2V.The sensor circuit is
designed by selecting appropriate value of resistors for both the LED and the
phototransistor.
Page 68
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/55
Fig.6.4 PCB Layout Of BDVC
6.6 Circuit Description
There are mainly two parts of the circuits:-
6.6.1 Transmitter Circuit (Infrared)
This circuit diagram shows a 555 timer IC, configured to function as a basic actable
multivibrator.The stable multivibratorgenerates square wave, the period of which is
determined by the circuit it external to IC 555. The stable multivibrator does not require
any external trigger to change the state of the output. Hence the name free running
oscillator. The time during which the output is either high or low is determined by the
two resistors or a capacitor which are externally connected to the 555 timer. In this
circuit, a negative pulse applied at pin 2 triggers an internal flip-flop that turns off pin 7's
discharge transistor, allowing C1 to charge up throughR1. At the same time, the flip-flop
brings the output (pin 3) level to 'high’. When capacitor C1 as charged up to about 2/3
Vcc, the flip-flop is triggered once again, this time making the pin 3 output 'low' and
turning on pin 7's discharge transistor, which discharges C1 to ground. This circuit, in
effect, produces a pulse at pin 3 whose width t is just the product of R1 and C1, i.e.,
t=R1C1.IR Transmission circuit is used to generate the modulated 36 kHz IR signal. The
IC555 in the transmitter side is to generate 36 kHz square wave. Adjust the preset in the
Page 69
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/56
transmitter to get a 38 kHz signal at the o/p. Then you point it over the sensor and its o/p
will go low when it senses the IR signal of 38 kHz.
Fig.6.5 Transmitter Circuit of BDVC
6.6.2 Receiver Circuit (Sensors)
The IR transmitter will emit modulated 38 kHz IR signal and at the receiver we use
TSOP1738 (Infrared Sensor). The output goes high when there is an interruption and it
return back to low after the time period determined by the capacitor and resistor in the
circuit i.e. around 1 second. CL100 is to trigger theIC555 which is configured as
monostable multivibrator. Input is given to the Port 1of the microcontroller. Port 0 is
used for the 7-Segment display purpose. Port 2 is used for the Relay Turn On and Turn
off Purpose.LTS 542 (Common Anode) is used for 7- Segment display and that time
Page 70
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/57
Relay will get voltage and triggered, so light will get voltage and it will turn on and
when counter will be 00 and at that time Relay will be turned off. Reset button will reset
the microcontroller.
Fig.6.6 Receiver Circuit Of BDVC
6.7 Operation
When the system is powered, the compiler initially initializes the stack pointer and all
other variables. It then scans the input ports (PortP1.0 first). In the meantime, when there
is no interruption between the IR LED and the phototransistor of the first sensor pair, the
output of the phototransistor is always at low voltage. In other words port P1.0 is at logic
low level. Now when a transition takes place, i.e. a logic high level is received at port
P1.0, the compiler sees this as an interruption to sense the passage of a person or an
object between the IR LED and the phototransistor. As per the program, the count value
Page 71
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/58
is increased and this value is displayed on the Counter. Now the compiler starts scanning
the other input pin-P1.1. Similar to the first sensor pair, for this sensor pair also the
phototransistor conducts in absence of any interruption and P1.1 is at logic low level. In
case of an interruption, the pin P1.1 goes high and this interruption is perceived by
decreasing the value of count. The program ensures that the scanning of both the port
pins is done at certain delays so as to avoid confusion of reading. For instance port P1.0 is
scanned for two or three interruptions so as to ensure the count value is above 1 or 2.
6.8 Applications
This circuit can be used domestically to get an indication of number of persons
entering a party.
It can be used at official meetings.
It can be used at homes and other places to keep a check on the number of persons
entering a secured place.
It can also be used as home automation system to ensure energy saving by switching
on the loads and fans only when needed.
6.9 Limitations
It is a theoretical circuit and may require few changes in practical implementation.
It is a low range circuit and cannot be implemented at large areas.
With frequent change in the count value, after a certain time the output may look
confusing.
6.10 Project Program
#include<reg51.h>
Sbit IR=p1^0;
Void delay ()
{
Int I;
For (i=0;i<=30000;i++);
}
Page 72
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/59
Void main()
{
While (!)
{
IR=0;
If (IR==1)
{
P0=0xff;
Delay ();
P0=0xoo;
Delay ();
}]
Int I;
Char arr [] = (‘’0xff…ffx0)
TMOD=0x20;
SCON=0x50;
TH1=0xfd;
TR1=1;
While (1)
{
For (i=0;i<21;i++)
{
SBUF=array[i];
While (T1==0);
T1=0;
}}}
Mov R1=0xff
Mov R2=ffx0
}}
END.
Page 73
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/60
CHAPTER 7
CONCLUSION
7.1 Introduction
This part of the report describes the overall result and conclusion made during the training
period.
7.2 Lesson Learned
Basics Of Embedded System
Medium Level Circuit Designing
Faults Diagnosis in Circuits
PCB Designing &Embedded C Programming
Introduction Of Various Electronics Components
Key Learning
Enhancement in Technical knowledge
Work Experience With Professionals
Industrial Exposure
7.3 Knowledge Gained
The training at”ARmbedded Electronics Pvt. Ltd.”, Jaipur provided me an insight on
embedded system technology and recent trends in industry. This training also helped me
in my overall personality development by interaction with many trainees and the staff
members. It provided me Industrial Exposure, and the working experience with real life
professionals which will certainly help me in my career ahead.
Page 74
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/61
7.4 Suitability of Organization
The organization is suitable for any product based on an embedded system. The whole
staff is very co- operative. This organization provides a healthy environment for trainees
that help them to develop a sense of professionalism in relation to job skills. ARM bedded
Electronics Pvt. Ltd., channelizes the formidable global project expertise of embedded
projects, tailored to match industry needs. ARM bedded Electronics Pvt. Ltd offers job
ready training programs for the beginners & skill enhancement program for those who are
already employed in industry. Sample practicing on Real Time Projects makes participants
productive in their jobs. At ARM bedded Electronics Pvt. Ltd we create Global
Professionals.ARMbedded Electronics Pvt. Ltd.Jaipur employs highly qualified
professionals with PhD’s, M.Tech. &, B.Tech.'s,. We havewell disciplinary team comprising
education experts, subject matter experts, instructional designers, quality experts,
Academic advisors, experienced placement officers, project Managers & team leaders.
Page 75
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/62
CHAPTER 8
REFERENCE
Reference Books
1. Programming in ANSI C: E BALAGURUSAMY
2. The 8051 and embedded systems: MUHAMMAD ALI MAZIDI
3. Electronics Devices &Circuits: RAJEEV TIWARI
4. The 8051 microcontroller: KENNETH J. AYALA
Reference Websites
1. www.google.com
2. www.enclopedia.com
3. www.wikipedia.com
4. www.electronicsforyou.com
5. www.armbeddedindia.org
6. www.datasheets4u.com
Page 76
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/63
Page 77
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/64
Page 78
ARMbedded Electronics Pvt. Ltd.
JIT/DOEC/2014-15/PTS/65