Configuring Register as Analog Input on LPC4088

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Configuring Register as Analog Input on LPC4088

637 次查看
diamond
Contributor I

I am using the LPC4088 development board and my primary goal is to configure a certain GPIO pin as an analog input. In theory, I understand what bits need to be changed in order to achieve this, but I am finding it difficult to actually program this in the LPCXpresso environment.

Specifically I want to configure  IOCON_P0_24 (0x4002 C060) to act as an analog input. My plan to do this was to define the register and then use the |= operator to change the value, for example:

...

 #define IOCON_P0_24 0x4002C060

...

IOCON_P0_24  |=  (0x1 << 0);

...

I am getting an error that is saying "lvalue required as left operant of assignment". This leads me to believe that I need to define IOCON_P0_24 differently or include it from somewhere else.

Could anyone suggest what the best way to adjust the register value? Any help is very much appreciated!

标签 (1)
标记 (2)
0 项奖励
回复
1 回复

570 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Blake,

Pls try to cahge the code as:

 #define IOCON_P0_24 0x4002C060

...

*(unsigned int *)IOCON_P0_24  |=  (0x1 << 0);

or

*(uint32_t *)IOCON_P0_24  |=  (0x1 << 0);

Pls have a try

BR

XiangJun Rong

0 项奖励
回复