Write an 8051 C program to toggle bit D0 of P1 50,000 times.

By

Write an 8051 C program to toggle bit D0 of P1 50,000 times.



Solution:
#include <reg51.h>
sbit MYBIT=P1^0;
void main(void) {
  unsigned int z;
  for (z=0;z<50000;z++) {   
    MYBIT=0;
    MYBIT=1;
  }
}

0 comments:

Post a Comment

If you have any questions or droughts feel free to ask here.