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

LPC2294 How to program a counter

Hello everybody,

I have a Philips LPC2294/01 MC.

I would like to count the rise or falling edge from an external signal.

I have 2 questions and need your help!

1. Do my MC already have an external counter? I think so but I donÂ't reallyfound somethink about that.
2. And if not? How can I count an rise or falling edge with the internal timer/counter?

I hope somebody can help me? Maybe with some code to?

Thx!!!

Parents
  • To my knowledge, your processor has timers but not counters and it do not allow the timers to count external events.

    The capture pins can be used to react to rising and falling signals - but they will not step up any counter. Instead, they will latch the current counter value, to allow you to measure the time since the previously captured event or since you manually resetted the timer.

    Is the signal you need to count of high frequency? Is the events of random duration so two events may sometimes be very closely together?

    I think you will have to use a normal interrupt input (EINT0 .. EINT3). They can be set to generate interrupts on raising or falling edge. But the events can't arrive faster than your interrupt routine has time to trig, count and return.

    For very slow events, it will be possible to just poll a processor pin to detect any changes.

Reply
  • To my knowledge, your processor has timers but not counters and it do not allow the timers to count external events.

    The capture pins can be used to react to rising and falling signals - but they will not step up any counter. Instead, they will latch the current counter value, to allow you to measure the time since the previously captured event or since you manually resetted the timer.

    Is the signal you need to count of high frequency? Is the events of random duration so two events may sometimes be very closely together?

    I think you will have to use a normal interrupt input (EINT0 .. EINT3). They can be set to generate interrupts on raising or falling edge. But the events can't arrive faster than your interrupt routine has time to trig, count and return.

    For very slow events, it will be possible to just poll a processor pin to detect any changes.

Children