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;
}
}
All About 8051 Microcontroller.Learn all basics of Microcontrollers and Embedded Systems.
Subscribe to our newsletter to get the latest updates to your inbox. ;-)
Your email address is safe with us!
© 2015 8051 Microcontroller. Designed by Bassar Patel
0 comments:
Post a Comment
If you have any questions or droughts feel free to ask here.