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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

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

974 次查看
srnfrn
Contributor I

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 ;

标签 (1)
0 项奖励
回复
1 回复

904 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi Sarin cr,

Thank you for your interest in NXP Semiconductor products and
for the opportunity to serve you.
To provide the fastest possible support, I'd hihgly recommend you to refer to the LPCOpen library of LPC11xx series.

https://www.nxp.com/support/developer-resources/microcontrollers-developer-resources/lpcopen-librari...

Have a great day,
TIC

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复