This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

polling in LPC2378

Hi!! I am a newbie to ARM7 microcontrollers, and i am going to work on the LPC2378. I have read a little bit on programming th microcontroller, and i can now comfortably flash LEDs. But, now i want to write a program that uses polling in LPC2378, such that when a particular input pin goes high, some function should be executed. Can anyone please help me out, coz i dont know how to read inputs in LPC2378(i know this is pretty dumb...but i am a total novice).
Please let me know how one can read inputs from port pins ,using polling method, assuming my input device is a push button, and how can i possibly simulate this on Keil uVision3.

Parents
  • Just a quick question: Have you downloaded the user manual for the processor? Have you looked at it? If you haven't, then I recommend that you spend a couple of hours with this document before we continue with this thread.

    The manual is huge and may seem scary, but it is in free-standing chapters so you don't have to read everything.

    But there are three important chapters in it:
    - Pin Configuration
    - Pin connect block
    - General Purpose Input/Output ports (GPIO)

    Since you already know how to flash a LED, you already know how to set a GPIO signal as input or output. And you know how to write to the port.

    By reading the third of my suggested chapters, it should quickly follow how to read from a GPIO pin.

    Polling is nothing fancier than to read from a pin, make a dceision. Do something. Then repeat the loop again.

Reply
  • Just a quick question: Have you downloaded the user manual for the processor? Have you looked at it? If you haven't, then I recommend that you spend a couple of hours with this document before we continue with this thread.

    The manual is huge and may seem scary, but it is in free-standing chapters so you don't have to read everything.

    But there are three important chapters in it:
    - Pin Configuration
    - Pin connect block
    - General Purpose Input/Output ports (GPIO)

    Since you already know how to flash a LED, you already know how to set a GPIO signal as input or output. And you know how to write to the port.

    By reading the third of my suggested chapters, it should quickly follow how to read from a GPIO pin.

    Polling is nothing fancier than to read from a pin, make a dceision. Do something. Then repeat the loop again.

Children
  • Thanks a lot for your help. I have read these chapters already and they say that the IOPIN register can be used to read the status of the port pins...i used the IOPIN register and set up the loop for polling, but when i simulate the program using keil debugger, the value of IOPIN does not change even though i write any value to it(i want to first make IOPIN 0x00000000 (say), so that when lets say any pin on a port goes high i can read it) in the debugger. Again when i set a pin high in the debugger the value of IOPIN does not change, so the whole point of using IOPIN to read inputs is pointless...thats why i cant get how to read inputs on LPC2378. Please help me out...
    Thanks a lot for your help in advance.