problem in coding - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

problem in coding

Hello Every one,

I am new to embedded world. I need some help in coding for interrupt. i want to on two motor after some delay i want to on other motor. i have two interrupt emergency stop and reset. when emergency stop interrupt comes the whole process should stop and when reset is pressed again the process should start from beginning . i had written a program please suggest me what to do?

#include
#define IE0_VECTOR 0
#define IE2_VECTOR 2
sbit emg=P3^2;
sbit reset=P3^3;
sbit v1=P0^0;
sbit v2=P0^1;
sbit v3=P0^2;
sbit v4=P0^3;
sbit v5=P0^4;
sbit v6=P0^5;
sbit v7=P0^6;
sbit v8=P0^7;
void msdelay(unsigned int);

void main(void)
{
while(1)
{
unsigned char x ;

IT0=1;
IT1=1;
EX0=1;
EX1=1;
EA=1;


while(x!=1)
{
v1=1;
v2=1;
msdelay(650);
v1=0;
msdelay(300);
v2=0;
v3=1;
v4=1;
msdelay(630);
v3=0;
msdelay(300);
v4=0;
v5=1;
v6=1;
msdelay(650);
v5=0;
msdelay(300);
v6=0;
v7=1;
v8=1;
msdelay(650);
v7=0;
msdelay(300);
v8=0;
}

}
}

void msdelay(unsigned int itime)
{
unsigned int i,j;
for (i=0;i<itime;i++)
for (j=0;j<1275;j++);
}

static int_emg(void) interrupt IE0_VECTOR
{
unsigned char x;
x=1;
}

static int_reset(void) interrupt IE2_VECTOR
{
unsigned char x;
x=0;
}


Sign In or Register to comment.