Can anyone tell me how i use adc pins as GPIO in lpc2124
Thanks in advance.
That would be in the Manufacturer's Documentation for the particular chip in question.
www.nxp.com/.../lpc2100-200-300-400:MC_71580
https://www.lpcware.com/
I am using PINSEL1 = (1<<22)|(1<<23); to make these pin GPIO ,pin 28 29 30 working properly but pin 27 is not working ...any suggestions Thank you
"I am using PINSEL1 = (1<<22)|(1<<23); to make these pin GPIO ,pin 28 29 30 working properly but pin 27 is not working ...any suggestions?"
Yes - read the user manual for the chip.
1) PINSEL1 bit 22 and 23 will _only_ affect P0.27. Not P0.28, P0.29 or P0.30.
2) You are setting the two bits. That most definitely doesn't change the pin to GPIO. The user manual (which you have read?) concludes that when you set these two bits, you make P0.27 into a match pin for for timer 0.
So - you need to clear the bits to get GPIO functionality. And there are two bits to clear for each of the four pins you want to make into GPIO. But I guess you know that since you quickly figured out that the processor user manual would hold the answers to your questions of how to configure the processor...
By the way - NXP tends to have really great user manuals for their processors.
Just an addentum:
PINSEL1 = (1<<22)|(1<<23);
This isn't a good way to update the PINSELx registers. Note that you are setting two bits for P0.27. But since you perform a 32-bit assign, you are also affecting the 15 other pins configured by this register. It's much better to be explicit and modify the register by setting the bits you need set and clearing the bits you need cleared - while leaving all the other bits untouched.
If you do a 32-bit assign like you do, then you need to read through the documentation for each and every of the 32 bits just to make sure you don't get a side effect you don't want. And you then need to add some note in the source code making readers of the code know that you really have verified each and every bit. And to let the reader know the full outcome you expected from the assign so they can double-check.
Thankyou so much sir given me your precious time
If I use IODIR0 = 0xF0000000; without using PINSEL1 then direction of these pins are not set can you tell me how i use these four pins 27 28 29 30 as GPio Thankyou
Why do you so seriously dislike looking at the user manual of the processor?
The documentation clearly indicates that the PINSEL1 register have the bit values set to 10 for P0.27, P0.28, P0.29 and P0.30.
And it also very clearly indicates that you need the bit values 00 to get the individual pins to work as GPIO.
Haven't you spent time looking at page 110 and 111 of this document? www.keil.com/.../user_manual_lpc2114_2124_2212_2214.pdf
The information in the manual very clearly indicate that your initial assign of PINSEL1 can not work. And it also very clearly indicate that your program can not work if you completely ignore PINSEL1.
You really can't get your program to work by ignoring the following information:
The direction control bit in the IO0DIR register is effective only when the GPIO function is selected for a pin. For other functions direction is controlled automatically.
As already explained in my first post, your P0.27 doesn't work because you haven't correctly configured the relevant bits in PINSEL1. And the manual does show the reset values for this register in the last column of the table.
So in short: No manual reading means no progress. Ignore the processor documentation and you will continue to be stuck.
Thankyou sir... Yes these pins working now I'm ignore pinsel register so I faced this problem but now these pins are work in correct way .
You are correct sir I am not read manual properly, so I am stuck at that point
Thank you ...