DC motor:
CODE:
#include <REGX52.H>
sbit s1=P1^0;
sbit s2=P1^1;
sbit m1=P2^0;
sbit m2=P2^1;
sbit m3=P2^2;
sbit m4=P2^3;
void main()
{
P1=0x00;
P2=0x00;
while(1)
{
if(s1==0 && s2==0)
{
m1=0;
m2=0;
m3=0;
m4=0;
}
if(s1==0 && s2==1)
{
m1=0;
m2=1;
m3=0;
m4=1;
}
if(s1==1 && s2==0)
{
m1=1;
m2=0;
m3=1;
m4=0;
}
if(s1==1 && s2==1)
{
m1=0;
m2=0;
m3=0;
m4=0;
}
}
}
PROTEUS:
CODE:
#include <REGX52.H>
sbit s1=P1^0;
sbit s2=P1^1;
sbit m1=P2^0;
sbit m2=P2^1;
sbit m3=P2^2;
sbit m4=P2^3;
void main()
{
P1=0x00;
P2=0x00;
while(1)
{
if(s1==0 && s2==0)
{
m1=0;
m2=0;
m3=0;
m4=0;
}
if(s1==0 && s2==1)
{
m1=0;
m2=1;
m3=0;
m4=1;
}
if(s1==1 && s2==0)
{
m1=1;
m2=0;
m3=1;
m4=0;
}
if(s1==1 && s2==1)
{
m1=0;
m2=0;
m3=0;
m4=0;
}
}
}
PROTEUS:
Why my DC motor producing Jerks! not rotating! could you please help me from this.
ReplyDeletehttp://www.npeducations.com