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

Why is this On & Off uneven.

This code below is for 89s2051. It produces uneven on and off times. I viewed the port pin with oscilloscope
and the on time is 3.2ms and off time is 2.5ms.
The delay being the same should it not produce waveform with equal on off times.

#include <AT89X51.H>
#include <INTRINS.H>

/*----------------------------------------------------
****** port and bit assignment for LCD *******
----------------------------------------------------*/

typedef unsigned char bit_8;

/*-------------------------------
*** Main programe starts here ***
-------------------------------*/

void wait (void)
{                   /* wait function */
  ;                /* only to delay for LED flashes */
}

void main()
{
    unsigned int i;


        i = 0;

        P1_3 = 0;

        while(1)
        {
         P1_3 = 0;
         for (i = 0; i < 200; i++) wait();
         P1_3 = 1;
         for (i = 0; i < 200; i++) wait();
        }

}

Thanks & Regards,
Jai


0