1.1 Objective:: MBICT
1.1 Objective:: MBICT
1.1 Objective:: MBICT
INTRODUCTION
1.1 Objective:
Aim of this project is to allow the servo motor to move to an angle specified
by the user. The pulse train required to rotate the servo is produced
by AT89C51 microcontroller. The desired angle of rotation is provided
through a 4x3 keypad interfaced to the microcontroller and 16x2 LCD is to
display the angle of rotation entered by the user.
To learn how to write an assembly language and combining with
the hardware.
To learn and develop knowledge in designing the different applications
by using the microcontroller.
Description
Power Supply: It will be +5V DC power supply & given to the whole circuit.
Input: It will be 4×3 keypad & connect with the 8051 microcontroller. When
the circuit is powered, the user to enter the angle of rotation . The user can enter
the angle in degrees through keypad and the angle of rotation is accepted by the
microcontroller.
Driver IC: It will be LM324. Before connecting to the control wire of servo,
the output from the microcontroller (P1^0) is fed through a comparator IC
(LM324) so that the signal is protected from any loss due to overloading.
Description
This project allows the servo motor to move to an angle specified by the user.
The pulse train required to rotate the servo is produced
by AT89C51 microcontroller. The desired angle of rotation is provided through
a 4x3 keypad interfaced to the microcontroller. A 16x2 LCD is also connected
with the microcontroller to display the angle of rotation entered by the user.
Here keypad is organized as a matrix of switches in rows and column. There are
4X3 matrix keypad and a 16x2 LCD for displaying the output of keypad. The
circuit diagram shows the connection of keypad with the controller. Port P0 is
used to scan input from the keypad. The concept of interfacing keypad with the
microcontroller is simple. Every number is assigned two unique parameters, i.e.,
row and column number (n(R, C). Initially all the rows are set to zero by the
controller and the columns are scanned to check if any key is pressed. In case no
key is pressed the output of all the columns will be high. Whenever a key is
pressed the row and column corresponding to the key will get short, resulting in
the output of the corresponding column goes to go low (since we have made all
the rows zero). This gives the column number of the pressed key. Once the
column number is detected, the controller set’s all the rows to high. Now one by
one each row is set to zero by controller and the earlier detected column is
checked if it becomes zero. The row corresponding to which the column gets
zero is the row number of the digit. This process is very fast and even if the
switch is pressed for a very small duration of time the controller can detect the
key which is pressed. The controller displays the number corresponding to the
row and column on the LCD.
2.3.1 LM324 IC
Features
Wide power supply range:
Single supply 3V to 32V
or dual supplies ±1.5V to ±16V
Advantages
4 Selects command register when low; and data register when high Register Select
5 Low to write to the register; High to read from the register Read/write
6 Sends data to data pins when a high to low pulse is given Enable
7 DB0
8 DB1
9 DB2
10 DB3
8-bit data pins
11 DB4
12 DB5
13 DB6
14 DB7
15 Backlight VCC (5V) Led+
16 Backlight Ground (0V) Led-
LCD (Liquid Crystal Display) screen is an electronic display module and find a
wide range of applications. A 16x2 LCD display is very basic module and is
very commonly used in various devices and circuits. These modules are
preferred over seven segments and other multi segment LEDs. The reasons
being: LCDs are economical; easily programmable; have no limitation of
displaying special & even custom characters animations and so on.
Here 16x2 LCD means it can display 16 characters per line and there are 2 such
lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has
two registers, namely, Command and Data.
Features
5 x 8 dots with cursor
Built-in controller (KS 0066 or Equivalent)
+ 5V power supply (Also available for + 3V)
1/16 duty cycle
N.V. optional for + 3V power supply
Reset Reset 9
Crystal 2
Ground Ground(0V) 20
RAM(byte) 128
ROM 4K
TIMERS 2
Serial Port 1
I/O Pins 32
Interrupt Sources 6
In 40 pin AT89C51, there are four ports designated as P1, P2, P3 and P0. All
these ports are 8-bit bi-directional ports, i.e., they can be used as both input and
output ports. Except P0 which needs external pull-ups, rest of the ports have
internal pull-ups. When 1s are written to these port pins, they are pulled high by
the internal pull-ups and can be used as inputs. These ports are also bit
addressable and so their bits can also be accessed individually.
2.3.4 Preset
Fig.2.3.4 Preset
C
E
D
I
H
A
B AT89C51 Microcontroller
C LCD Display
D 4×3 Keypad
E Preset ; 10k
F Crystal ; 11.0592MHz
G Resistor; 10kΩ
H LM324 IC
I Capacitor ; 10µF
The new Keil µVision4 has been designed to enhance developer's productivity,
enabling faster, more efficient program development.
µVision4 introduces a flexible window management system, enabling you to
drag and drop individual windows anywhere on the visual surface including
support for Multiple Monitors. It is an integrated embedded software
development environment for project management, program editing, debugging,
and simulation. It is an excellent development tools for beginner students and
professionals for the 8051 microcontroller embedded software development.
There are some features of this tool as listed below.
Keil µVision 4 is cross compiler for the AT89C51 microcontroller families. The
compiler simulated the program and also converts the program in to hex file
which is used to burn in the microcontroller. The Keil µVision 4 we uses is of
6Kb of size means we can run a code up to a size of 6Kb. It supports the all the
microcontroller of C51 families.
There is two language can be use in order to program the IC, that is either low
level language that is assembly or high level language such as C programming
and IC Basic Pro. Both of the method has an advantage and disadvantages. In
this project is using the high level language & the size of program can exceed
1K.
When the program is executed, data starts to read from LCD. Here when the
circuit is powered, the LCD prompts the user to enter the angle of rotation. The
user can enter the angle in degrees through keypad. The angle entered by the
user is also displayed on the LCD screen. As the user presses ‘*’ button of
keypad, the angle of rotation is accepted by the microcontroller and the servo
moves to the user defined angular position. If an angle greater than 180° is
entered, the difference of the input with 180° is considered as the angle of
rotation. If user enter the angle that is greater than 360° then it is accepted by
microcontroller and it gives difference of the input with 180°. So this difference
is considered as the angle of rotation . Then again user enter the degree which is
less than equal to 180°.
The simplest type of printed circuit board is the single side board. It consists of
a thin conductive foil cladding on one side of a rigid non-conductive laminate.
Component is positioned on the insulator side of the board. Lead access holes
are drilled through both the laminate material and conductive foil for each
component lead. These lead are passed through holes and then they are bent and
soldered to the foil and excess lead is trimmed. The foil cladding is previously
processed into conductive path to provide the required wiring for working
circuit.
When the circuit is powered, the LCD prompts the user to enter the angle
of rotation. The user can enter the angle in degrees through keypad.
(Figure1)
Figure 1
When user enter the angle in degrees through keypad. Then angle entered
by the user is also displayed on the LCD screen. As the user presses ‘*’
button of keypad, the angle of rotation is accepted by the
microcontroller and the servo moves to the user defined angular position.
Here user enter the angle in 0° and 90°. (Figure 2 and Figure 3)
Figure 3
Figure 5
Figure 6
Figure 7
// 0 degree = 700us
#include<reg51.h>
#define port P1
sbit rs = port^3;
sbit rw = port^4;
sbit en = port^5;
int i,j;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
dataport = item;
rs= 0;
rw=0;
en=1;
delay(1);
en=0;
return;
dataport = item;
rs= 1;
rw=0;
en=1;
delay(1);
en=0;
return;
int i=0;
while(str[i]!='\0')
lcd_data(str[i]);
i++;
return;
int int_amt;
int_amt = time_val/100;
lcd_data(int_amt+48);
time_val = time_val%100;
int_amt = time_val/10;
lcd_data(int_amt+48);
int_amt = time_val%10;
lcd_data(int_amt+48);
lcd_cmd(64);
lcd_data(5);
lcd_data(2);
lcd_data(0);
lcd_data(0);
lcd_data(0);
lcd_data(0);
lcd_data(0);
int i;
TR1=1;
for(i=0;i<msec;i++)
while(TF1==0);
TF1=0;
TR1=0;
if(count==4)
lcd_cmd(0x01);
lcd_data_string("done");
check=num;
else
check=0;
if(count==1)
digit[0]=num;
else
if(count==2)
digit[1]=digit[0];
else
if(count==3)
digit[2]=digit[1];
digit[1]=digit[0];
digit[0]=num;
lcd_data((num+48));
row1=row2=row3=row4=1;
row1=0;
if(col1==0) // Key 1
count=count+1;
digit_set(1);
row1=1;
row2=0;
if(col1==0) // Key 4
delay(10);
count=count+1;
digit_set(4);
row2=1;
row3=0;
if(col1==0) // Key 7
delay(10);
count=count+1;
digit_set(7);
row4=0;
if(col1==0) // Key *
delay(10);
count=count+1;
if(count==4)
digit_set(10);
else
count=4;
digit_set(10);
row4=1;
row1=row2=row3=row4=1;
row1=0;
if(col2==0) // Key 2
delay(10);
count=count+1;
digit_set(2);
row1=1;
row2=0;
if(col2==0) // Key 5
delay(10);
count=count+1;
digit_set(5);
row2=1;
row3=0;
if(col2==0) // Key 8
delay(10);
count=count+1;
digit_set(8);
row3=1;
row4=0;
if(col2==0) // Key 0
delay(10);
count=count+1;
digit_set(0);
row4=1;
row1=row2=row3=row4=1;
row1=0;
delay(10);
count=count+1;
digit_set(3);
row1=1;
row2=0;
if(col3==0) // Key 6
delay(10);
count=count+1;
digit_set(6);
row2=1;
row3=0;
if(col3==0) // Key 9
delay(10);
count=count+1;
row3=1;
row4=0;
if(col3==0) // Key #
delay(10);
count=count+1;
lcd_data_string("wrong data");
lcd_cmd(0x01);
lcd_data_string("enter degree:");
lcd_cmd(0xc5);
count=0;
row4=1;
void keypad()
if(col1==0)
check_col1();
if(col2==0)
check_col2();
else
if(col3==0)
check_col3();
delay(10);
void main()
int i;
col1=col2=col3=1;
TMOD=0x20; // MODE2
shape();
output=0;
lcd_cmd(0x38);
lcd_cmd(0x0e);
lcd_cmd(0x01);
delay(100);
count=0;
lcd_cmd(0x01);
lcd_data_string("enter degree:");
lcd_cmd(0xc5);
check=0;
digit[0]=0;
digit[1]=0;
digit[2]=0;
while(check!=10)
row1=row2=row3=row4=0;
keypad();
time=(digit[0]+(digit[1]*10)+(digit[2]*100));
lcd_cmd(0xc4);
time=time%180;
lcd_data_int(time);
/* for(i=0;i<200;i++)
output=1;
timer(14);
output=0;
timer(360);
}*/
delay(100);
for(i=0;i<80;i++)
output=1;
timer(time+14);
output=0;
timer(360);
timer(3000000);
After we done our project about servo motor rotation through keypad, we are
able to learn and develop knowledge in designing by used a microcontroller and
different softwares as Keil µVision & Proteus. We are also learn how to
develop skills and knowledge in systematic PCB design approach using Proteus
software. The DC servo motors are presently used world wide in applications
such as X-Y tables, factory automation, coil winders, labeling equipment,
machine tool, insertion machines, robotics, pick and place, packaging,
converting equipment, assembly equipment and laboratory equipment.
BIBLIOGRAPHY:
http://en.wikipedia.org
http://www.scribd.com
http://www.engineersgarage.com
BOOKS:
The 8051 Microcontroller & Embedded Systems using Assembly & C By Mazidi