0
10kviews
Write C language program to toggle all bits of P0, P1, P2 and P3 ports continuously with certain delay.
1 Answer
0
971views

The program

#include < reg51.h>  
void Add_delay (unsigned int);  
void main (void)   
while(1) //repeat loop  
{  
    P0=0xff; //toggle all bits of port 0  
    Add_delay (200); // add delay  
    P0=0x00; //toggle all bits of port 0   
    Add_delay (200); //add delay   
    P1=0xff; //toggle all bits of port 1  
    Add_delay (200); //add delay …

Create a free account to keep reading this post.

and 5 others joined a min ago.

Please log in to add an answer.