Microcontroller › 8051 › Delay function in C › This is the code of a setpper
May 9, 2014 at 4:46 pm
#11707
Participant
This is the code of a setpper motor
I am using ISIS Proteus
when I run the code with that delay function the execution us stuck in the function
!!

when I remove this delay function the code is executed normally and continually without stopping ! 

I tried to make many modfiications but nothing works
#include <reg51.h>
msDelay(unsigned int);
#define stepperPort P2
void main (void)
{
stepperPort=0x03;
msDelay(4000);
stepperPort=0x06;
msDelay(4000);
stepperPort=0x0C;
msDelay(4000);
stepperPort=0x09;
msDelay(4000);
}
msDelay(unsigned int tdelay)
{
unsigned k,j;
for(k=0;k<=tdelay;k++)
for(j=0;j<=1275;j++);
}