#include<reg51.h>
#define stepper P1
unsigned int d;
unsigned int mysequence[]= {
0x8,0x4,0x2 ,0x1 ,
0x8,0x4,0x2 ,0x1 ,
0x8,0x4,0x2 ,0x1 ,
0x8,0x4,0x2 ,0x1 ,
0x8,0x4,0x2 ,0x1 ,
0x8,0x4,0x2 ,0x1 ,
0x8,0x4,0x2 ,0x1 ,
0x8,0x4,0x2 ,0x1 ,
0x8,0x4,0x2 ,0x1 ,
0x8,0x4,0x2 ,0x1 ,
0x8,0x4,0x2 ,0x1 ,
0x8,0x4,0x2 ,0x1
};
void ex0_isr (void) interrupt 0
{
if (d<210)
{
d++; // Increment the count
}
}
void ex1_isr (void) interrupt 2
{
if (d>0)
{
d--;
}
}
void delay(){
unsigned char i,j,k;
for(i=0;i<0;i++)
for(j=0;j<255;j++)
for(k=0;k<255;k++);
}
void main()
{
IT0 = 1; // Configure interrupt 0 for falling edge on /INT0 (P3.2)
IT1 = 1; // Configure interrupt 1 for falling edge on /INT0 (P3.2)
EX0 = 1; // Enable EX0 Interrupt
EX1 = 1;
EA = 1; // Enable Global Interrupt Flag
while(1)
{
if(d==0)
{
}
else {
stepper= d;
// stepper= mysequence[d];
delay();
}
}
}