AnsweredAssumed Answered

Not able to read the pin status in LPC 1114/302

Question asked by Monarch BAXI on Apr 13, 2017
Latest reply on Apr 14, 2017 by Monarch BAXI

Hi i am using LPC 1114/302 but i am not able to read the stauts of the Port Pin(P1_1 and P1_3)


Part of my code is as follows



#define LPC_GPIO                  ((LPC_GPIO_T             *) LPC_GPIO_PORT0_BASE)



typedef struct { /*!< GPIO_PORT Structure */
__IO uint32_t DATA[4096]; /*!< Offset: 0x0000 to 0x3FFC Data address masking register (R/W) */
uint32_t RESERVED1[4096];
__IO uint32_t DIR; /*!< Offset: 0x8000 Data direction register (R/W) */
__IO uint32_t IS; /*!< Offset: 0x8004 Interrupt sense register (R/W) */
__IO uint32_t IBE; /*!< Offset: 0x8008 Interrupt both edges register (R/W) */
__IO uint32_t IEV; /*!< Offset: 0x800C Interrupt event register (R/W) */
__IO uint32_t IE; /*!< Offset: 0x8010 Interrupt mask register (R/W) */
__I uint32_t RIS; /*!< Offset: 0x8014 Raw interrupt status register (R/ ) */
__I uint32_t MIS; /*!< Offset: 0x8018 Masked interrupt status register (R/ ) */
__O uint32_t IC; /*!< Offset: 0x801C Interrupt clear register (W) */
uint32_t RESERVED2[8184]; /* Padding added for aligning contiguous GPIO blocks */



STATIC INLINE bool Chip_GPIO_GetPinState(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin)
return (pGPIO[port].DATA[1 << pin]) != 0;



Chip_GPIO_GetPinState( LPC_GPIO, 1, 3)



this function always returns a zero value irrespective of the pin status

Pl guide