lpcware

How do i set the LPC_IOCON register on a LPC1114?

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
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 ;
}

Outcomes