Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ARM LPC2000 GPIO problem

Status
Not open for further replies.

Tamasco

Full Member level 3
Joined
Jun 27, 2006
Messages
155
Helped
10
Reputation
20
Reaction score
6
Trophy points
1,298
Activity points
2,083
I have a problem reading input pins on the LPC2138.
I used the following assignment in the Keil uVision3 and got the following
error:
CODE
unsigned int Key_0=IOPIN1& 0x00080000 ; // Read input pin P1.24

ERROR
error: KeyPad.c(36): error: #28: expression must have a constant value.

What could be the problem?
 

Hello,

It is possible that you are trying to Do a C++ thing in C. You should do it the C way:
CODE
unsigned int Key_0;
int Key_0=IOPIN1& 0x00080000 ; // Read input pin P1.24

You cant arbitrary load defined vars in C.
Best of Luck!!
 

    Tamasco

    Points: 2
    Helpful Answer Positive Rating
Hi

Use long insted of unsigned int, IOPIN is 32bit wide register

All the best

Bobi
 

    Tamasco

    Points: 2
    Helpful Answer Positive Rating
@ boseji and bobcat1

thanks bros. I'll do that and give u the feedback.
 

hi
u might not need long as uv3 allocates 32 bit for a int,if ur using arm mode.
Shakeel
 

    Tamasco

    Points: 2
    Helpful Answer Positive Rating
Thank you all for your input. I think the problem is not a simple one. I tried all the above suggestions but I still can't figure out why the error keeps on showing.
I guess there must be a special way to read an input and store the value.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top