Sei sulla pagina 1di 165

EXPERIMENT NO:01

Introduction to Keil& Proteus software:


Objective:
Introduction to Keil software.

Getting Started with Keil software.


Other similar softwares.
How to create project in Keil software.

How to creat hex file in the Keil.


How to perform program on Keil.

Introduction to proteus software.


How to make project in proteous software.
To understand how to link hex file to microcontroller in Proteus (software)

Introduction to Keil uVision:


Brief history:

Keil was founded in 1982 by Gnter and Reinhard Keil, initially as a German
GbR. In April 1985 the company was converted to Keil Elektronik GmbH to
market add-on products for the development tools provided by many of the
silicon vendors. Keil implemented the first C compiler designed from the
ground-up specifically for the 8051 microcontroller.

Why Keil uVision?

Keil Micro-Vision is a free software which solves many of the pain points for
an embedded program developer. This software is an integrated
development environment (IDE), which integrated a text editor to write
programs, a compiler and it will convert your source code to hex files too.

The Micro-Vision IDE is a Windows-based software development platform that


combines a robust editor, project manager, and makes facility. Micro-Vision
integrates all tools including the C compiler, macro assembler, linker/locator,
and HEX file generator.

It helps expedite the development process of your embedded applications by


providing the following:

Full-featured source code editor.


Device database for configuring the development tool setting

Project manager for creating and maintaining your projects.

Integrated make facility for assembling, compiling, and linking your embedded
Applications.

Dialogs for all development tool settings,


True integrated source-level Debugger with high-speed CPU and peripheral

simulator,

Advanced GDI interface for software debugging in the target hardware and for

connection to Keil ULINK,

Flash programming utility for downloading the application program into Flash

ROM,

Links to development tools manuals, device datasheets & users guides.

The Micro-Vision IDE offers numerous features and advantages that help you
quickly and successfully develop embedded applications. They are easy to
use and are guaranteed to help you achieve your design goals.

Concept of compiler:

Compilers are programs used to convert a High Level Language to object


code. Desktop compilers produce an output object code for the underlying
microprocessor, but not for other microprocessors. I.E the programs written
in one of the HLL like C will compile the code to run on the system for a
particular processor like x86 (underlying microprocessor in the computer).
For example compilers for Dos platform is different from the Compilers for
Unix platform

So if one wants to define a compiler then compiler is a program that


translates source code into object code. The compiler derives its name from
the way it works, looking at the entire piece of source code and collecting
and reorganizing the instruction. See there is a bit little difference between
compiler and an interpreter. Interpreter just interprets whole program at a
time while compiler analyzes and execute each line of source code in
succession, without looking at the entire program.

Concept of cross compiler:

A cross compiler is similar to the compilers but we write a program for the
target processor (like 8051 and its derivatives) on the host processors (like
computer of x86). It

means being in one environment you are writing a code for another
environment is called cross development. And the compiler used for cross
development is called cross compiler.

So the definition of cross compiler is a compiler that runs on one computer


but produces object code for a different type of computer. Cross compilers
are used to generate software that can run on computers with a new
architecture or on special-purpose devices that cannot host their own
compilers. Cross compilers are very popular for embedded development,
where the target probably couldn't run a compiler. Typically an embedded
platform has restricted RAM, no hard disk, and limited I/O capability. Code
can be edited and compiled on a fast host machine (such as a PC or Unix
workstation) and the resulting executable code can then be downloaded to
the target to be tested. Cross compilers are beneficial whenever the host
machine has more resources (memory, disk, I/O etc) than the target. Keil C
Compiler is one such compiler that supports a huge number of host and
target combinations. It supports as a target to 8 bit microcontrollers like
Atmel and Motorola etc.

Keil C cross compiler:

Keil is a German based Software development company. It provides several


development tools like

IDE (Integrated Development environment)

Project Manager

Simulator

Debugger

C Cross Compiler , Cross Assembler, Locator/Linker

Keil Software provides you with software development tools for the 8051
family of microcontrollers. With these tools, you can generate embedded
applications for the multitude of 8051 derivatives. Keil provides following
tools for 8051 development.

C51 Optimizing C Cross Compiler,

A51 Macro Assembler,

8051 Utilities (linker, object file converter, library manager),

Source-Level Debugger/Simulator,

Vision for Windows Integrated Development Environment.

The keil 8051 tool kit includes three main tools, assembler, compiler and
linker.

An assembler is used to assemble your 8051 assembly program.

A compiler is used to compile your C source code into an object file.

A linker is used to create an absolute object module suitable for your circuit
emulator.

8051 project development cycle:

These are the steps to develop 8051 project using keil.

Create source files in C or assembly.


Compile or assemble source files.

Correct errors in source files.

Link object files from compiler and assembler.

Test linked application.

Working with keil:

To open keil software click on start menu then program and then select keil4. Or select it
from desktop the following icon.

Following window will appear on your screen.

You can see three different windows in this screen.

Project work space window / tree manue: is for showing all the related
files connected with your project.

Editing window: Is the place where you will edit the code

Output window/ Build window: Will show the output when you compile or
build or run your project.

Now to start with new project follow the steps.

Creating a new Assembler/Compiler Project:

Following is the procedure how to create a new project.

1- Click on project menu and select new project. You will be asked to create
new project in specific directory

2- The seprate window will open.

3- In that window we name the project Project1 and save it on our desired
location (
) from the save Button.

4- Again a new window will open named with Select device for target
Target1.

5- Select the part you will be using to test. As we will use the Atmel
Semiconductor part 89S51 or 89C51.
6- Double Click on the Atmel Semiconductor.

7- Scroll down and select the AT89S51Part.

8- Click OK.

Creating Source File:


Click File Menu and select New.

2. A new window will open up in the Keil


IDE.

3. The following code is written in the text editor window. It is simple


up counter

# include <reg51.h> void main (void)

unsigned char z; for(z=0;z<=255;z++) P2=z;

4. Click on File menu and select Save As

Name the file project1.c

Click the Save Button.

Right click on source group in the tree


manue.

Select Add Files to Group Source Group


1

The new window will open and change file type to Asm Source
File (*.c).
Select project1.c.
Click add button.
Click close Button.

Expand the Source Group 1 in the Tree menu to ensure that the file was
added to the project.

Creating HEX for the project1:

Click on Target 1 in Tree menu.

2. Click on Project Menu and select Options for project1.c.

Select Target Tab

Change Xtal (MHz) from 33.0 to11.0592 or 12MHz. Change the code ROM
size small: program 2K or less

Select Output Tab

Click on Create Hex File check


box

Click OK Button.

8. Click on Project Menu and select Rebuild all


Target Files.

In the Build Window it should report 0 Errors (s), 0 Warnings.

At that time we are ready for the program.

Debugging of program:-

1. Click on Debug Menu and Select Start/Stop Debug Session.

2. As we are using free version so the following option will


appear as.

Click OK
The Keil Debugger will start running.

5. Click on Peripherals. Select I/O Ports, Select


Port 2.

A small window will appear and this will show the port and its pins like ,

Now select the Step option from the above Tab OR changes the step
one line with the help of key F11.

8. In that way we can see the results step by step

9. To exit out, Click on Debug Menu and Select Start/Stop


Debug Session.

10. And this will complete the program results.

Introduction to Proteus.

Proteus 8 is a best simulation software for various designs with microcontroller.


It is mainly popular because of availability of almost all microcontrollers in it. So
it is a handy tool to test programs and embedded designs for electronics
hobbyist. You can simulate your programming of microcontroller in Proteus 8
Simulation Software. After Simulating your circuit in Proteus 8 Software you can
directly make PCB design with it so it could be a all in one package for students
and hobbyists.

Proteus PCB design combines the ISIS schematic capture and ARES PCB
layout programs to provide a powerful, integrated and easy to use suite of
tools for professional PCB Design. All Proteus PCB design products include an
integrated shape based autorouter and a basic SPICE simulation capability
as standard. More advanced routing modes are included in Proteus PCB
Design Level 2 and higher whilst simulation capabilities can be enhanced by
purchasing the Advanced Simulation option and/or micro-controller
simulation capabilities.

Proteus is a single integrated application with ISIS, ARES and 3D Viewer


modules appearing as tabbed modules. The program enables changes on
the schematic to be reflected across PCB, BOM and Design Explorer in real
time. Proteus stores the design (DSN), layout (LYT) and common database in
a single project file (PDSPRJ). Proteus is perfect tool for engineers to test
their microcontroller designs before constructing a physical prototype in real
time. This program allows users to interact with the design using on-screen
indicators and/or LED and LCD displays and, if attached to the PC, switches
and buttons.

How to make project in proteous software:1. Click on the following icon from start manue or desktop.

2. The following window will open .

Click on ISIS (Intelligent Schematic Input


System).

Now the window is ready for the project.

As we are using 89C51 microcontroller in our test bench so in proteus


we select 89C51 microcontroller and making the necessary
connections , attaching components for that microcontroller as.

Loading a Microcontroller with a hex file in


proteus:
Completed the circuit required for Project1 (which is made in keil in the above pages). Such as,

Place cursor on microcontroller 89S51 and double click it. A window will open, on program file
option click on folder icon
and add directory of your hex
file(Keil\C51\Examples\HELLO\project1.hex) where you create it on Keil.

3. Simulated the circuit for the results.

EXPERIMENT NO:02
Up And Down Counters.
Objective:What are counters

Types of counters.

C-Codes for counters in keil.

Counters implementation in proteus.

Practically implementation with the help of test bench.

Components:-

A computer in which proteus and keil are installed.

Vern board.

A complete set of equipments for soldering.

89S51 microcontroller

8 LEDs

8 resistors (330)

Connecting wires

Power supply (5V).

Theory:Counters.
Counters can be defined in two ways.

1-In digital logic and computing: A counter is a digital sequential logic device that will go
through a certain predefined states (for example counting up or down) based on the application
of the input pulses. They are utilized in almost all computers and digital electronics systems

2- In electronics: A counter is a sequential circuit that counts. That means it proceeds


through a pre-defined sequence of states where the state of the circuit is determined by the states
of all its flip flops. As every state of the circuit can be given a number we can say that a counter
produces a sequence of numbers.

Types of counters.

Generally there are two types.


Up counters, which increase (increment) in value
Down counters, which decrease (decrement) in value

More precisely the types are.

Asynchronous (ripple) counter changing state bits are used as clocks to subsequent state flipflops.

Synchronous counter all state bits change under control of a single clock.

Typical counters applications.


Shipment quantities are counted to control the conveyor line flow.

Incoming and outgoing cars are counted to switch the FULL and VACANT signs.

Rotary encoder signals are counted to control a valve aperture.

Extra leader sheet that is now wound is counted by a rotary encoder and a color
detecting sensor.

Procedure:Write the c codes of up and down counters in keil software , save it and creat hex files of both.

For verifying the results check in keil through assigned ports.

Make the circuit involving microcontroller and leds in proteus to show the results.

Also make the circuit on test bench same as created in proteus.

Solder it and complete the circuit.

Now link the up and down counters hex files with proteus and verify the results.

Take 89C51 microcontroller and place it in the programmer.

Burn the program.

Remove it from programmer and place it on the base of test bench.

Give the supply to test bench and verify the results.

C Codes for up and down counters:-Up counter


# include <reg51.h> void main (void)

for(;;)

unsigned int z; for(z=0;z<=45000;z++); P2=0x00; for(z=0;z<=45000;z++);


P2=0x01; for(z=0;z<=45000;z++); P2=0x02; for(z=0;z<=45000;z++);

P2=0x03;

for(z=0;z<=45000;z++);

P2=0x04;

for(z=0;z<=45000;z++);

P2=0x05;

for(z=0;z<=45000;z++);

P2=0x06;

for(z=0;z<=45000;z++);

P2=0x07;

for(z=0;z<=45000;z++);

P2=0x08;

for(z=0;z<=45000;z++);

P2=0x09;

for(z=0;z<=45000;z++);

Down counter.
# include <reg51.h> void main (void)

unsigned int z; for(;;)

for(z=0;z<=45000;z++)

P2=0xFF;

for(z=0;z<=45000;z++)

P2=0xFE;

for(z=0;z<=45000;z++)

P2=0xFD;

for(z=0;z<=45000;z++)

P2=0xFC;

for(z=0;z<=45000;z++)

P2=0xFB;

for(z=0;z<=45000;z++)

P2=0xFA;

for(z=0;z<=45000;z++)

P2=0xF9;

for(z=0;z<=45000;z++)

P2=0xF8;

for(z=0;z<=45000;z++)

P2=0xF7;

for(z=0;z<=45000;z++)

P2=0xF6;

Schematic from proteus:-

Schematic from test bench:-

EXPERIMENT NO:03
Introduction to test bench:
Objective.
What is test bench?

Need for test bench.

Components placed on test bench.

A comprehensive note on test bench.

Purpose and work of each existing circuitry of test bench.

Introduction to test bench


Test bench.

A test bench or testing workbench is an environment used to verify the


correctness or soundness of a design or model. OR A test bench is to show
and verify the results.

Test bench in our case is of vero board and many components are soldered
on it. A test bench on which microcontroller is installed as a heart of test
bench and other components are also installed which are derived by the
controller. The controller is programmed and through this we see the results
on specific circuitry of test bench. The test bench in our case is given as.

Fig.Test bench.

Components soldered on test bench.

On/ OFF switch.


Microcontroller with base.
LEDs panel (8 LEDs).

Seven segment display.


7447 decoder IC.
Relay
L293 DC motor deriver IC.

H-bridge DC motor deriver circuit.


Buzzer.

Light sensor (LDR).


Heat sensor (Thermistor).

Motion sensor. (PIR).


Smoke sensor.
Humidity sensor.
Temperature sensor (LM35).

Servo motor.
Stepper motor.

Description of a test bench:A test bench have different portions on it and given as.

Fig- Labeled test bench.

0-On/Off switch.

Through this switch we can turn supply ON and OFF in the mentioned position.

Moreover there are also points of positive supply and ground through which we
can take supply and ground at our desired point with the help of jumper wires.
Power socket has two wires one is positive while the other one is of negative.

1.LEDs Panel.

It is of 8 LEDs panel. These are used for counters and checking the results. In this
panel each LED contain a resistor in series so that it can be protected. These LEDs
are operated in the low logic. These are shown as.

2-H Bridge:

H bridge is a circuit for driving DC motor in both directions and consist of 4


transistors. Its circuit is given as.

Past a circuit here from register The test bench circuits points configurations are:

3-Reed switch.

When magnetic came near reed switch it becomes on. It will act like a switch.

4-Microcontroller.

It is a heart of test bench. Controller is placed here with standard settings. It is


programmable component and is programmed with software (Keil) and results
are observed.

5-L293:

Is the DC motor driver IC and its logical circuit is


shown as:

On test bench it is as:

6-heat sensor
(thermistors)

On test bench it is as:

7-Seven segment with 7447 decoder:

Through the given table we make the setting of 7447 pins and observed the
counting from 0 to 9. Connections of 7447 with 7segment is already build in the
circuit.

8-Servo motor points:

Here we can connect our servo and according to pin configuration of servo supply
, ground and signal can be given through female headers.

9-Humidity sensor.

Humidity sensor is placed in the female headers and other same number of
female header is connected with it by which we can give supply and ground to it
and gets output from it.

10-LM35

Is a temperature sensor used to sense temperature.

11-LDR and Buzzer.

When light level increases from fixed intensity level logic from LDR changes and
we can indicate it by relay.

12-Relay.

13-Smoke
sensor:

EXPERIMENT NO:04
Introduction to C programming in 8051:

Objectives.
What is programming. (Assembly language and C language).

Data types.

Programming in the 8051.

8051 pin configuration.

8051 extensions.

Time delays.

I/O programming.

Logical operators.

Interrupts.

Serial communication.

Programming:

Programming is the process of designing, writing, testing, debugging, and


maintaining the source code of computer programs. This code can be written
in a variety of computer programming languages. Some of these languages
include Java, C, and Python.

Assembly language:

An assembly language (or assembler language) is a low-level programming


language for a computer, or other programmable device, in which there is a
very strong (generally one-to-one) correspondence between the language
and the architecture's machine code instructions.

C language:

C is a high-level and general purpose programming language that is ideal for


developing firmware or portable applications. Originally intended for writing
system software, C was developed at Bell Labs by Dennis Ritchie for the Unix
Operating System (OS) in the early 1970s.

Programming in the 8051.

Both C language and assembly language is used for programming in 8051


but here we will talk about C only. We briefly discuss here about major
reasons for using C, data types of C, 8051 extension types, time delay, pin
configuration of 8051, I/O programming in C and Logic operations in 8051
C.

Data Types:

Following data types are used in C language. Their ranges are also given in
this table 1-1.

Pin configuration of 8051:

Fig 1.1 shows complete pin configuration of 8051 micro controller.

Port 0(p0.0 to p0.7):

It is 8-bit bi-directional I/O port. It is bit/ byte addressable. During external


memory access, it functions as multiplexed data and low-order address bus
AD0-AD7.

Port 1 (p1.0 to p1.7):

It is 8-bit bi-directional I/O port. It is bit/ byte addressable. When logic '1' is
written into port latch then it works as input mode. It functions as simply I/O
port and it does not have any alternative function.

Port 2 (p2.0 to p2.7):

It is 8-bit bi-directional I/O port. It is bit/ byte addressable. During external


memory access it functions as higher order address bus (A8-A15).

Port 3(p3.0 to port 3.7):

It is 8-bit I/O port. In an alternating function each pins can be used as a


special function I/O pin.

P3.0-RxD:

It is an Input signal. Through this I/P signal microcontroller receives serial


data of serial communication circuit.

P3.1-TxD:
It is O/P signal of serial port. Through this signal data is transmitted.

P3.2- (INT0):

It is external hardware interrupt I/P signal. Through this user, programmer


or peripheral interrupts to microcontroller.

P3.3-(INT1):

It is external hardware interrupt I/P signal. Through this user, programmer


or peripheral interrupts to microcontroller.

P3.4-T0:

It is I/P signal to internal timer-0 circuit. External clock pulses can


connects to timer-0 through this I/P signal.

P3.5-T1:

It is I/P signal to internal timer-1 circuit. External clock pulses can


connects to timer-1 through this I/P signal.

P3.6-[WR(bar)]:

It is active low write O/P control signal. During External RAM (Data
memory) access it is generated by microcontroller. when [WR(bar)]=0,
then performs write operation.

P3.7-[RD(bar)]:

It is active low read O/P control signal. During External RAM (Data
memory) access it is generated by microcontroller. when [RD(bar)]=0,
then performs read operation from external RAM.

(Figure 1.1)

XTAL1 and XTAL2:

These are two I/P line for on-chip oscillator and clock generator circuit. A
resonant network as quartz crystal is connected between these two pin.
8051 microcontroller also drives from external clock, then XTAL2 is used to
drive 8051 from external clock and XTAL1 should be grounded.

[EA(bar)]/VPP:

It is and active low I/P to 8051 microcontroller. when (EA)= 0, then 8051
microcontroller access from external program memory (ROM) only. When
(EA) = 1, then it access internal and external program memories (ROMS).

[PSEN(bar)]:

It is active low O/P signal. It is used to enable external program memory


(ROM). When [PSEN(bar)]= 0, then external program memory becomes
enabled and microcontroller read content of external memory location.
Therefore it is connected to (OE) of external ROM. It is activated twice every
external ROM memory cycle.

ALE:

Address latch enable: It is active high O/P signal. When it goes high, external
address latch becomes enabling and lower address of external memory (RAM
or ROM) latched into it. Thus it separates A0-A7 address from AD0-AD7. It
provides properly timed signal to latch lower byte address. The ALE is
activated twice in every machine cycle. If external RAM & ROM is not
accessed, then ALE is activated at constant rate of 1/6 oscillator frequency,
which can be used as a clock pulses for driving external devices.

RESET:

It is active high I/P signal. It should be maintained high for at least two
machine cycle while oscillator is running then 8051 microcontroller resets.

8051 extension types:

Sbit:

The sbit keyword is a widely used 8051 C data type designed specifically to
access single bit addressable registers. It allows access to the single bit of
the SFR register.

Bit and SFR:

The bit data type allows access to single bits of a bit addressable memory
spaces 20-2FH. The sbit data type is used for bit addressable SFRs and the
bit data type is used for the bit addressable section of RAM space 20-2FH.

Time Delay:

There are two ways to create a time delay in 8051 C:


Using a simple for loop

Using the 8051 timers

I/O Programming in 8051 C:

We will discuss here both byte and bit I/O programming.


Byte size I/O:

We see in fig 1.1 that ports P0-P3 byte are accessible. We use the P0-P3
labels as defined in the 8051/52 header file.
Bit-addressable I/O programming:

The I/O ports of P0-P3 are bit-addressable. We can access a single bit without
disturbing the rest of the port. We use the sbit data type to access a single
bit of P0-P3. P1^7 indicates P1.7. When using this method, we need to
include the reg51.h file.

Logical Operations in 8051 C:

One of the most important and powerful features of the C language is the
ability to perform bit manipulation. They are listed in table 1-2.

Bitwise operation in C:

Every C programmer is familiar with the logical operators AND(&&), OR(||),


and NOT(!), many C programmers are less familiar with the bit-wise
operators AND(&), OR(|)< EX-OR(^), Inverter(~), Shift Right(>>), and Shift
Left(<<).

Table 1-2 shows different logical operations.

(Table 1-2)

Bit-wise Shift operation in C:

There are two bit-wise shift operations in C: (1) shift right (>>), and (2) shift
left(<<) Their format in C is as follow:
Data >> number of bits to be shifted right
Data << number of bits to be shifted left

Advantages of C language over assembly language:

Here are some advantages of C language over assembly language:

It is small and reasonably simpler to learn, understand, program and debug.

C Compilers are available for almost all embedded devices in use today, and there
is a large pool of experienced C programmers.

Unlike assembly, C has advantage of processor-independence and is not specific


to any particular microprocessor/ microcontroller or any system. This makes it
convenient for a user to develop programs that can run on most of the systems.

As C combines functionality of assembly language and features of high level


languages, C is treated as a middle-level computer language or high level
assembly language

It is fairly efficient

It supports access to I/O and provides ease of management of large embedded


projects.

Interrupts.

an event external to the currently executing process that causes a change in

the normal flow of instruction execution usually generated by hardware devices external to the
CPU

Key point is that interrupts are asynchronous w.r.t. current process

Typically indicate that some device needs service

serial communication:

serial communication is the process of sending data one bit at a time,


sequentially, over a communication channel or computer bus.

This is in contrast to parallel communication, where several bits are sent as a


whole, on a link with several parallel channels

EXPERIMENT NO:05

Port toggle and bit toggle:


Objective:What is bit toggle?

What is port toggle?

C-Codes for Port toggle and bit toggle in keil.

7 segment implementation in proteus.

Practically implementation with the help of test bench.

Components:A computer in which proteus and keil are installed.

Verum board.

A complete set of equipments for soldering.

89S51 microcontroller.

Panel of 8 LEDs

jumper wires

Power supply (5V).

Theory:Procedure:Write the c codes of port toggle and bit toggle in keil software ,

Save it and create hex files of both.

For verifying the results check in keil through assigned ports.

Make the circuit involving microcontroller in proteus to show the results.

Also make the circuit on test bench same as created in proteus.

Solder it and complete the circuit.

Now link the hex files with proteus and verify the results.

Take 89C51 microcontroller and place it in the programmer.

Burn the program.

Remove it from programmer and place it on the base of test bench.

Give the supply to test bench and verify the results.

C Codes for Port toggle and bit toggle:


7 segment implementation in proteus:
Practically implementation with the help of
test bench:

EXPERIMENT NO:06

Right and left shift:


Objective:What is shifting?

Procedure.

C-Codes for 7 segments in keil.

7 segment implementation in proteus.

Practically implementation with the help of test bench.

Components:A computer in which proteus and keil are installed.

Verum board.

A complete set of equipments for soldering.

89S51 microcontroller..

jumper wires

Power supply (5V).

Theory:-

Procedure:Write the c codes of left shift and right shift in keil software ,

Save it and create hex files of both.

For verifying the results check in keil through assigned ports.

Make the circuit involving microcontroller in proteus to show the results.

Also make the circuit on test bench same as created in proteus.

Solder it and complete the circuit.

Now link the left and right shift hex files with proteus and verify the results.

Take 89C51 microcontroller and place it in the programmer.

Burn the program.

Remove it from programmer and place it on the base of test bench.

Give the supply to test bench and verify the results.

C Codes for 7 segments:


7 segment implementation in proteus:
Practically implementation with the help of
test bench:

EXPERIMENT NO:07

Driving 7 segment with microcontroller:


Objective:What is 7 segment?

Types of 7 segments.

C-Codes for 7 segments in keil.

7 segment implementation in proteus.

Practically implementation with the help of test bench.

Components:A computer in which proteus and keil are installed.

Verum board.

A complete set of equipments for soldering.

89S51 microcontroller.

7 segment display.

74LS47 IC

jumper wires

Power supply (5V).

Theory:In this experiment we will demonstrate the operation of a decoder-driver


circuit that accepts a binary or BCD input code and generates the 7 segment
display signals to produce the numbers 0 through 9 and other characters.

7 segment:

A seven-segment display (SSD), or seven-segment indicator, is a form of


electronic display device for displaying decimal numerals that is an
alternative to the more complex dot matrix displays. Seven-segment displays
are widely used in digital clocks, electronic meters, basic calculators, and
other electronic devices that display numerical information.

Types of 7 segments:

There are following two types of 7segments:

The Common Cathode (CC):


The Common Anode (CA):

1) The Common Cathode (CC):

In the common cathode display, all the cathode connections of the LED
segments are joined together to logic 0 or ground. The individual segments
are illuminated by application of a HIGH, or logic 1 signal via a current
limiting resistor to forward bias the individual Anode terminals (a-g).

2) The Common Anode (CA):

In the common anode display, all the anode connections of the LED
segments are joined together to logic 1. The individual segments are
illuminated by applying a ground, logic 0 or LOW signal via a suitable
current limiting resistor to the Cathode of the particular segment (a-g).

Procedure:Write the c codes of 7 segments in keil software ,

Save it and creat hex files of both.

For verifying the results check in keil through assigned ports.

Make the circuit involving microcontroller and 7 segments in proteus to show the
results.

Also make the circuit on test bench same as created in proteus.

Solder it and complete the circuit.

Now link the 7 segment hex files with proteus and verify the results.

Take 89C51 microcontroller and place it in the programmer.

Burn the program.

Remove it from programmer and place it on the base of test bench.

Give the supply to test bench and verify the results.

C Codes for 7 segments:


7 segment implementation in proteus:
Practically implementation with the help of test
bench:

EXPERIMENT NO:08
Interfacing of dc motor with microcontroller 8051:
Objective:What is dc motor?

C-Codes for interfacing dc motor in keil.

7 segment implementation in proteus.

Practically implementation with the help of test bench.

Components:A computer in which proteus and keil are installed.

Verum board.

A complete set of equipments for soldering.

89S51 microcontroller.

Opto-isolator ILD74

Darlington Transistor TIP120

Diode 1N4004

Resistors (330, 10k, 100k)

Capacitor (0.1Uf)

jumper wires

Power supply (5V).

Theory:DC Motor:

The DC Motor is the most commonly used actuator for producing continuous
movement and whose speed of rotation can easily be controlled, making
them ideal for use in applications were speed control, servo type control,
and/or positioning is required. A DC motor consists of two parts, a Stator
which is the stationary part and a Rotor which is the rotating part. The
result is that there are basically three types of DC Motor available.

Brushed Motor:

This type of motor produces a magnetic field in a wound rotor (the part that
rotates) by passing an electrical current through a commutator and carbon
brush assembly, hence the term

Brushed. The stators (the stationary part) magnetic field is produced by


using either a wound stator field winding or by permanent magnets.
Generally brushed DC motors are cheap, small and easily controlled.

Brushless Motor:

This type of motor produce a magnetic field in the rotor by using permanent
magnets attached to it and commutation is achieved electronically. They are
generally smaller but more expensive than conventional brushed type DC
motors because they use Hall effect switches in the stator to produce the
required stator field rotational sequence but they have better torque/speed
characteristics, are more efficient and have a longer operating life than
equivalent brushed types.

Servo Motor:

This type of motor is basically a brushed DC motor with some form of


positional feedback control connected to the rotor shaft. They are connected
to and controlled by a PWM type controller and are mainly used in positional
control systems and radio controlled models.

DC motor control using Darlington transistor TIP120:

A Darlington transistor may also be used were a higher current rating is


required to control the motor from a single power supply. The TIP120 is an
NPN Power Darlington Transistor. By varying the amount of base current
flowing into the transistor the speed of the motor can be controlled for
example, if the transistor is turned on half way, then only half of the supply
voltage goes to the motor. If the transistor is turned fully ON (saturated),
then all of the supply voltage goes to the motor and it rotates faster. For a
Unidirectional (one direction only) motor control, a continuous logic 1 or
logic 0 is applied to the input of the circuit to turn the motor ON
(saturation) or OFF (cut-off) respectively.

Freewheeling diode 1N4004:

A freewheeling diode is connected across the motor terminals to protect the


switching transistor or MOSFET from any back EMF generated by the motor
when the transistor turns the supply OFF. As for the 1N4004 diode, it
allows current to pass in one direction from positive to negative but will block
any stray current that tries to go in the opposite direction, which might have
undesirable effects on your circuit.

Optoisolator ILD74:

An opto-isolator, also called an optocoupler, is a component that transfers


electrical signals between two isolated circuits by using light. An optoisolator
contains a source (emitter) of light, almost always a near infrared LED, that
converts electrical input signal into light, a closed optical channel and a
photo sensor, which detects incoming light and either generates electric
energy directly, or modulates electric flowing from an external power supply.
The main function of an opto-isolator is to block such high voltages and
voltage transients, so that a surge in one part of the system will not disrupt
or destroy the other parts and this is the same function it performs in DC
motor drive circuitry.

Figure 1

Disadvantage of this control method:

While controlling the speed of a DC motor with a single transistor has many
advantages it also has one main disadvantage, the direction of rotation is
always the same, its a Unidirectional circuit. In many applications we need
to operate the motor in both directions forward and back.

To control the direction of a DC motor, the polarity of the DC power applied to


the motors connections must be reversed allowing its shaft to rotate in the
opposite direction.

Procedure:Write the c codes for interfacing dc motor in keil software ,

Save it and create hex files of both.

For verifying the results check in keil through assigned ports.

Make the circuit involving microcontroller and dc motor in proteus to show the results.

Also make the circuit on test bench same as created in proteus.

Connect pin1 of Optoisolator ILD74 to 5V through 330 resistor and its pin 2 to P2^0 of

Microcontroller.

Connect pin 4 of Optoisolator ILD74 to base of Darlington transistor TIP120 while its pin
5 is connected to 12V.

Connect freewheeling diode 1N4004, 0.1uF capacitor and DC motor in parallel


with one terminal connected to 12 V and the other terminal connected to
Collector terminal of TIP120.

Now link dc motor hex files with proteus and verify the results.

Take 89C51 microcontroller and place it in the programmer.

Burn the program.

Remove it from programmer and place it on the base of test bench.

Give the supply to test bench and verify the results.

C Codes for 7 segments:


7 segment implementation in proteus:
Practically implementation with the help of test
bench:

EXPERIMENT NO:09

Interfacing ADC with 89s51:


Objective:What is ADC?

Implementation methods of ADC.

C-Codes for interfacing ADC in keil.

Interfacing ADC in proteus.

Practically implementation with the help of test bench.

Components:A computer in which proteus and keil are installed.

Vern board.

A complete set of equipments for soldering.

89S51 microcontroller

ADC0804 IC

16*2 LCD Display

Potentiometer (10k)

Capacitor (150pF)
Connecting wires

Power supply (5V).

Theory:An analogue-to-digital converter is a device that converts a continuous


physical quantity (usually voltage) to a digital number that represents the
quantity's amplitude. The conversion involves quantization of the input, so it
necessarily introduces a small amount of error. Instead of doing a single
conversion, an ADC often performs the conversions ("samples" the input)
periodically. The result is a sequence of digital values that have been
converted from a continuous-time and continuous-amplitude analogue signal
to a discrete-time and discrete-amplitude digital signal.

ADC0804:

ADC0804 is one of the most commonly used analog to digital converter IC. In
many applications it is required to convert the output of the sensor, which is
analogue in nature to a digital form. The data in digital format can then be
utilized for further processing by the digital processors. Typical applications
include sound processing, temperature processing etc. This circuit

demonstrates the principle and operation of interfacing a simple ADC 0804


using 8051

microcontroller. ADC0804 is a single channel analog to digital convertor i.e.,


it can take only one analog signal. An ADC has n bit resolution (binary form)
where n can be 8,10,12,16 or even 24 bits. ADC 0804 has 8 bit resolution.
The higher resolution ADC gives smaller step size. Step size is smallest
change that can be measured by an ADC. For an ADC with resolution of 8
bits, the step size is 19.53mV (5V/255).

The time taken by the ADC to convert analog data into digital form is
dependent on the frequency of clock source. ADC0804 can be given clock
from external source. It also has an internal clock. However the conversion

time cannot be more than110us. To use the internal clock a capacitor and
resistor is connected to pin 19 and 4 as shown in the circuit diagram. The
frequency is given by the relation f= 1/ (1.1RC). The circuit uses a resistance
of 10k and a capacitor of 150pF to generate clock for ADC0804. Vin, which is
the input pin, is connected to a preset to provide analog input.

Implementing methods of ADC:


These are the most common ways of implementing an electronic ADC:

A direct-conversion ADC has a bank of comparators sampling the input


signal in parallel, each firing for their decoded voltage range. The
comparator bank feeds a logic circuit that

generates a code for each voltage range. Direct conversion is very fast,
capable of gigahertz sampling rates, but usually has only 8 bits of resolution
N

or fewer, since the number of comparators needed, 2 1, doubles with each


additional bit, requiring a large, expensive circuit. ADCs of this type have a
large die size, a high input capacitance, high power dissipation, and are
prone to produce glitches at the output (by outputting an out-of-sequence
code

A successive-approximation ADC uses a comparator to successively


narrow a range that contains the input voltage. At each successive step, the
converter compares the input voltage to the output of an internal digital to
analog converter which might represent the midpoint of a selected voltage
range. At each step in this process, the approximation is stored in a
successive approximation register (SAR). For example, consider an input
voltage of 6.3 V and the initial range is 0 to 16 V. For the first step, the input
6.3 V is compared to 8 V (the midpoint of the 016 V range). The comparator
reports that the input voltage is less than 8 V, so the SAR is updated to
narrow the range to 08 V. For the second step, the input voltage is
compared to 4 V (midpoint of 08). The comparator reports the input voltage
is above 4 V, so the SAR is updated to reflect the input voltage is in the
range 48 V. For the third step, the input voltage is compared with 6 V
(halfway between 4 V and 8 V); the comparator reports the input voltage is
greater than 6 volts, and search range becomes 6 8 V. The steps are
continued until the desired resolution is reached.

A ramp-compare ADC produces a saw-tooth signal that ramps up or down


then quickly returns to zero. When the ramp starts, a timer starts counting.
When the ramp voltage matches the input, a comparator fires, and the
timer's value is recorded. Timed ramp converters require the least number of
transistors. The ramp time is sensitive to temperature because the circuit
generating the ramp is often a simple oscillator. There are two solutions: use
a clocked counter driving a DAC and then use the comparator to preserve the
counter's value, or calibrate the timed ramp. A special advantage of the
ramp-compare system is that comparing a second signal just requires
another comparator, and another register to store the voltage value. A very
simple (non-linear) ramp-converter can

be implemented with a microcontroller and one resistor and capacitor. Vice


versa, a filled capacitor can be taken from an integrator, time-to-amplitude
converter, phase detector, sample and hold circuit, or peak and hold circuit
and discharged. This has the advantage that a slow comparator cannot be
disturbed by fast input changes.

Procedure:Write the c codes for ADC interfacing in keil software ,

Save it and creat hex files of both.

For verifying the results check in keil through assigned ports.

Make the circuit in proteus to show the results.

Also make the circuit on test bench same as created in proteus.

Make circuit on test bench.

Equip Microcontroller 89S51 with the external clock and reset circuitry.

Connect LCD to P0 of the microcontroller. Connect Rs, Rw and E pins of LCD to


P2^0, P2^1 and P2^2 of microcontroller respectively. Connect data pins (DB0DB7) to P1 of microcontroller.

Connect P2^3, P2^4 and P2^5 of 89S51 to RD pin (to enable read operation),
WR pin (to enable write operation) and INTR pin of ADC respectively. Ground
pins 1, 7, 8 and 10 of ADC0804.

Now make CS=0 and send a low to high pulse to WR pin to start the conversion.

Keep checking the INTR pin. INTR will be 1 if conversion is not finished and INTR will be
0 if conversion is finished

If conversion is not finished (INTR=1), poll until it is finished

If conversion is finished (INTR=0), go to the next step

Make CS=0 and send a high to low pulse to RD pin to read the data from the ADC.

Observe and record results from LCD.

C Codes for ADC interfacing:


Schematic from proteus:Schematic from test bench:-

EXPERIMENT NO:10

Interfacing LCD with 89s51:


Objective:What is LCD

Modes of LCD.

C-Codes for interfacing LCD in keil.

Interfacing of LCD in proteus.

Practically implementation with the help of test bench.

Components:A computer in which proteus and keil are installed.

Vern board.

A complete set of equipments for soldering.

89S51 microcontroller

LCD

Connecting wires

Power supply (5V).

Theory:Short for liquid crystal display, a type of display used in digital watches and
many portable computers. LCD displays utilize two sheets of polarizing
material with a liquid crystal solution between them. An electric current
passed through the liquid causes the crystals to align so that light cannot
pass through them. Each crystal, therefore, is like a shutter, either allowing
light to pass through or blocking the light.

Monochrome LCD images usually appear as blue or dark gray images on top
of a grayish-white background. Color LCD displays use two basic techniques
for producing color: Passive matrix is the less expensive of the two
technologies.

The other technology, called thin film transistor (TFT) or active-matrix,


produces color images that are as sharp as traditional CRT displays, but the
technology is expensive. Recent passive-matrix displays using new CSTN and
DSTNtechnologies produce sharp colors rivaling active-matrix displays.

Modes of LCDS:
There are many different LCD modes. These include:

TN - Twisted Nematic - Low contrast, monochromatic, low power use, low


cost

STN - Super Twisted Nematic - Mid-contrast, monochromatic, low power


use, slightly higher cost

FSTN - Film-compensated Super Twisted Nematic - High-contrast, duochromatic, low power use, mid cost

CSTN - Color Super Twisted Nematic - High-contrast, full-color, mid power


use, slightly higher cost

DSTN - Double-layer Super Twisted Nematic - Super High-contrast, fullcolor, mid power use, high cost

TFT - Thin Film Transistor - Highest contrast, best color, mid power use,
highest cost

Backlighting:
There are three types of backlighting for LCD displays: LED (Light Emitting
Diode), CCFL (Cold Cathode Fluorescent Lamp), and EL (Electro-Luminescent).

LED backlighting offers both monochromatic and color displays and is not
very expensive, but it uses the most power and has only a middling quality as
far as contrast and color rendering.

CCFL backlighting uses less power, lasts longer and has higher contrast and
color rendering, but it is extremely expensive.

EL backlighting uses even less power, is very cheap, but doesn't last that long
and is poor to middling in color and contrast quality.

Procedure:Write the c codes for LCD interfacing in keil software ,

Save it and creat hex files of both.

For verifying the results check in keil through assigned ports.

Make the circuit involving microcontroller and LCD in proteus to show the results.

Also make the circuit on test bench same as created in proteus.

Solder it and complete the circuit.

Now link the LCD interfacing hex files with proteus and verify the results.

Take 89C51 microcontroller and place it in the programmer.

Burn the program.

Remove it from programmer and place it on the base of test bench.

Give the supply to test bench and verify the results.

C Codes for LCD interfacing:

Schematic from proteus:Schematic from test bench:-

EXPERIMENT NO:11

Alarm system using 89S51:


Objective:What is alarm system?

C-Codes for alarm system in keil.

alarm system implementation in proteus.

Practically implementation with the help of test bench.

Components:A computer in which proteus and keil are installed.

Verum board.

A complete set of equipments for soldering.

89S51 microcontroller.

2 Resistors (330)

Buzzer

LED

jumper wires

Power supply (5V).

Theory:-

An alarm system is needed to prevent any bad condition or situation which


we dont want to face. When alarm device is installed then we can avoid
unsuitable circumstances as we can use a fire alarm, antitheft alarm device
etc. So we need an alarm system which can be implemented for antitheft
purpose. An alarm device or system gives an audible, visual or any other
form of signal during a problem or any unavoidable circumstances.

They are often connected with a buzzer or siren. They have a capability of
causing a fight or flight response in humans. In this condition a person will
panic and either flee the perceived danger or attempt to eliminate it. This
buzzer makes sound when the force is applied to the force sensitive resistor.
This acts as an alarm system and it is connected through the RF module so it
can be called as wireless alarm system. When some force is applied to the
force sensitive resistor the signal is transmitted to the receiver and the
buzzer makes sound which serves as an alarm. The alarm blows for 2 sec
and then it is off.

Procedure:Write the c codes of 7 segments in keil software ,

Save it and creat hex files of both.

For verifying the results check in keil through assigned ports.

Make the circuit involving microcontroller and buzzer in proteus to show the results.

Also make the circuit on test bench same as created in proteus.

Solder it and complete the circuit.

Now link the 7 segment hex files with proteus and verify the results.

Take 89C51 microcontroller and place it in the programmer.

Burn the program.

Remove it from programmer and place it on the base of test bench.

Connect the buzzer and resistor to port P2^1.

Connect the led and resistor to P2^2

Take the port P2^0 as a input.

When the input is connected to low logic, led will be ON giving the indication of
correct alarm.

When the input is connected to high logic, buzzer will be ON giving the indication of
wrong alarm.

Give the supply to test bench and verify the results.

C Codes for 7 segments:


7 segment implementation in proteus:
Practically implementation with the help of test
bench:

EXPERIMENT NO:12

Interfacing of LDR and Thermistor with 89S51:


Objective:What is LDR and thermistor?

Types of LDR and thermistors.

C-Codes for LDR and thermistor in keil.

LDR and thermistor implementation in proteus.

Practically implementation with the help of test bench.

Components:A computer in which proteus and keil are installed.

Verum board.

A complete set of equipments for soldering.

89S51 microcontroller.

LDR

Thermistor

Variable resistors (2)

330 resistor (1)

LEDs (2)

10uF capacitor

DC voltmeter

Torch

Heating Element

jumper wires

Power supply (5V).

Theory:-

LDR:

The light dependent resistor, LDR, is known by many names including the
photo resistor, photoconductor, photoconductive cell, or simply the photocell.
It is probably the term photocell that is most widely used in data and
instruction sheets for domestic equipment.

Photo-resistor mechanism:

A photo-resistor or photocell is a component that uses a photconductor


between two contacts. When this is exposed to light a change in resistance is
noted.Photoconductivity - the

mechanism behind the photoresistor - results from the generation of mobile


carriers when photons are absorbed by the semiconductor material used for
the photoconductor. While the different types of material used for 40 light
dependent resistors are semiconductors, when used as a photo-resistor, they
are used only as a resistive element and there are no PN junctions.
Accordingly the device is purely passive

Basic Photoresistor structure:

Although there are many ways in which light dependent resistors, or photo
resistors can be manufactured, there are naturally a few more common
methods that are seen. Essentially the photoresisitor or photocell consists of
a resistive material sensitive to light that is exposed to light. The photo
resistive element comprises section of the material with contacts at either
end. A typical structure for a light dependent or photo resistor uses an active
semiconductor layer that is deposited on an insulating substrate. The
semiconductor is normally lightly doped to enable it to have the required
level of conductivity. Contacts are then placed either side of the exposed
area. Within the basic photo resistor or photocell structure, the resistance of
the material itself is a key issue. To ensure the resistance changes resulting
from the light dominate, contact resistance is minimized. To achieve this, the
area around the contacts is normally heavily doped to reduce the resistance
in this region. In many instances the area between the contacts is in the form
of a zig zag, or inter digital pattern. This maximizes the exposed area and by
keeping the distance between the contacts small it reduces the spurious
resistance levels and enhances the gain.

Thermistor:

A resistor made of semiconductors having resistance that varies rapidly and


predictably with temperature is called thermistor. The thermistor is a resistor
whose resistance strongly depends on temperature, showing a nonlinear V-I
characteristic. Specific to this temperature dependence, compared with that

of fixed linear resistors, is the fact that for a temperature variation with one
degree the value of the thermistors resistance changes by tens of percent. In
other words, it is possible that within a narrow temperature range the
thermistor would halve or double its resistance value.

Thermistor sysmbol:

Types:
Decrease or increase in resistance is closely correlated with the type of the
thermistor, which can be:
Negative temperature coefficient, NTC
Positive temperature coefficient, PTC.

Graph of NTC and PTC

Principle of Working of Thermistors:

As mentioned earlier the resistance of the thermistors decreases with the


increase its temperature. The resistance of thermistor is given by:

R = Ro ek
K = (1/T 1/To)

Where R is the resistance of the thermistor at any temperature T in oK


(degree Kelvin) Ro is the resistance of the thermistors at particular reference
temperature Toin oK

e is the base of the Naperian logarithms

is a constant whose value ranges from 3400 to 3900 depending on the


material used for the thermistors and its composition.

The thermistor acts as the temperature sensor and it is placed on the body
whose temperature is to be measured. It is also connected in the electric
circuit. When the temperature of the body changes, the resistance of the
thermistor also changes, which is indicated by the circuit directly as the
temperature since resistance is calibrated against the temperature. The
thermistor can also be used for some control which is dependent on the
temperature.

Procedure:Write the c codes of 7 segments in keil software ,

save it and creat hex files of both.

For verifying the results check in keil through assigned ports.

Make the circuit involving microcontroller and 7 segments in proteus to show the
results.

There are the following steps involved for test bench experiment

Steps for LDR:


Make connections of LDR with 89S51 test bench as shown in the figure.

Place a 330 resistor in series with LDR and connect an LED in parallel.

Connect a DC voltmeter in parallel to the LED for measuring voltages for the ON
state and OFF state of LED.

Obtain required levels of light for which LED glows and for which it stays OFF by
inserting a variable resistor in series with the LDR. Increasing the resistance will
reduce the intensity level of light for which LED glows.

Measure the voltages by DC voltmeter without throwing light on LDR. The


voltage should lie between 0V to 0.8V for this condition and LED should remain
OFF.

Measure the voltages by DC voltmeter again by throwing required intensity of


light on LDR. The voltage should lie between 2V to 5V for this condition and LED
should glow.

Record the voltages against the two intensity levels of light.

Experiment can be repeated for different light intensities by changing value of


variable resistor.

Steps for Thermistor:


Make connections of thermistor with 89S51 test bench as shown in the figure.

Place a 330 resistor in series with parallel combination of 10uF capacitor and
thermistor.

Also connect an LED and DC voltmeter in parallel for measuring voltages for the
ON state and OFF state of LED.

Obtain required levels of heat/temperature for which LED glows and for which it
stays OFF by inserting a variable resistor in series with the LDR instead of 330
resistor. Increasing the resistance will reduce the intensity level of heat for
which LED glows.

Measure the voltages by DC voltmeter at room temperature without heating.


The voltage should lie between 0V to 0.8V for this condition and LED should
remain OFF.

Measure the voltages by DC voltmeter again by heating to boiling point. The


voltage should lie between 2V to 5V for this condition and LED should glow.

Record the voltages against the two temperature levels,

C Codes for Interfacing of LDR and Thermistor with


89S51:

Interfacing of LDR and Thermistor with 89S51in


proteus:

Practically implementation with the help of test


bench:

EXPERIMENT NO:13
Interfacing of Stepper Motor with 89S51:
Objective:What is stepper motor?

C-Codes for stepper motor in keil.

7 segment implementation in proteus.

Practically implementation with the help of test bench.

Components:A computer in which proteus and keil are installed.

Verum board.

A complete set of equipments for soldering.

AT89S51 Microcontroller

Motor Driver ULN2003 IC

Unipolar Stepper Motor

Resistors (4.7k)

Components for 89S51 test bench circuitry

jumper wires

Power supply (5V).

Theory:Stepper Motor:

A stepper motor is a widely used device that translates electrical pulses into
mechanical movement. In applications such as disk drives, dot matrix
printers, and robotics, the stepper motor is used for position control. Stepper
motors commonly have a permanent magnet rotor (also called the shaft)
surrounded by a stator. There are also steppers called variable reluctance
stepper motors that do not have a PM rotor. The most common stepper
motors have four stator windings that are paired with a center-tapped
common. This type of stepper motor is commonly referred to as a four-phase
unipolar stepper motor. The center tap allows a change of current direction in
each of two coils when a winding is grounded, thereby resulting in a polarity
change of the stator.

A Stepper Motor is basically brushless, synchronous DC Motor. The total


rotation of the motor is divided into steps. The angle of a single step is
known as the stepper angle of the motor.

Two phase Stepper Motors:


There are two basic winding arrangements:

1) Bipolar stepper motor:

2) unipolar stepper motor

1) Bipolar stepper motor:

The bipolar stepper motor usually has four wires coming out of it. Unlike
unipolar steppers, bipolar steppers have no common center connection. They
have two independent sets of coils instead. They can be distinguished from
unipolar steppers by measuring the resistance between the wires. One
should find two pairs of wires with equal resistance. If youve got the leads of
your meter connected to two wires that are not connected (i.e. not attached
to the same coil), you should see infinite resistance (or no continuity).Bipolar
stepper motors have no center tap and having equal coil resistances.

Figure 1: Bipolar stepper motor coils

2) Unipolar stepper motor:

A unipolar stepper motor has one winding with center tap per phase. Since in
this arrangement a magnetic pole can be reversed without switching the
direction of current, the commutation circuit can be made very simple (e.g.,
a single transistor) for each winding. Typically, given a phase, the center tap
of each winding is made common: giving three leads per phase and six leads

for a typical two phase motor. Often, these two phase commons are
internally joined, so the motor has only five leads. Windings of this motor can
be identified by touching the terminal wires together in PM motors. If the
terminals of a coil are connected, the shaft becomes harder to turn. One way
to distinguish the center tap (common wire) from a coil-end wire is by
measuring the resistance. Resistance between common wire and coil-end
wire is always half of what it is between coil-end and coil-end wires. Due to
the ease of operation unipolar stepper motor is commonly used. We are
using it in this experiment too.

Figure 2: Unipolar stepper motor coils

Driving Unipolar Stepper with 89C51:

Unipolar stepper motors can be used in various modes. Three of most


common are the Wave Drive, Full Drive and Half Drive mode.

Wave Drive:

In this mode only one electromagnet is energized at a time. Generated


torque will be less when compared to full drive in which two electromagnets
are energized at a time but power consumption is reduced. It has same
number of steps as in the full drive. This method is used in this experiment.

Full Drive:

In this mode two electromagnets are energized at a time, so the torque


generated will be larger when compared to Wave Drive. This drive is

commonly used than others. Power consumption will be higher than other
modes.

Half Drive:

In this mode alternatively one and two electromagnets are energized, so it is


a combination of Wave and Full drives. This mode is commonly used to
increase the angular resolution of the motor but the torque will be less,
about 70% at its half step position. We can see that the angular resolution
doubles when using Half Drive.

In this experiment, unipolar stepper motor will be interfaced with 89C51


microcontroller using ULN2003A to obtain wave drive mode.

ULN2003 Driver:

The ULN2003 is a high-voltage high-current Darlington transistor array. It


consists of seven NPN Darlington pairs that feature high-voltage outputs with
common-cathode clamp diodes for switching inductive loads. The collectorcurrent rating of a single Darlington pair is 500 mA. Applications include
relay drivers, hammer drivers, lamp drivers, display drivers (LED and gas
discharge), line drivers, and logic buffers. The ULN2003A has a 2.7-k series
base resistor for each Darlington pair for operation directly with TTL or 5-V
CMOS devices. In the motor driving circuit ULN2003 reduces back EMF.

Procedure:Write the c codes of stepper motor in keil software ,

Save it and create hex files of both.

For verifying the results check in keil through assigned ports.

Make the circuit involving microcontroller and stepper motor in proteus to show
the results.

Also make the circuit on test bench same as created in proteus.

Connect input pins 1 to 4 of ULN2003 driver IC P2^0 to P2^3 respectively and also to
5V supply through 4.7k resistors.

Short center tap (common wire) of both windings of unipolar stepper motor and connect
to 5V supply.

Connect remaining two ends of each winding one by one to collectors of photo
Darlington pairs in ULN2003A i.e. pins 13 to 16 of ULN2003.

Take 89C51 microcontroller and place it in the programmer.

Burn the program.

Remove it from programmer and place it on the base of test bench.

Give the supply to test bench and verify the results.

C Codes for 7 segments:


7 segment implementation in proteus:
Practically implementation with the help of test
bench:

EXPERIMENT NO:14

Four Way Traffic Light System using 89S51:


Objective:What is traffic light system?

C-Codes for traffic light system in keil.

traffic light system implementation in proteus.

Practically implementation with the help of test bench.

Components:A computer in which proteus and keil are installed.

Verum board.

A complete set of equipments for soldering.

89S51 microcontroller.

traffic light system.

jumper wires

Power supply (5V).

Theory:Vehicular traffic at intersecting streets is typically controlled by traffic control


lights. The function of traffic lights requires sophisticated control and
coordination to ensure that traffic moves as smoothly and safely as possible.
In recent days electro-mechanical controllers are replaced by electronic
circuits. The accuracy & fault tolerant drive towards electronic circuits.
Microcontroller AT89c51 is the brain of this experiment which initiates the
traffic signal at a junction. The leds are automatically on and off by making
the corresponding port in of the micro controller low. There are three ports of
Microcontroller used and twenty four LEDs are used

Procedure:Write the c codes of traffic light system in keil software ,

Save it and create hex files of both.

For verifying the results check in keil through assigned ports.

Make the circuit involving microcontroller and traffic light system in proteus to show
the results.

Test bench implementation:

Select three LEDs 1 red, 1 green and 1 yellow and make 8 such groups of
LEDS.

There are four ways on which we have to control the traffic so make use 2
groups of three LEDs for each way one is controlling the traffic flow from the
front and other from side.

Connect the cathode of LEDs with port 0,2 and 3(through female header)
and their anodes with 5V through 330 resistors.

Make the arrangement of LEDs on varum board just like four way traffic
lights.
Program the microcontroller for operating the LED in active Low mode.

C Codes for 7 segments:


7 segment implementation in proteus:
Practically implementation with the help of test
bench:

EXPERIMENT NO:15

Driving a 12 volt bulb by 8051 using relay.


Objective:Thoeory

Procedure.

C-Codes for 7 segments in keil.

7 segment implementation in proteus.

Practically implementation with the help of test bench.

Components:A computer in which proteus and keil are installed.

Verum board.

A complete set of equipments for soldering.

89S51 microcontroller.

12 volt bulb.

jumper wires

Power supply (5V).

Theory:-

Procedure:Write the c codein keil software ,

Save it and create hex files of both.

For verifying the results check in keil through assigned ports.

Make the circuit involving microcontroller and in proteus to show the results.

Also make the circuit on test bench same as created in proteus.

Solder it and complete the circuit.

Now link the hex files with proteus and verify the results.

Take 89C51 microcontroller and place it in the programmer.

Burn the program.

Remove it from programmer and place it on the base of test bench.

Give the supply to test bench and verify the results.

C Codes for 7 segments:


7 segment implementation in proteus:
Practically implementation with the help of
test bench:

Potrebbero piacerti anche