sbit P07 = 0x87; void main() { while(P07); // End Program unless we get error printf("Error - line went low"); // Print Error being recieved for(;;) // End after Error }
Are you sure that it's never getting out of the loop; could it just be that your printf is not working? I think that volatile is implicit in SFR & sbit definitions?
Try this: sbit P07=P0^7;
What makes P0.7 go low? Jon
I found my problem. P0.7 was forced high previously in my code. Quote from "C and the 8051, Hardware, Mdular Programming and multi-tasking Volume I" by Thomas W. Schultz -- any port you are using as an input must have a 1 written out to it. As the ports are going through an inverter on the board, the high was actually a low, and therefore not allowing the port to be used as an input. I admit, I am still learning C and still learning the 8051, so I tend to make lots of mistakes that a real Embedded programmer would catch. I think I explained the problem and solution well enough here. If not ask away and I'll give you the references in the books I am using that make it clearer than I can explain.