Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Speed measurement using Moc 7811

Status
Not open for further replies.

jsureshp

Junior Member level 3
Joined
Jul 20, 2010
Messages
26
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Chennai
Activity points
1,492
Anybody help to me.
I had Moc 7811 ic.
I want do a project using that component,like speed measure and line follower. can you give any circuit for that components
 

The above program for speed measuring the motor, through the interrupt and lcd display..
anybody help to me
the following code are correct or not?



#include<reg51.h>

sfr lcdout =0x90; //P2
sbit rs =0x85;// P0.5
sbit rw =0x86;
sbit en =0x87;

void Init_LCD();
void lcdcmd(unsigned int val);
void lcddata(unsigned char*);
void lcddata1(unsigned int);
void delay();
void count();
void Display( unsigned int val);
void Display1( unsigned int val);
//void display(unsigned int);
unsigned int cnt,disp,j,V;
unsigned char aray[]={'0','1','2','3','4','5','6','7','8','9'};


void main()
{
unsigned int i; V=0;
Init_LCD();
lcdcmd(0x83);
lcddata("MOTOR SPEED");
disp=0;
while(1)
{

cnt=0;
for(i=0;i<600;i++) {count();}


// disp=cnt; //display(disp);
//lcdcmd(0xC5);
// lcddata1(98);

loop:if(P3_0==1) goto loop;
}



}


void count()
{

TMOD=0x01;
TH0=0x3C;
TL0=0xB0;
while(TF0==0) { if(P0_0==0){cnt++;} else V++; }
TF0=0;
TR0=0;

Display(cnt);
//Display1(V);

}


void Init_LCD()
{
lcdcmd(0x38);
lcdcmd(0x0C);
lcdcmd(0x01);
}
void lcdcmd(unsigned int val)
{
lcdout=val;
rs=0;
rw=0;
en=1;
delay();
en=0;
}

void lcddata(unsigned char *t)
{
while(*t)
{
lcdout=*t++;
rs=1;
rw=0;
en=1;
delay();
en=0;
}
}

void lcddata1(unsigned int d)
{
lcdout=d;
rs=1;
rw=0;
en=1;
delay();
en=0;
}

void delay()
{
for(j=0;j<1000;j++);
}
void Display( unsigned int val)
{
unsigned int l,m,z;
l=val%10;
m=(val/10)%10;
z=(val/100)%10;
lcdcmd(0xC6);
lcddata1(aray[z]);
lcdcmd(0xC7);
lcddata1(aray[m]);

lcdcmd(0xC8);
lcddata1(aray[l]);


}
void Display1( unsigned int val)
{
unsigned int l,m,z;
l=val%10;
m=(val/10)%10;
z=(val/100)%10;
lcdcmd(0xCA);
lcddata1(aray[z]);
lcdcmd(0xCB);
lcddata1(aray[m]);

lcdcmd(0xCC);
lcddata1(aray[l]);


}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top