AnsweredAssumed Answered

Description     Resource     Path     Location     Type 'LPC_GPIO0' was not declared in this scope     LPC11x_Base.cpp     /LPC11x_Base/src     line 11     C/C++ Problem

Question asked by Sarin cr on Jul 26, 2019
Latest reply on Jul 28, 2019 by jeremyzhou

I was trying to execute but getting error as Description    Resource    Path    Location    Type
'LPC_GPIO0' was not declared in this scope    LPC11x_Base.cpp    /LPC11x_Base/src    line 14    C/C++ Problem

 

 

 

#ifdef __USE_CMSIS
#include "LPC11xx.h"
#endif

 

#include <cr_section_macros.h>

 

int main(void) {

 

    //Toggle PIO0_7 in response to the state of PIO3_5
    LPC_SYSCON->SYSAHBCLKCTRL     |= (1<<6);    //enable clock GPIO (sec 3.5.14)
    LPC_IOCON->PIO0_7             &= ~(0x10);   //NOT NECESSARY, turn off pull up (sec 7.4.19)
    LPC_GPIO0->DIR                |= (1<<7);    //set pin direction to output (sec 12.3.2)
    LPC_GPIO3->DIR              &= ~(1<<5);   //set pin 3_5 (pin 21 of QFP) to input

 

    //unsigned int i = 0;

 

    while(1){        //infinite loop
        if(LPC_GPIO3->DATA & (1<<5))                  //check state of PIO3_5 (sec 12.3.1)
            LPC_GPIO0->DATA           |= (1<<7);  //set pin high (sec 12.3.1)
        else
            LPC_GPIO0->DATA           &= ~(1<<7); //set pin low (sec 12.3.1)
        }
    return 0 ;

Outcomes