Example: Reading and writing bits (simple version)


-*-------------------------------------------------------------*/
#include <Reg52.H>
sbit Switch_pin = P1^0;
sbit LED_pin = P1^1;
/* ............................................................... */
void main (void)


{
bit x;
/* Set switch pin for reading */
Switch_pin = 1;
while(1)
{
x = Switch_pin; /* Read Pin 1.0 */
LED_pin = x; /* Write to Pin 1.1 */
}
}
/*-------------------------------------------------------------*-
---- END OF FILE ---------------------------------------
-*-------------------------------------------------------------*/