Write a program that will perform the following IFTHENELSE s
Write a program that will perform the following IF-THENELSE statement IF (contents of 35H) is even, THEN (Clear P1.1) ELSE (Set P1 2)
Solution
#include<reg51.h>
void main(void)
{
unsigned char newbyte ;
P0=35H ;
while (1)
{
newbyte=P0 ;
if ( newbyte % 2 == 0)
P1.1 = 0 ;
else
P1.2 = 1 ;
}
}
