How do i set the LPC_IOCON register on a LPC1114?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do i set the LPC_IOCON register on a LPC1114?

1,590 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ledi007 on Thu Jan 28 06:30:47 MST 2016
Hi!

i am a newbie to programm an arm-controller like the LPC1114.

Now, i am struggling to deal with the LPC_IOCON register!

I use LPCXpresso in the newest version with LPCXpresso board LPC1114. What i want to do is to set the portpin 1_8 high and low in the while loop.
But unfortunally it doesn´t work.

How must i set the LPC_IOCON register :quest:
I dont understand how it works and how i have to set the bits in the register to set the GPIO1_8 to an digital output :quest:

Underneath is my code i am using right now.
Please can somebody explain me the functionality of the LPC_IOCON register?


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

#include <cr_section_macros.h>

int main(void)
{
SysTick_Config(SystemCoreClock / 1000);

LPC_SYSCON->SYSAHBCLKCTRL |= (1<<6);  //Enables clock for GPIO.

LPC_IOCON->PIO1_8 = (1 | (1<<7));// ??? 

LPC_GPIO1->DIR |= (1<<8);// Set Pin 8 on PORT 1 to output

    while(1)
    {
    LPC_GPIO1->DATA |= (1<<8);// set GPIO DATA Register (Pin 8) to HIGH
    LPC_GPIO1->DATA &= ~(1<<8);// set GPIO DATA Register (Pin 8) to LOW
    }
    return 0 ;
}
Labels (1)
0 Kudos
4 Replies

1,067 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ledi007 on Thu Jan 28 10:15:15 MST 2016
ledi007 wrote:

i had done this already! But i don´t understand all things.

Then start with things you understand...
[color=#f00]
that´s not possible ;-) Did you understand all things as you start with programming?[/color]

ledi007 wrote:

    For example the bits 2:0
    The reset value is 000. ..... OK!

    0x0 Selects function PIO1_8. ..... If i set 0b000 i select the PIO1_8 ?

    0x1 Selects function CT16B1_CAP0. ..... what is CT16B1_CAP0 ?

    So i understand it right, i have to set this register to 0011 0 00 000?

Default setup is PIO1_8, so normally you don't need to change this IOCON register Shock

Use the debugger to check this register...

ledi007 wrote:

    0x1 Selects function CT16B1_CAP0. ..... what is CT16B1_CAP0 ?

That's described in the User manual....

[color=#f00]I know, that all is describt in the user manual. So i think that is the advantage of a forum that user with experience can help other people.[/color]

BTW: You are toggling that PIN without delay, so don't use a LED (or don't expect to see something blinking)...

[color=#f00]I know! In this case i step vorward with the debugger...[/color]
0 Kudos

1,067 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Thu Jan 28 07:13:41 MST 2016

Quote: ledi007
i had done this already! But i don´t understand all things.



Then start with things you understand...


Quote: ledi007
For example the bits 2:0
The reset value is 000.    .....    OK!

0x0 Selects function PIO1_8.  .....    If i set 0b000 i select the PIO1_8 ?

0x1 Selects function CT16B1_CAP0.   .....  what is CT16B1_CAP0 ?

So i understand it right, i have to set this register to  0011 0 00 000?



Default setup is PIO1_8, so normally you don't need to change this IOCON register  :O

Use the debugger to check this register...


Quote: ledi007
0x1 Selects function CT16B1_CAP0.   .....  what is CT16B1_CAP0 ?



That's described in the User manual....

BTW: You are toggling that PIN without delay, so don't use a LED (or don't expect to see something blinking)...
0 Kudos

1,067 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ledi007 on Thu Jan 28 07:02:01 MST 2016
Hi,

i had done this already! But i don´t understand all things.

For example the bits 2:0
The reset value is 000.    .....    OK!

0x0 Selects function PIO1_8.  .....    If i set 0b000 i select the PIO1_8 ?

0x1 Selects function CT16B1_CAP0.   .....  what is CT16B1_CAP0 ?


So i understand it right, i have to set this register to  0011 0 00 000?
0 Kudos

1,067 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Thu Jan 28 06:40:22 MST 2016

Quote: ledi007
i am a newbie to programm an arm-controller like the LPC1114.

Now, i am struggling to deal with the LPC_IOCON register!



Then start to read the User Manual, in your case: Chapter 7  :)

http://www.nxp.com/documents/user_manual/UM10398.pdf
0 Kudos