/* Program 3-12 shows how to test bit D0 to see if it is high */ #include main() { unsigned char status; unsigned char temp; printf("\nType in a Hex value\n"); scanf("%X",&status); //get the data temp=status&0x01; //mask all bits except DO if (temp==0x01) //is it high? printf("D0 is high"); //if yes, say so else printf("D0 is low"); //if no, say so }