pls help...
i'm working on LPC1114-FBD/301 series
On my board 4 LED's are connected to P0_8, P0_9, P0_10, P0_11.
I'v written a sample code toggle them. Only on 8 and 9 port pin LED's are blinking but on 10 and 11 there state is always on. here is the sample code
/* by default P0_8 and P0_9 pins are GPIO's */ LED_DIR |= BIT(8); LED_DIR |= BIT(9);
/* 9th and 10th pins are not GPIO's on reset */ // i think here some changes required to make them as GPIO's IOCON_SWCLK_PIO0_10 |= 0x1; IOCON_R_PIO0_11 |= 0x1;
LED_DIR |= BIT(10); LED_DIR |= BIT(11);
not able --- to give a descriptive title not able --- to specify the toolset not able --- to post as stated above the message entry box
Erik
Hi the problem is i'm not able to configure P0_10 and P0_11 on LPC1114 as GPIO pins. pls help me to configure them as GPIO's. Using IAR i'v compiled the code.
Normally, GPIO is the default role for most pins of LPC chips. All you need to do is set the direction, find out if there are any compatibility/legacy issues (see SCS register of LPC24xx processors applying to GPIO port 0) and figure out how to clear and set the pins (again, referring to the legacy issue). The user manual will tell you all you need to know, as well as example programs available in your tool-chain folder.
I too thought the same.. but those to pins P0_10 and P0_11 on LPC1114 are not GPIO's on reset. using the following code i configured them as GPIO's.. but still it's not working..
/* last 3 bits of the following registers are used to select the function So i'v set it to 1 here. */
IOCON_SWCLK_PIO0_10 |= 0x1; IOCON_R_PIO0_11 |= 0x1;
What does your LED_DIR macro do? What does your BIT macro do?
they are jus macros...
this is how they are defined
LED_DIR GPIO0DIR /* PORT0 direction control register */ BIT(n) (1<<n)
where is your code?
9th and 10th pins of PORT0 on LPC1114 are not GPIO's On reset. I used the following code to set them set them as GPIO's. But still its not working.
#define LED_DIR GPIO0DIR #define BIT(n) (1<<n)
IOCON_SWCLK_PIO0_10 |= 0x01;
IOCON_R_PIO0_11 |= 0x01;
delay( );
You write about 9th and 10th pin.
But: bit 0 is 1st pin. bit 1 is 2nd. ... bit 8 is 9th bit 9 is 10th bit 10 is 11th.
How is this 9th and 10th pin? BIT(10) controls the 11th (not 9th) pin for the port. BIT(11) controls the 12th (not 11th) pin for the port.
But we assume that you do mean PIO0_10 and PIO0_11.
You are setting the least significant bit, without thinking about previous content. Should be ok since the reset value is 0 (unless there is another assign somewhere).
Mode 2 (pull-up enabled) should be ok.
Assign should be ok since reset value is zero (unless you have another assign somewhere). Mode 2 should also be ok.
Without having worked with your specific chip, it looks like PIO0_10 and PIO0_11 are set as GPIO output.
Maybe IOCON_SCK_LOC is involved, but to me it looks like this register is only relevant when having selected the SWCLK option.
What debugging have you done?
I'm using flash magic to burn the code.. i don't have any debugging options... Please guide me to configure P0_10 and P0_11 pins as GPIO's.
Thanks in advance Sanjeev
They all want "guidance". Go get yourself a guru for god's sake! Per gave you the answer. Did you even read it?!
View all questions in Keil forum