I've been learning to program LPC2148(ARM7) microcontroller, and today I got hold of an LPC1768(Cortex M3) board. By referring it's manual, I tried to make a LED blink program and did it as follows, following the same methods as LPC2148(configuring pin connection block and GPIO registers)
#include <LPC17xx.H>
int main()
{
int i;
PINSEL0 = 0;
FIO0DIR = 0XFFFFFFFF;
while(1)
{
FIO0SET = 0XFFFFFFFF;
for(i=0; i<100000; i++);
FIO0CLR = 0XFFFFFFFF;
for(i=0; i<100000; i++);
}
}
But got error as PINSEL, FI0SET ... as undefined.
after referring some example codes, I have to use
LPC_PINCON->PINSEL0 = 0X00000000;
LPC_GPIO0->FIODIR
Where does this LPC_GPIO & LPC_PINCON come from? As per one online tutorial
As per the CMSIS convention, the registers that we saw are grouped into structures. LPC_GPIOx is defined as a pointer to this structure in LPC17xx.h header. These registers are defined as members of this structure. Hence to use any register, for e.g. FIODIR, we must use the arrow “->” operator to de-reference members of structure (since the structure itself is a pointer) to access the register as follows : LPC_GPIO0->FIODIR = some value.
I couldn't find any reference to this in manual.
Is there any documentation available?
LPC17xx.h
library. Please tell me if this is the correct author of the library. \$\endgroup\$