This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Reading Pins

Dear All,

I've tried to read the pin of Port1 , but i failed .
I should write one to it right ? , how do i read a one again ?
If i tried to write the following code,it works without checking the status of the pin

Port1_3=1;
if(Port1_3==1)
{
// execute code here ..
// code here executes in the simulator //without checking if the pin is //high or not
}
thanks in advance

Parents
  • Thanks Andy ,
    If the externally-applied signal is 1, you read 1

    yea ,that's what i need , but when writting if ( test pin ==1) in Keil C51 the next expression is executed whatever happens .. there's no checking occurs
    e.g
    if ( P1^3==1)
    {
    P2=0x00; // P2 will be zeros in
    //the simulator , cuz P1^3 is initially
    //set to 1 , so how do i check then for
    // a 1 again ??
    }

Reply
  • Thanks Andy ,
    If the externally-applied signal is 1, you read 1

    yea ,that's what i need , but when writting if ( test pin ==1) in Keil C51 the next expression is executed whatever happens .. there's no checking occurs
    e.g
    if ( P1^3==1)
    {
    P2=0x00; // P2 will be zeros in
    //the simulator , cuz P1^3 is initially
    //set to 1 , so how do i check then for
    // a 1 again ??
    }

Children