Write an 8051 C program to toggle bits of P1 continuously forever with some delay.

By

Write an 8051 C program to toggle bits of P1 continuously forever with some delay.

Solution:




#include <reg51.h>

void main(void) {

  unsigned int x;

  for (;;) {   

    P1=0x55;      

    for (x=0;x<40000;x++); //time delay

    P1=0xAA;  

    for (x=0;x<40000;x++);   }}

0 comments:

Post a Comment

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