Oscilloscope for find the I/O 0 after the delay process, does not keep 0,
Then write the program is as follows:
#include
Sbit DQ=P0 ^ 3;
Void delay1s (void)//error - 0.000000000227 us
{
Unsigned char a, b, c;
For (c=13; C> 0; C -)
For (b=247; B> 0; B -)
For (a=142; A> 0; A -);
_nop_();//if the Keil, require the use intrins. H
}
The main ()
{
DQ=0;
Delay1s ();
DQ=1;
Delay1s ();
}
DQ waveform is measured with the oscilloscope, found in the process of 0 after the delay, did not keep 0, only lower moment is 0,
I was wondering if I pull up resistance value is not correct,
CodePudding user response:
the while (1) {XXXXX}CodePudding user response:
Void delay1s (void)//error - 0.000000000227 us
{
Unsigned char a, b, c;
For (c=13; C> 0; C -)
For (b=247; B> 0; B -)
For (a=142; A> 0; A -)/*; */
_nop_();//if the Keil, require the use intrins. H
}
CodePudding user response:
Pull up resistors 1 k, but the main function didn't write operation cycle will have to rely on watchdog restart,Is to use simulation software or instrument oscilloscope looking at?
Usually use software first observe the waveform is also very convenient,
As observed this debug waveform,