use the ADC pins as GPIO pins

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

use the ADC pins as GPIO pins

621 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ianLWD on Wed Apr 22 01:33:01 MST 2015
Hello all,

I need your help.
I've been trying to use the ADC pins of the OM13012 demo board (LPC11C24) as IO pins.
I tried to use these pins like other GPIOss but they dont work the same.
I'm trying to make a 6 digits 14 segments display using multiplexing.
still, I need more pins for other purposes for my project.

I also use the onboard can transceiver.

On this forum I found this :
http://www.lpcware.com/content/forum/gpio-port-difference


I used the following code in main(void):

LPC_SYSCON->SYSAHBCLKCTRL |= (1<<16);  //set IOCON clock
LPC_IOCON->R_PIO1_1 |= 0x01; //set pin function to 1 = GPIO
GPIOSetDir(1, 1, 1);//set GPIO out

I have include "LPC11xx.h" to my project.

I get the errors:
       'LPC_IOCON_T' has no member named 'R_PIO1_1'
       'LPC_SYSCON' undeclared (first use in this function)


can anyone tell me what I am doing wrong?

kind regards,
ianLWD


Labels (1)
0 Kudos
7 Replies

543 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ianLWD on Wed Apr 22 04:21:01 MST 2015
It works!

the AD0 pin (PIO0_11) was allready on this list, that one worked like the other GPIO pins.
I copied that line 3 times en changed the PIO0_11 to the other AD pins(PIO1_0, PIO1_1 and PIO1_2).

Now they are working like a GPIO.

Thanks R2D2, for your help.
say hi to C-3PO for me  ;-)
0 Kudos

543 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed Apr 22 04:12:43 MST 2015

Quote: ianLWD
I use LPCOpen.



LPCOpen is setting up pins in board_sysinit.c:

STATIC const PINMUX_GRP_T pinmuxing[] = {
...
};



Change or add your pin setup there 
0 Kudos

543 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ianLWD on Wed Apr 22 03:46:45 MST 2015
I use LPCOpen.
0 Kudos

543 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed Apr 22 03:10:15 MST 2015

Quote: ianLWD
I'm using the LPC11xx.h file,
this includes:
typedef struct
{
....
__IO uint32_t SYSAHBCLKCTRL;          /*!< Offset: 0x080 System AHB clock control (R/W) */
....

} LPC_SYSCON_TypeDef;


also
typedef struct
{
...
__IO uint32_t R_PIO1_1;               /*!< Offset: 0x07C I/O configuration for pin TDO/PIO1_1/AD2/CT32B1_MAT0 (R/W) */
...
} LPC_IOCON_TypeDef;




:D

That's just the TypeDef, where's the LPC_SYSCON  :O

Which library are you using ? LPCOpen? CMSIS?
0 Kudos

543 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed Apr 22 03:10:13 MST 2015

Quote: ianLWD
I'm using the LPC11xx.h file,
this includes:
typedef struct
{
....
__IO uint32_t SYSAHBCLKCTRL;          /*!< Offset: 0x080 System AHB clock control (R/W) */
....

} LPC_SYSCON_TypeDef;


also
typedef struct
{
...
__IO uint32_t R_PIO1_1;               /*!< Offset: 0x07C I/O configuration for pin TDO/PIO1_1/AD2/CT32B1_MAT0 (R/W) */
...
} LPC_IOCON_TypeDef;




:D

That's just the TypeDef, where's the LPC_SYSCON  :O

Which library are you using ? LPCOpen? CMSIS?
0 Kudos

543 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ianLWD on Wed Apr 22 02:56:41 MST 2015
Hi R2D2
thanks for your reply.

I'm using the LPC11xx.h file,
this includes:
typedef struct
{
....
__IO uint32_t SYSAHBCLKCTRL;          /*!< Offset: 0x080 System AHB clock control (R/W) */
....

} LPC_SYSCON_TypeDef;


also
typedef struct
{
...
__IO uint32_t R_PIO1_1;               /*!< Offset: 0x07C I/O configuration for pin TDO/PIO1_1/AD2/CT32B1_MAT0 (R/W) */
...
} LPC_IOCON_TypeDef;


0 Kudos

543 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed Apr 22 02:06:56 MST 2015

Quote: ianLWD

I get the errors:
       'LPC_IOCON_T' has no member named 'R_PIO1_1'
       'LPC_SYSCON' undeclared (first use in this function)


can anyone tell me what I am doing wrong?



You are using a library with other register names  :((

LPC_SYSCON is perhaps LPC_SYSCTL...



0 Kudos