AnsweredAssumed Answered

KEA128 BIT access

Question asked by Robin S on Apr 1, 2015
Latest reply on Apr 3, 2015 by Robin S

Hi All,

 

 

I am using TRK- KEA128 Board and having following question regarding how to access individual bit of PORT.

 

Actually i am trying to read PORTA0 and PORTB3 here :in the following code  if Statement  work as expected (for checking logic High bit at PTA0 & PTB3) but as soon as i check the same code for logic low state (this is what i am doing in if statement  :   if  ((GPIOA_PDIR & GPIO_PDIR_PDI(0x0000)) >> 0 && (GPIOA_PDIR & GPIO_PDIR_PDI(0x0000)) >> 11) ) and the code always going in else statement , it doesn't matter PTA0 and PTB3 high or low.

 

 

for(;;) {    

        

 

        if  ((GPIOA_PDIR & GPIO_PDIR_PDI(0x0001)) >> 0 && (GPIOA_PDIR & GPIO_PDIR_PDI(0x0800)) >> 11)

     

        {

        GPIOA_PDOR =  0x30000;                                                                     // Initialise the PORTA, PORTB  LED PTC0 & PTC1

        delay(65535);

     

        }

     

        else

        {

        GPIOA_PDOR =  0xC0000;                                                                    // LED PTC3 & PTC4

        delay(65535);

     

        }

    }

 

    return 0;

}

 

 

Thanks and Kind Regards,

Robin

Outcomes