
COMPONENTS:
·
Microcontroller
ic 8055
·
Lcd
·
ULN2003
·
Pull up Resistor
:10k
·
5v regulator
·
Potentiometer
·
LEDS
·
Switches
·
Motor (unipolar)
·
Capacitor
10uf(50v)
Microcontroller 8055:
8051 based Full Static
CMOS controller with Three-Level Program Memory Lock
LCD:
1
|
Ground (0V)
|
Ground
|
2
|
Supply voltage; 5V (4.7V –
5.3V)
|
Vcc
|
3
|
Contrast adjustment; through
a variable resistor
|
VEE
|
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
|
8-bit data pins
|
DB0
|
8
|
DB1
|
|
9
|
DB2
|
|
10
|
DB3
|
|
11
|
DB4
|
|
12
|
DB5
|
|
13
|
DB6
|
|
14
|
DB7
|
|
15
|
Backlight VCC (5V)
|
Led+
|
16
|
Backlight Ground (0V)
|
Led-
|
ULN2003:
It is used as a buffer
ic. It used for current buffering because microcontroller has sufficient
current to rotate the motor so we connect buffer ic to boast up the current.
MOTOR (unipolar):
Uni-polar have coil
center tapped .In center tapped while changing north to south ,south to north
direction current direction changes.
PULL UP RESISTOR:
We need pull up
resistor to sink the current with other sensor.
5V REGULATOR(7805):
It is used to convert
9v to 5v and pass it to microcontroller,switches and lcd.
POTENTIOMETER:
It is used to control
the brightness of lcd screen.
SWITCHES:
They are directly
connected to port to change port logic .
Working:
we have connected
switches at port 0
sw1=bike
sw2=bus
sw3=truck
if the worker
saw a bike coming he will press 1 and bike driver will get to know about
his charge ..if he pay his charge RS:30 .motor will start and barrier will open
…and thank you gud luck will appear on lcd ,same process will be for truck and
bus , car the respective button will be press by the worker at tollplaza as he
see any vehicle coming.
Switches are connected
at the port 0 .When switches are pressed the charge will appear on lcd that is
connected to the P1 of microcontroller.if the person pay his tax .the worker
will press button 4 and barrier will open and blue led that is connected at
port 3 is on .and when the vehicle is at barrier red led will glow and the
other vehicles will not entertained at that time.when vehicle will pass from
barrier the green light will appear showing
that now other vehicle can come.
Programming :
#include<reg55.h>
// data port P2
sbit rs=P3^0; // Register select pin
sbit rw=P3^1; // Read
write pin
sbit en=P3^2; // Enable
pin
sbit green=P3^3; //
Register select pin
sbit yellow=P3^4; //
Read write pin
sbit red=P3^5; //
Enable pin
sbit bike=P0^0;
sbit bus=P0^1;
sbit truck=P0^2;
sbit on=P0^3;
sbit off=P0^4;
void delay(unsigned int
msec);
void
lcd_command(unsigned char comm);
void lcd_data(unsigned
char disp);
lcd_dataa(unsigned char
*disp);
void lcd_ini();
void bikef();
void motoropen();
void onf();
void motorclose();
void stop();
void busf();
void truckf();
void delay1(unsigned int count);
void delay1(unsigned
int count)
{
int i;
for(i=0;i<count;i++);
}
void delay(unsigned int
msec) //delay function
{
int i,j;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}
void
lcd_command(unsigned char comm) // function to send command to LCD
{
P1=comm;
en=1;
rs=0;
rw=0;
delay(1);
en=0;
}
void lcd_data(unsigned
char disp) // function to send data on
LCD
{
P1=disp;
en=1;
rs=1;
rw=0;
delay(1);
en=0;
}
lcd_dataa(unsigned char
*disp) // function to send string to
LCD
{
int x;
for(x=0;disp[x]!=0;x++)
{
lcd_data(disp[x]);
}
}
void lcd_ini() //Function to inisialize the LCD
{
lcd_command(0x38); /
delay(100);
lcd_command(0x0E); //
delay(100);
lcd_command(0x01); //
delay(100);
lcd_command(0x06);
delay(100);
lcd_command(0x80);
delay(100);
}
void main()
{
P3=0x00;
P1=0x00;
P0=0x00;
P2=0x00;
stop();
while(1)
{
if
(bike==1)
{
bikef();
}
else if (bus==1)
{
busf();
}
else if (truck==1)
{
truckf();
}
else if (on==1)
{
onf();
motoropen();
}
else if (off==1)
{
stop();
motorclose();
}
}
}
void stop()
{
red=1;
yellow=0;
green=0;
lcd_ini();
lcd_dataa("Plz Stop here");
delay(100);
lcd_command(0xC0); // bring cursor to position 6 of line 1
delay(100);
lcd_dataa("Pay
tex");
}
void bikef()
{
lcd_ini();
lcd_dataa("Bike pay tex");
delay(100);
lcd_command(0xC0); // bring cursor to position 6 of line 1
delay(100);
lcd_dataa("30/Rs
pay ");
}
void busf()
{
lcd_ini();
lcd_dataa("Bus pay tex");
delay(100);
lcd_command(0xC0); // bring cursor to position 6 of line 1
delay(100);
lcd_dataa("50/Rs
pay ");
}
void
truckf()
{
lcd_ini();
lcd_dataa("Truck pay tex");
delay(100);
lcd_command(0xC0); // bring cursor to position 6 of line 1
delay(100);
lcd_dataa("100/Rs
pay ");
}
void onf()
{
red=0;
yellow=1;
green=0;
lcd_ini();
lcd_dataa("Thank you");
delay(100);
lcd_command(0xC0); // bring cursor to position 6 of line 1
delay(100);
lcd_dataa("Good
Luck");
red=0;
yellow=0;
green=1;
}
void motoropen()
{
unsigned char z;
for (z=0;z<60;z++)
{
P2=0x01;
delay1(350);
P2=0x02;
delay1(350);
P2=0x04;
delay1(350);
P2=0x08;
delay1(350);
}
}
void motorclose()
{
unsigned char y;
for (y=0;y<60;y++)
{
P2=0x08;
delay1(350);
P2=0x04;
delay1(350);
P2=0x02;
delay1(350);
P2=0x01;
delay1(350);
} }
No comments:
Post a Comment