0
2.3kviews
Write C language program to read P1 and store the ones complement of P1 to P2
1 Answer
written 6.0 years ago by | • modified 5.9 years ago |
The program
#include< regx51.h>
void main(void)
{
unsigned char a,b,c;
P1=0xFFH; //set port 0 as an input port
P2=0x00FH; //set port 1 as an output port
a=P1; //read number from port 1
a=~a; //logical not operator
P2=a; //store one’s complement to port 2
}