This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

delay value problem

Hello everyone,
I am not able to figure out the maximum delay value i can give.If i give to high the simulator stops at that function,please suggst me the maximum delay i can give.
Here's the code:

//square wave generator
#include <reg52.h>

#define on 1;
#define off 0;

void delay(void);

sbit switchpin = P1^0;
sbit sqgen = P2^1;

void main(void)
{
        P2 = off;
        while(1)
        {
                if(switchpin == 1)
                {
                        sqgen = on;
                        delay();
                        sqgen = ~sqgen;
                }
                else
                        sqgen = off;
        }
}
void delay(void)
{
        int i=0;
        for(i=0;i<=29000;i++);
}


The value of 'i' in the delay function is what i am referring to.
Thanks in advance,
Arun

0