fork download
  1. #include <reg52.h>
  2. sfr CKCON = 0x8F;
  3. void delay (unsigned long);
  4.  
  5. void main ()
  6. {
  7. unsigned int j;
  8. CKCON = 0x01; //กำหนดเวลา
  9. P2 = 0x00; //เริ่มที่พอต
  10. while (1)
  11. {
  12. P2 = 0x02;
  13. delay(50000);
  14. P2 = 0x04;
  15. delay(50000);
  16. P2 = 0x08 ;
  17. delay(50000);
  18. P2 = 0x10 ;
  19. delay (50000);
  20. P2 = 0x20 ;
  21. delay(50000);
  22. P2 = 0x40 ;
  23. delay(50000);
  24. P2 = 0x80 ;
  25. delay(50000);
  26. }
  27. }
  28.  
  29. void delay(unsigned long i )
  30. {
  31. while (i > 0){i--;}
  32. return;
  33.  
  34. }
Success #stdin #stdout 0.04s 25560KB
stdin
Standard input is empty
stdout
#include <reg52.h>
sfr CKCON = 0x8F;
void delay (unsigned long);

void main ()
{
 unsigned int j;
 CKCON = 0x01; //กำหนดเวลา
 P2 = 0x00;  //เริ่มที่พอต
 while (1)
 {
	P2 = 0x02;
	delay(50000);
	P2 = 0x04;
	delay(50000);
	P2 = 0x08 ;
	delay(50000);
	P2 = 0x10 ;
	delay (50000);
	P2 = 0x20 ;
	delay(50000);
	P2 = 0x40 ;
	delay(50000);
	P2 = 0x80 ;
	delay(50000);
 }
}

void delay(unsigned long i )
{
while (i > 0){i--;}
return;

}