0
2.1kviews
Write C language program to read P1 and store the ones complement of P1 to P2
1 Answer
written 5.7 years ago by | • modified 5.6 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
}