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

Introduction To Embbeded Systems

This document provides an overview of embedded systems including: - Chapter 1 introduces embedded systems, their characteristics including being self-contained programs embedded in hardware, and their design. - Subsequent chapters will cover microcontrollers, power supply, software tools, stepper motors, and programming. - Embedded systems incorporate microprocessors to perform dedicated applications and simplify system design. They are designed for efficiency and specific tasks.

Uploaded by

Saikiran Reddy
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views

Introduction To Embbeded Systems

This document provides an overview of embedded systems including: - Chapter 1 introduces embedded systems, their characteristics including being self-contained programs embedded in hardware, and their design. - Subsequent chapters will cover microcontrollers, power supply, software tools, stepper motors, and programming. - Embedded systems incorporate microprocessors to perform dedicated applications and simplify system design. They are designed for efficiency and specific tasks.

Uploaded by

Saikiran Reddy
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 42

CONTENTS

CHAPTER 1: INTRODUCTION TO EMBBEDED SYSTEMS.

CHAPTER 2: INTRODUCTION TO MICRO CONTROLLERS.

CHAPTER 3: POWER SUPPLY.

CHAPTER 4: INTRODUCTION TO KIEL SOFTWARE.

CHAPTER 5: STEPPER MOTOR.

CHAPTER 6: ULN DRIVER.

CHAPTER 7: PROGRAM.
CHAPTER 1

INTRODUCTION TO EMBEDDED SYSTEMS:

Embedded systems are electronic devices that incorporate


microprocessors with in their implementations. The main purposes of the
microprocessors are to simplify the system design and provide flexibility. Having a
microprocessor in the device helps in removing the bugs, making modifications, or
adding new features are only matter of rewriting the software that controls the device.
Or in other words embedded computer systems are electronic systems that include a
microcomputer to perform a specific dedicated application. The computer is hidden
inside these products. Embedded systems are ubiquitous. Every week millions of tiny
computer chips come pouring out of factories finding their way into our everyday
products.

Embedded systems are self-contained programs that are embedded


within a piece of hardware. Whereas a regular computer has many different applications
and software that can be applied to various tasks, embedded systems are usually set to
a specific task that cannot be altered without physically manipulating the circuitry.
Another way to think of an embedded system is as a computer system that is created
with optimal efficiency, thereby allowing it to complete specific functions as quickly as
possible.

Embedded systems designers usually have a significant grasp of


hardware technologies. They use specific programming languages and software to
develop embedded systems and manipulate the equipment. When searching online,
companies offer embedded systems development kits and other embedded systems
tools for use by engineers and businesses.

Embedded systems technologies are usually fairly expensive due to the


necessary development time and built in efficiencies, but they are also highly valued in
specific industries. Smaller businesses may wish to hire a consultant to determine what
sort of embedded systems will add value to their organization.
CHARACTERISTICS:

Two major areas of differences are cost and power consumption. Since
many embedded systems are produced in tens of thousands to millions of units range,
reducing cost is a major concern. Embedded systems often use a (relatively) slow
processor and small memory size to minimize costs.

The slowness is not just clock speed. The whole architecture of the computer is often
intentionally simplified to lower costs. For example, embedded systems often use
peripherals controlled by synchronous serial interfaces, which are ten to hundreds of
times slower than comparable peripherals used in PCs. Programs on an embedded
system often run with real-time constraints with limited hardware resources: often there
is no disk drive, operating system, keyboard or screen. A flash drive may replace
rotating media, and a small keypad and LCD screen may be used instead of a PC's
keyboard and screen.

Firmware is the name for software that is embedded in hardware devices,


e.g. in one or more ROM/Flash memory IC chips. Embedded systems are routinely
expected to maintain 100% reliability while running continuously for long periods,
sometimes measured in years. Firmware is usually developed and tested too much
harsher requirements than is general-purpose software, which can usually be easily
restarted if a problem occurs.

PLATFORM:

There are many different CPU architectures used in embedded designs.


This in contrast to the desktop computer market which is limited to just a few competing
architectures mainly the Intel/AMD x86 and the Apple/Motorola/IBM Power PC’s which
are used in the Apple Macintosh. One common configuration for embedded systems is
the system on a chip, an application-specific integrated circuit, for which the CPU was
purchased as intellectual property to add to the IC's design.

TOOLS:
Like a typical computer programmer, embedded system designers use
compilers, assemblers and debuggers to develop an embedded system. Those
software tools can come from several sources:

Software companies that specialize in the embedded market Ported from


the GNU software development tools. Sometimes, development tools for a personal
computer can be used if the embedded processor is a close relative to a common PC
processor. Embedded system designers also use a few software tools rarely used by
typical computer programmers. Some designers keep a utility program to turn data files
into code, so that they can include any kind of data in a program. Most designers also
have utility programs to add a checksum or CRC to a program, so it can check its
program data before executing it.

OPERATING SYSTEM:
They often have no operating system, or a specialized embedded
operating system (often a real-time operating system), or the programmer is assigned to
port one of these to the new system.

DEBUGGING:
Debugging is usually performed with an in-circuit emulator, or some type
of debugger that can interrupt the micro controller’s internal microcode. The microcode
interrupt lets the debugger operate in hardware in which only the CPU works. The CPU-
based debugger can be used to test and debug the electronics of the computer from the
viewpoint of the CPU.

Developers should insist on debugging which shows the high-level


language, with breakpoints and single stepping, because these features are widely
available. Also, developers should write and use simple logging facilities to debug
sequences of real-time events. PC or mainframe programmers first encountering this
sort of programming often become confused about design priorities and acceptable
methods. Mentoring, code-reviews and ego less programming are recommended.

DESIGN OF EMBEDDED SYSTEMS:

The electronics usually uses either a microprocessor or a microcontroller.


Some large or old systems use general-purpose mainframes computers or
minicomputers.

START-UP:

All embedded systems have start-up code. Usually it disables interrupts,


sets up the electronics, tests the computer (RAM, CPU and software), and then starts
the application code. Many embedded systems recover from short-term power failures
by restarting (without recent self-tests). Restart times under a tenth of a second are
common.

Many designers have found one of more hardware plus software-


controlled LED’s useful to indicate errors during development (and in some instances,
after product release, to produce troubleshooting diagnostics). A common scheme is to
have the electronics turn off the LED(s) at reset, whereupon the software turns it on at
the first opportunity, to prove that the hardware and start-up software have performed
their job so far. After that, the software blinks the LED(s) or sets up light patterns during
normal operation, to indicate program execution progress and/or errors. This serves to
reassure most technicians/engineers and some users.

THE CONTROL LOOP:


In this design, the software has a loop. The loop calls subroutines. Each
subroutine manages a part of the hardware or software. Interrupts generally set flags, or
update counters that are read by the rest of the software. A simple API disables and
enables interrupts. Done right, it handles nested calls in nested subroutines, and
restores the preceding interrupt state in the outermost enable. This is one of the
simplest methods of creating an exocrine.

Typically, there's some sort of subroutine in the loop to manage a list of software
timers, using a periodic real time interrupt. When a timer expires, an associated
subroutine is run, or flag is set. Any expected hardware event should be backed-up with
a software timer. Hardware events fail about once in a trillion times.

State machines may be implemented with a function-pointer per state-machine


(in C++, C or assembly, anyway). A change of state stores a different function into the
pointer. The function pointer is executed every time the loop runs.

Many designers recommend reading each IO device once per loop, and storing
the result so the logic acts on consistent values. Many designers prefer to design their
state machines to check only one or two things per state. Usually this is a hardware
event, and a software timer. Designers recommend that hierarchical state machines
should run the lower-level state machines before the higher, so the higher run with
accurate information.

Complex functions like internal combustion controls are often handled with multi-
dimensional tables. Instead of complex calculations, the code looks up the values. The
software can interpolate between entries, to keep the tables small and cheap.

One major disadvantage of this system is that it does not guarantee a time to
respond to any particular hardware event. Careful coding can easily assure that nothing
disables interrupts for long. Thus interrupt code can run at very precise timings. Another
major weakness of this system is that it can become complex to add new features.
Algorithms that take a long time to run must be carefully broken down so only a little
piece gets done each time through the main loop.This system's strength is its simplicity,
and on small pieces of software the loop is usually so fast that nobody cares that it is
not predictable. Another advantage is that this system guarantees that the software will
run. There is no mysterious operating system to blame for bad behavior.

USER INTERFACES:

Interface designers at PARC, Apple Computer, Boeing and HP minimize the


number of types of user actions. For example, use two buttons (the absolute minimum)
to control a menu system (just to be clear, one button should be "next menu entry" the
other button should be "select this menu entry"). A touch-screen or screen-edge buttons
also minimize the types of user actions.

Another basic trick is to minimize and simplify the type of output. Designs
should consider using a status light for each interface plug, or failure condition, to tell
what failed. A cheap variation is to have two light bars with a printed matrix of errors that
they select- the user can glue on the labels for the language that she speaks.

For example, Boeing's standard test interface is a button and some lights.
When you press the button, all the lights turn on. When you release the button, the
lights with failures stay on. The labels are in Basic English.

Designers use colors. Red defines the users can get hurt- think of blood.
Yellow defines something might be wrong. Green defines everything's OK.

Another essential trick is to make any modes absolutely clear on the


user's display. If an interface has modes, they must be reversible in an obvious way.
Most designers prefer the display to respond to the user. The display should change
immediately after a user action. If the machine is going to do anything, it should start
within 7 seconds, or give progress reports.

One of the most successful general-purpose screen-based interfaces is


the two menu buttons and a line of text in the user's native language. It's used in
pagers, medium-priced printers, network switches, and other medium-priced situations
that require complex behavior from users. When there's text, there are languages. The
default language should be the one most widely understood.
CHAPTER 2

INTRODUCTION TO MICROCONTROLLER:

Microcontrollers as the name suggests are small controllers. They are like
single chip computers that are often embedded into other systems to function as
processing/controlling unit. For example the remote control you are using probably has
microcontrollers inside that do decoding and other controlling functions. They are also
used in automobiles, washing machines, microwave ovens, toys ... etc, where
automation is needed.

Micro-controllers are useful to the extent that they communicate with other
devices, such as sensors, motors, switches, keypads, displays, memory and even other
micro-controllers. Many interface methods have been developed over the years to solve
the complex problem of balancing circuit design criteria such as features, cost, size,
weight, power consumption, reliability, availability, manufacturability. Many
microcontroller designs typically mix multiple interfacing methods. In a very simplistic
form, a micro-controller system can be viewed as a system that reads from (monitors)
inputs, performs processing and writes to (controls) outputs.

Embedded system means the processor is embedded into the required


application. An embedded product uses a microprocessor or microcontroller to do one
task only. In an embedded system, there is only one application software that is typically
burned into ROM. Example: printer, keyboard, video game player

Microprocessor - A single chip that contains the CPU or most of the computer
Microcontroller - A single chip used to control other devices

Microcontroller differs from a microprocessor in many ways. First and the


most important is its functionality. In order for a microprocessor to be used, other
components such as memory, or components for receiving and sending data must be
added to it. In short that means that microprocessor is the very heart of the computer.
On the other hand, microcontroller is designed to be all of that in one. No other external
components are needed for its application because all necessary peripherals are
already built into it. Thus, we save the time and space needed to construct devices.

2.1 MICROPROCESSOR VS MICROCONTROLLER:

Microprocessor:
 CPU is stand-alone, RAM, ROM, I/O, timer are separate
 Designer can decide on the amount of ROM, RAM and I/O ports.
 expensive
 versatility general-purpose

Microcontroller:

• CPU, RAM, ROM, I/O and timer are all on a single chip
• fix amount of on-chip ROM, RAM, I/O ports
• for applications in which cost, power and space are critical
• single-purpose
2.2 CRITERIA FOR CHOOSING A MICROCONTROLLER:

The basic criteria for choosing a microcontroller suitable for the application
are:

1) The first and foremost criterion is that it must meet the task at hand efficiently and
cost effectively. In analyzing the needs of a microcontroller-based project, it is seen
whether an 8- bit, 16-bit or 32-bit microcontroller can best handle the computing needs
of the task most effectively. Among the other considerations in this category are:
(a) Speed: The highest speed that the microcontroller supports.
(b) Packaging: It may be a 40-pin DIP (dual inline package) or a QFP (quad flat
package), or some other packaging format. This is important in terms of space,
assembling, and prototyping the end product.
(c) Power consumption: This is especially critical for battery-powered
products. (d) The number of I/O pins and the timer on the Chip.
(f) How easy it is to upgrade to higher –performance or lower consumption
versions.
(g) Cost per unit: This is important in terms of the final cost of the product in
which a microcontroller is used.
2) The second criterion in choosing a microcontroller is how easy it is to develop
products around it. Key considerations include the availability of an assembler,
debugger, compiler, technical support.
3) The third criterion in choosing a microcontroller is its ready availability in
needed quantities both now and in the future. Currently of the leading 8-bit
microcontrollers, the 8051 family has the largest number of diversified suppliers. By
supplier is meant a producer besides the originator of the microcontroller. In the case
of the 8051, this has originated by Intel several companies also currently producing
the 8051.Thus the microcontroller AT89S52, satisfying the criterion necessary for the
proposed application is chosen for the task.
2.3 FEATURES:

 8K Bytes of In-System Reprogrammable Flash Memory


 Endurance: 1,000 Write/Erase Cycles
 Fully Static Operation: 0 Hz to 24 MHz
 256 x 8-bit Internal RAM
 32 Programmable I/O Lines
 Three 16-bit Timer/Counters
 Eight Interrupt Sources
 Programmable Serial Channel
 Low-power Idle and Power-down Modes

DESCRIPTION:

The AT89C52 is a low-power, high-performance CMOS 8-bit microcomputer with


8Kbytes of Flash programmable and erasable read only memory (PEROM). The on-chip
Flash allows the program memory to be reprogrammed in-system or by a conventional
nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a
monolithic chip, the Atmel AT89C52 is a powerful microcomputer, which provides a
highly flexible and cost-effective solution to many embedded control applications
PIN DIAGRAM - AT89S52
2.4 PIN DESCRIPTION:

VCC –
Supply voltage.

GND –
Ground.

Port 0:
Port 0 is an 8-bit open drain bi-directional 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 can 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 bi-directional 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 (I IL) because of the
internal pull-ups. In addition, P1.0 and P1.1 can be configured to be the timer/counter
2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX),
respectively.
PORT PIN ALTERNATE FUNCTIONS:

P1.0 T2 (external count input to Timer/Counter 2), clock-out


P1.1 T2EX (Timer/Counter 2 capture/reload trigger and direction control

Port 2:
Port 2 is an 8-bit bi-directional 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 (I IL) 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, Port 2 uses strong internal pull-ups
when emitting 1s. During accesses to external data memory that uses 8-bit addresses
(MOVX @ RI); Port 2 emits the contents of the P2 Special Function Register. Port 2
also receives the high-order address bits and some control signals during Flash
programming and verification.

Port 3:
Port 3 is an 8-bit bi-directional 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 pulled low will source current (I IL) because of the pull-
ups. Port 3 also serves the functions of various special features of the AT89C51. Port
3 also receives some control signals for Flash programming and verification.
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 memory write strobe)
P3.7 RD (external data memory read strobe).
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 is an 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. 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 program memory. When
the AT89C52 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 pro-gram memory locations starting at 0000H up to
FFFFH. However, 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 12V programming enable voltage (VPP) during Flash programming when 12V
programming is selected.

XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock operating
circuit.

XTAL2:
It is an output from the inverting oscillator amplifier.
BLOCK DIAGRAM OF 89S52

EXTERNAL
INTERRUPTS
TIMER/CO
UNTER
INTERRUPT ON-CHIP ON-
CONTROL ROM FOR CHIP TIMER 1 COUNTER
PROGRAM RAM INPUTS
CODE TIMER 0

CPU

BUS 4 I/O SERIAL


OSC CONTROL PORTS PORT

P0 P1 P2 P3 Tx Rx
ARCHITECHTURE OF 8052 MICROCONTROLLER:
OSCILLATOR CHARACTERISTICS:

XTAL1 and XTAL2 are the input and output, respectively, of an inverting
amplifier, which can be configured for use as an on-chip oscillator. Either a quartz
crystal or ceramic resonator may be used. To drive the device from an external clock
source, XTAL2 should be left unconnected while XTAL1 is driven. There are no
requirements on the duty cycle of the external clock signal, since the input to the
internal clocking circuitry is through a divide-by-two flip-flop, but minimum and
maximum voltage high and low time specifications must be observed.

IDLE MODE:
In idle mode, the CPU puts itself to sleep while all the on-chip peripherals
remain active. The mode is invoked by software. The content of the on-chip RAM and
all the special functions registers remain unchanged during this mode. The idle mode
can be terminated by any enabled interrupt or by a hardware reset. It should be noted
that when idle is terminated by a hardware reset, the device normally resumes
program execution, from where it left off, up to two machine cycles before the internal
reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this
event, but access to the port pins is not inhibited. To eliminate the possibility of an
unexpected write to a port pin when Idle is terminated by reset, the instruction
following the one that invokes Idle should not be one that writes to a port pin or to
external memory.
OSCILLATOR CONNECTIONS:

OSCILLATOR CONNECTIONS:

Note: C1, C2 = 30 pF ± 10 pF for Crystals


= 40 pF ± 10 pF for Ceramic Resonators
CHAPTER 3

POWER SUPPLY CONNECTION

The power supply section consists of step down transformers of 230V primary
to 9V and 12V secondary voltages for the +5V and +12V power supplies respectively.
The stepped down voltage is then rectified by 4 1N4007 diodes. The high value of
capacitor 1000 µF charges at a slow rate as the time constant is low, and once the
capacitor charges there is no resistor for capacitor to discharge. This gives a
constant value of DC. IC 7805 is used for regulated supply of +5 volts and IC 7812 is
used to provide a regulated supply of +12 volts in order to prevent the circuit ahead
from any fluctuations. The filter capacitors connected after this IC filters the high
frequency spikes. These capacitors are connected in parallel with supply and
common so that spikes filter to the common. These give stability to the power supply
circuit.
As can be seen from the above circuit diagrams, the rectified voltage from
the 4 diodes is given to pin 1 of the respective regulators. Pin 2 of the regulators is
connected to ground and pin 3 to Vcc. With adequate heat sinking the regulator
can deliver 1A output current. If internal power dissipation becomes too high for
the heat sinking provided, the
thermal shutdown circuit takes over preventing the IC from overheating.
12v and 5v power supply

Introduction

The +5 volt supply is useful for both analog and digital circuits. DTL, TTL, and CMOS
ICs will all operate nicely from a +5 volt supply. In addition, the +5 volt supply is useful
for circuits that use both analog and digital signals in various ways.

More importantly for our purposes, the +5 volt supply will be used as the primary
reference for regulating all of the other power supplies the we will build. We can do this
very easily if we use operational amplifiers as the controlling elements in the power
supply circuits. We'll see how this works after completing the basic +5 volt supply.

Schematic Diagram

The +5 volt power supply is based on the commercial 7805 voltage regulator IC. This IC
contains all the circuitry needed to accept any input voltage from 8 to 18 volts and
produce a steady +5 volt output, accurate to within 5% (0.25 volt). It also contains
current-limiting circuitry and thermal overload protection, so that the IC won't be
damaged in case of excessive load current; it will reduce its output voltage instead.

The 1000µf capacitor serves as a "reservoir" which maintains a reasonable input


voltage to the 7805 throughout the entire cycle of the ac line voltage. The two rectifier
diodes keep recharging the reservoir capacitor on alternate half-cycles of the line
voltage, and the capacitor is quite capable of sustaining any reasonable load in between
charging pulses.

The 10µf and .01µf capacitors serve to help keep the power supply output voltage
constant when load conditions change. The electrolytic capacitor smooths out any long-
term or low frequency variations. However, at high frequencies this capacitor is not very
efficient. Therefore, the .01µf is included to bypass high-frequency changes, such as
digital IC switching effects, to ground.

The LED and its series resistor serve as a pilot light to indicate when the power supply
is on. I like to use a miniature LED here, so it will serve that function without being
obtrusive or distracting while I'm performing an experiment. I also use this LED to tell
me when the reservoir capacitor is completely discharged after power is turned off.
Then I know it's safe to remove or install components for the next experiment.

3.1 Parts List

To construct and test the +5 volt power supply on your breadboard, you will need the
following parts (all available from Radio Shack):

 (1) 1K, ¼-watt resistor (brown-black-red). 


 (1) 0.01 µf or larger ceramic disc capacitor. 
 (1) 10 µf, 35 volt electrolytic capacitor.  
 (1) 1000 µf, 35 volt electrolytic capacitor. 
 (2) silicon rectifier diodes. 
 (1) 7805 +5 volt voltage regulator IC.  
 (1) miniature red LED. 
 Black hookup wire. 
 Red hookup wire. 
 Yellow hookup wire. 

You will also need your longnose pliers, diagonal cutter, wire stripper, and voltmeter.
3.2 TRANSFORMER:

A transformer is a device that transfers electrical energy from one circuit to another
through inductively coupled conductors—the transformer's coils. A varying current in the first
or primary winding creates a varying magnetic flux in the transformer's core, and thus a
varying magnetic field through the secondary winding. This varying magnetic field induces a
varying electromotive force (EMF) or "voltage" in the secondary winding. This effect is called
mutual induction

TYPES OF TRANSFORMERS:

1. Step up transformer
2. step down transformer

3.2.1.STEP UP TRANSFORMER:

Increase the voltage (or)primary winding turns less than secondary winding.
3.2.2 STEP DOWN TRANSFORMER:

Reduces the voltage (or).primary winding turns are more than secondary winding.

Fig.step down transformer (n1>n2)

3.3 FILTER:

a. A porous material through which a liquid or gas is passed in order to


separate the fluid from suspended particulate matter.
b. A device containing such a material, especially one used to extract
impurities from air or water.
c. Any of various electric, electronic, acoustic, or optical devices used to
reject signals, vibrations, or radiations of certain frequencies while
allowing others to pass.
d. A colored glass or other transparent material used to select the
wavelengths of light allowed to reach a photosensitive material

DEFINITION:

The circuit which removes the unwanted ac components of the rectifier output
and allows Only dc component to reach the load.
3.3.1 TYPES OF FILTERS:
2.3.1TYPES OF FILTERS:

A filter consists of passive ckt elements such as inductor ,capacitor


 Inductor filter
 Capacitor filter
 Lc filter
 Clc section filter
 Multiple filter
 Rc filter

3.4 REGULATOR:

DEFINITION:

It is a circuit which maintains the terminal voltage as constant even if the


input (or) load current varying.

This circuit is a small +5V power supply.The circuit will provide a regulated voltage to
the external circuit which may also I am required in any part of the external circuit or the
whole external circuit.The best part is that you can also use it to convert AC voltage to
DC and then regulate it ,simlpy You need a transformer to make the AC main drop
down to a safe value i.e 12-15 volts and then us a rectifier to convert AC into DC.

This circuit can give +5V output at about 150 mA current, but it can be increased to 1 A
when good cooling is added to 7805 regulator chip. The circuit has over overload and
therminal protection. The capacitors must have enough high voltage rating to safely
handle the input voltage feed to circuit. The circuit is very easy to build for example into
a piece of veroboard.
If you need other voltages than +5V, you can modify the circuit by replacing the 7805
chips with another regulator with different output voltage from regulator 78xx chip family.
The last numbers in the the chip code tells the output voltage. Remember that the input
voltage muts be at least 3V greater than regulator output voltage ot otherwise the
regulator does not work well.

7805

3.4.1 Pin diagram for 7805:

1. Unregulated voltage in

2. Ground

3. Regulated voltage ou

:
Features:

 Complete specifications at 1A load


 Output voltage tolerances of ±2% at Tj = 25°C and ±4%
 over the temperature range (LM340A)
 Line regulation of 0.01% of VOUT/V of VIN at 1A load(LM340A)
 Load regulation of 0.3% of VOUT/A (LM340A)
 Internal thermal overload protection
 Internal short-circuit current limit
 Output transistor safe area protection
 P+ Product Enhancement tested

3.5 LIGHTING EMITTING DIODE:

Light emitting diodes are diodes(electronic components that let electricity pass in only
one direction) that emit visible light when electricity is applied, much like a light bulb.
When many LEDs are side-by-side, they can create pictures, such as the scrolling red
LED signs found everywhere.

Led diagram
3.5.1 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.

The idea of a pull-up resistor is that it weakly "pulls" the voltage of the wire it's
connected to towards 5V (or whatever voltage represents a logic "high"). However, the
resistor is intentionally weak (high-resistance) enough that, if something else strongly
pulls the wire toward 0V, the wire will go to 0V. An example of something that would
strongly pull a wire to 0V would be the transistor in an open-collector output.

Similarly, pull-down resistors are used to hold the input to a zero (low) value when no
other component is driving the input. They are used less often than pull-up resistors.
Pull-down resistors can safely be used with CMOS logic gates because the inputs are
voltage-controlled. TTL logic inputs that are left un-connected inherently float high, thus
they require a much lower valued pull-down resistor to force the input low. This also
consumes more current. For that reason, pull-up resistors are preferred in TTL circuits.

In bipolar logic families operating at 5 VDC, a typical pull-up resistor value will be 1000–
5000 Ω, based on the requirement to provide the required logic level current over the full
operating range of temperature and supply voltage. For CMOS and MOS logic, much
higher values of resistor can be used, several thousand to a million ohms, since the
required leakage current at a logic input is small.

A circuit showing a pull-up resistor (R2) and a pull-down resistor (R1)

Pull-up resistors may be used at logic outputs where the logic device cannot source
current, such as open-collector TTL logic devices. Such outputs are used for driving
external devices, for a wire-OR function in combinatorial logic, or for a simple way of
driving a logic bus with multiple devices connected to it. For example, the circuit shown
on the right uses 5 V logic level inputs to actuate a relay. If the input is left unconnected,
pull-down resistor R1 ensures that the input is pulled down to a logic low. The 7407 TTL
device, an open collector buffer, simply outputs whatever it receives as input, but as an
open collector device, the output is left effectively unconnected when outputting a "1".
Pull-up resistor R2 thus pulls the output all the way up to 12 V when the buffer outputs a
"1", providing enough voltage to turn the power MOSFET all the way on and actuate the
relay.

Pull-up resistors may be discrete devices mounted on the same circuit board as the
logic devices. Many microcontrollers intended for embedded control applications have
internal, programmable pull-up resistors for logic inputs so that minimal external
components are needed.

Some disadvantages of pull-up resistors are the extra power consumed when current is
drawn through the resistor, and the reduced speed of a pull-up compared to an active
current source. Certain logic families are susceptible to power supply transients
introduced into logic inputs through pull-up resistors, which may force the use of a
separate filtered power source for the pull-ups.

Pushbutton switches are two-position devices actuated with a button that is pressed and
released. Most pushbutton switches have an internal spring mechanism returning the
button to its "out," or "unpressed," position, for momentary operation. Some pushbutton
switches will latch alternately on or off with every push of the button. Other pushbutton
switches will stay in their "in," or "pressed," position until the button is pulled back out.
This last type of pushbutton switches usually have a mushroom-shaped button for easy
push-pull action.
CHAPTER 4

INTRODUCTION TO KIEL SOFTWARE

Many companies provide the 8051 assembler, some of them provide


shareware version of their product on the Web, Kiel is one of them. We can download
them from their Websites. However, the size of code for these shareware versions is
limited and we have to consider which assembler is suitable for our application.

4.1 KIEL U VISION2:

This is an IDE (Integrated Development Environment) that helps you write,


compile, and debug embedded programs. It encapsulates the following components:
. A project manager
. A make facility
. Tool configuration
. Editor
. A powerful debugger
To get start here are some several example programs

4.1.1 BUILDING AN APPLICATION IN UVISION2:

To build (compile, assemble, and link) an application in uVision2, you must:

. Select Project–Open Project


(For example, \C166\EXAMPLES\HELLO\HELLO.UV2)
. Select Project - Rebuild all target files or Build target. UVision2 compiles,
assembles, and links the files in your project.
4.1.2 CREATING YOUR OWN APPLICATION IN UVISION2:

To create a new project in uVision2, you must:

. Select Project - New Project.


. Select a directory and enter the name of the project file.
. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device
from the Device
. Database
. Create source files to add to the project.
. Select Project - Targets, Groups, and Files. Add/Files, select Source Group1,
and add the source files to the project.
. Select Project - Options and set the tool options. Note when you select the target
device from the Device Database all-special options are set automatically. You
only need to configure the memory map of your target hardware. Default memory
model settings are optimal for most.

4.1.3 DEBUGGING AN APPLICATION IN UVISION2:

To debug an application created using uVision2, you must:

. Select Debug - Start/Stop Debug Session.


. Use the Step toolbar buttons to single-step through your program. You may enter
G, main in the Output Window to execute to the main C function.
. Open the Serial Window using the Serial #1 button on the toolbar.
. Debug your program using standard options like Step, Go, Break, and so on.

4.1.4 LIMITATIONS OF EVALUATION SOFTWARE:


The following limitations apply to the evaluation versions of the C51, C251, or
C166 tool chains. C51 Evaluation Software Limitations:

. The compiler, assembler, linker, and debugger are limited to 2 Kbytes of object
code but source Code may be any size. Programs that generate more than 2
Kbytes of object code will not compile, assemble, or link the startup code
generated includes LJMP's and cannot be used in single-chip devices supporting
Less than 2 Kbytes of program space like the Philips 750/751/752.
. The debugger supports files that are 2 Kbytes and smaller.
. Programs begin at offset 0x0800 and cannot be programmed into single-chip
devices.
. No hardware support is available for multiple DPTR registers.
. No support is available for user libraries or floating-point arithmetic.

4.2 EVALUATION SOFTWARE:


. Code-Banking Linker/Locator
. Library Manager.
. RTX-51 Tiny Real-Time Operating System

PERIPHERAL SIMULATION:

The u vision2 debugger provides complete simulation for the CPU and on chip
peripherals of most embedded devices. To discover which peripherals of a device are
supported, in u vision2. Select the Simulated Peripherals item from the Help menu. You
may also use the web-based device database. We are constantly adding new devices
and simulation support for on-chip peripherals so be sure to check Device Database
often.
CHAPTER 5

STEPPER MOTOR
CHAPTER 6

ULN2803 IC:

The ULN2803 Integrated Circuit (IC) is a "Eight-way Line Driver". The IC takes small
current at its 8 input pins (pins 1 to 8) and allows much larger current (up to one amp) to
flow via its output lines. 

In this application of the ULN2803 IC, small currents available at the Printer Port are
used to control devices that could not be connected directly to the Port, such as motors
and relays.
The simplest application of the ULN2803 is represented below. Eight lines from the
Printer Port connect to the eight input lines of the ULN2803. The "ground" lines of the
Printer Port (pins 18 - 25) connect to pin 9 of the ULN2803. The "negative" terminal of
the battery also connects to Pin 9 of the ULN2803. Each output line connects via a Load
Resistor to a Light Emitting Diode (LED). The "anodes" of all the LEDs connect to the
"positive" of the battery. In this example, the battery supply is nine volts.
The load resistors limit the current flowing through the LEDs. If a 12 volt supply is used,
the load resistors should be changed to 560 ohms.

The Zener diode is included to protect the ULN2803 against possible damage due to
"back emf" voltage spikes that may be produced when relays and motors are used.
Generally a 30 volt, 1 watt Zener diode will suffice. The Zener diode connects between
Pin 10 and the positive rail.

Output Lines Schematic


The PCB below shows only the Output section of the Simplified I/O Interface.

The Simplified I/O Interface showing Output only.

Input:

Input at the Printer Port is via a 74LS244 Integrated Circuit called an "Octal tri-state
Buffer/Line Driver". This IC protects the port and ensures the input is 'clean'. Only four
lines of the IC are used in this circuit.

The four input lines are tied "HIGH" by 100k ohm resistors connected to the 5 volt rail.
Each line has a switch connected to the negative rail. When a switched is pressed, the
line is taken "LOW". A standard mini-pushbutton switch may be used.

Input Lines Schematic


CHAPTER 7:

CODE IN ASSEMBLY LANGUAGE

org 0000h
mov p1,#0ffh
mov p0,#0000h
mov a,#011h
mov r0,#0001h
main:jnb p1.0,right
jnb p1.1,left

sjmp main
right: nop
acall delay1
right_round:rr a
acall delay
mov p2,a
acall led
right_back:jnb p1.2,increment_right
jnb p1.3,decrement_right
jnb p1.1,left
sjmp right_round
left: nop
acall delay1
left_round:rl a
acall delay
mov p2,a
acall led
left_back:jnb p1.2,increment_left
jnb p1.3,decrement_left
jnb p1.0,right
sjmp left_round

increment_right:inc r0
cjne r0,#08,increment1
mov r0,#0001h
sjmp right_back
increment1: sjmp right_back
decrement_right: dec r0
cjne r0,#01,decrement1
mov r0,#0008h
sjmp right_back
decrement1:sjmp right_back
increment_left:inc r0
cjne r0,#08,increment2
mov r0,#0001h
sjmp left_back
increment2: sjmp left_back
decrement_left: dec r0
cjne r0,#01,decrement2
mov r0,#0008h
sjmp left_back
decrement2:sjmp left_back

delay:mov r0,00h
wait2:mov r6,#1
wait1:mov r5,#1
waithere1:djnz r5,waithere1
djnz r6,wait1
djnz r0,wait2
ret

led:cjne r0,#01,led2
setb p0.0
led2:cjne r0,#02,led3
setb p0.1
led3:cjne r0,#03,led4
setb p0.2
led4:cjne r0,#04,led5
setb p0.3
led5:cjne r0,#05,led6
setb p0.4
led6:cjne r0,#06,led7
setb p0.5
led7:cjne r0,#07,led8
setb p0.6
led8:cjne r0,#08,led
setb p0.7
mov p0,#0000h
ret
delay1:
mov r7,#1
wait4:
mov r1,#1
wait5:
mov r2,#1
waithere3:
djnz r2,waithere3
djnz r1,wait5
djnz r7,wait4
ret

end

You might also like