ahmedragia21
Member
Hi, im using atmel 89C52 and Keil C , and i want to check an input from a sensor , i've been told that i should write 1 to the pin where im gonna read from , i wrote that but it doesnt work , i wanna check for a high from the sensor and check a low from the sensor too .
pseudo code
void main ()
{
P1_3=1;
while (1)
{
if (P1_3==1) // if we got 1 from the sensor
{
// Do Something
}
if (P1_3==0) // if we got 0 from the sensor
{
// Do Something
}
}
}
that expression P1_3==1 is itself true , cuz it's been intialiazed as 1 before ... dont know what to do
Thanks
pseudo code
void main ()
{
P1_3=1;
while (1)
{
if (P1_3==1) // if we got 1 from the sensor
{
// Do Something
}
if (P1_3==0) // if we got 0 from the sensor
{
// Do Something
}
}
}
that expression P1_3==1 is itself true , cuz it's been intialiazed as 1 before ... dont know what to do
Thanks