#include<reg51.h>
void lcd_cmd(char);
void lcd_init();
void lcd_data(char);
void delay(int);
sbit rs=P2^0;
sbit oe=P2^1;
void column1();
void column2();
void column3();
char getkey();
sbit c1=P1^0;
sbit c2=P1^1;
sbit c3=P2^2;
sbit r1=P2^3;
sbit r2=P2^4;
sbit r3=P2^5;
sbit r4=P2^6;
int x,y;
char num[4][3]={{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}};
void main()
{
char c;
Saturday, February 25, 2012
Keypad Interfacing with 8051 Program
Token System Program for 8051
#include<reg51.h>
void lcd_cmd(char);
void lcd_init();
void lcd_data(char[]);
void delay(int);
void lcd_dataint(int);
void counter1(); //to print the count value at counter1 location
void counter2(); //(on lcd)
void counter3();
sbit rs=P2^4;
sbit oe=P2^0;
sbit but1=P2^1; //counter1 button
sbit but2=P2^2; //counter2 button
sbit but3=P2^3; //counter3 button
int token_no=0; //overall count
void main()
{
rs=0;
oe=0;
but1=1;but2=1;but3=1;
TMOD=0x01;
lcd_init();
lcd_data("C1 C2 C3 ");
Simple ELEVATOR program for 8051
#include<reg51.h>
#include"lcd_display.h"
sbit ON = P1^0;
sbit floor1 = P1^1;
sbit floor2 = P1^2;
sbit floor3 = P1^3;
sbit dooropen = P1^4;
sbit motorF = P2^0;
sbit motorR = P2^1;
sbit motor_en = P2^3;
sbit led_doorOpen = P2^2;
sbit ON_led = P2^4;
void delay_sec(int);
short int PresentLevel = 0, RequestLevel;
void main()
{
motorF = motorR = led_doorOpen = motor_en = ON_led = rs = en = 0;
ON = floor1 = floor2 = floor3 = dooropen = 1;
TMOD = 0x01;
P3=0x00;
lcd_init();
motor_en=0;
Friday, February 24, 2012
Wired ROBO car Program for 8051
/* wired robo car program for 8051 microcontroller
design description:;: contains two motors one on left(ml) and one on right(mr)::
contains headlights and backlights::moreover this is wired robo car (not wireless) */
#include<reg51.h>
sbit mr_p = P2^0; //motor_right_positive
sbit mr_n = P2^1; //motor_right_negetive
sbit ml_p = P2^2; //motor_left_positive
sbit ml_n = P2^3; //motor_left_negetive
sbit leds_front = P2^4;
sbit en_mr = P2^6; //motor_right_enable
sbit en_ml = P2^7; //motor_left_enable
sbit led_backL = P3^0;
sbit led_backR = P3^1;
sbit head_lights = P1^6; //inputs
sbit key = P1^5;
sbit fw = P1^0;
sbit re = P1^1;
sbit left = P1^2;
sbit right = P1^3;
sbit stop = P1^4;
void main()
{
int i;
fw = re = left = right = stop = head_lights = key = 1;
mr_p = mr_n = ml_p = ml_n = leds_front = en_mr = en_ml = 0;
led_backL = led_backR = 0;
Electronic Voting Machine
#include<reg51.h>
void nominee(char[],int);
void lcd_cmd(char);
void lcd_init();
void lcd_data(char[]);
void delay(int);
void lcd_dataint(int);
void results();
sbit start=P1^0;
sbit n1=P1^1;
sbit n2=P1^2;
sbit n3=P1^3;
sbit rs=P2^0;
sbit oe=P2^1;
sbit again=P1^4;
sbit result=P1^5;
int nom[3]={0,0,0};
int overallC=0,permission=0;
void main()
{
n1=n2=n3=start=1;
oe=rs=0;
P3=0x00;
TMOD=0x01;
Subscribe to:
Posts (Atom)