Write in a register

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

Write in a register

1,106 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Thom314 on Thu Aug 02 05:54:23 MST 2012
Hello,

I begin with LPCXpresso, and I don't know how to write in a register of a LPC11U14.
Here is my source code (power on a LED) and compilation errors :

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

#include <cr_section_macros.h>
#include <NXP/crp.h>

// Variable to store CRP value in. Will be placed automatically
// by the linker when "Enable Code Read Protect" selected.
// See crp.h header for more information
__CRP const unsigned int CRP_WORD = CRP_NO_CRP ;

// TODO: insert other include files here

// TODO: insert other definitions and declarations here

int main(void)
{
    GPIO0_IODIR |= (1 << 7);
    
    while(1)
    {
        GPIO0_IOSET |= (1 << 7)
    }
    return 0 ;
}


../src/main.c:30:2: error: 'GPIO0_IODIR' undeclared (first use in this function)
../src/main.c:30:2: note: each undeclared identifier is reported only once for each function it appears in
make: *** [src/main.o] Error 1


Is there any reference manual to learn the syntax ?

Thank you for your help !

Thomas
0 项奖励
回复
6 回复数

1,090 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Thom314 on Tue Aug 07 00:37:18 MST 2012
Ok thanks, it works now (I have created a new workspace and start a new project like on the video) !
0 项奖励
回复

1,090 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Aug 03 00:35:27 MST 2012
Try: http://www.youtube.com/watch?v=E6vSPloei-0
0 项奖励
回复

1,090 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Thom314 on Fri Aug 03 00:03:51 MST 2012
Yes, I had a look at exemples before ask the question.
For exemple, in blinky project, I think they used CMSIS functions, like GPIOSetDir(0, 7, 1). I tried to use it, but it don't works too.

I think I have a problem with include files, but in exemple code there is no more include files than in mine.

The thing I don't understand in LPCXpresso is where is the link between register (memory) and keywords (like GPIO0_IODIR) ?

I have good programming experience with PIC MCU, I begin with Cortex M0, I spent hours looking how to turn on this LED...

Is there someone who could explain me step by step how to turn on this LED, starting from a new project ?

Thank you very much !
0 项奖励
回复

1,090 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Thu Aug 02 06:49:53 MST 2012
Why not take one of the working examples and see what is different between your project and theirs?
0 项奖励
回复

1,090 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Thom314 on Thu Aug 02 06:12:40 MST 2012
Ok thanks TheFallGuy, but this has not solved the problem :(
0 项奖励
回复

1,090 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Thu Aug 02 06:03:03 MST 2012
If you haven't got __USE_CMSIS defined, then it won't be including the LPC11Uxx.h header file, and so you won't have any definitions for GPIO (or anything else!)
0 项奖励
回复