Forums

measuring frequency on lpc2119

Started by faisal_b2o August 27, 2009
Im using a humidity sensor which is connected to the lpc2119.
This sensor is a capacity. In order to mesure this capacity Im using a ne555.
The frequency output depend of 2 resistor and the capacity.

I would like to mesure frequency on a pin of the lpc2119.

I dont know how to

Any help please

An Engineer's Guide to the LPC2100 Series

faisal_b2o wrote:
> I would like to mesure frequency on a pin of the lpc2119.

Not sure I fully understand your problem, but here goes:

Use one of the hardware edge counters in the 2119. Set it to zero and
start it counting. Wait a known amount of time (from a timer interrupt,
scheduler or RTOS), then work out the frequency from the number of
high/low transitions over that time period.

Or use a scope.

Pete
OK thanks thats it
--- In l..., Pete Vidler wrote:
>
> faisal_b2o wrote:
> > I would like to mesure frequency on a pin of the lpc2119.
>
> Not sure I fully understand your problem, but here goes:
>
> Use one of the hardware edge counters in the 2119. Set it to zero and
> start it counting. Wait a known amount of time (from a timer interrupt,
> scheduler or RTOS), then work out the frequency from the number of
> high/low transitions over that time period.
>
> Or use a scope.
>
> Pete
>
> Im using a humidity sensor which is connected to the lpc2119.
> This sensor is a capacity. In order to mesure this capacity Im using a ne555.
> The frequency output depend of 2 resistor and the capacity.
>
> I would like to mesure frequency on a pin of the lpc2119.
>
> I dont know how to

It depends on the frequency. If its slow relative to the
processor timer clocks, then you might be able to use
the capture feature of a counter timer (if this particular
part has that feature).

Look in the user manual and see if the LPC2119 counter/timers
have an I/O pin that can be configured as the capture pin.
The job of the capture pin is to 'capture' the counter count
to a register when the event occurs on the external pin.

The count difference between capture events gives you the
edge-to-edge timing of your external square wave.

I've used that feature on AVRs to measure the period of an
RPM sensor from a fan to measure its rotation.

If the external squarewave is comparable to your processor
timer clock, then use the signal as en external clock.
Then use a software timer to enable the counter and
then read back the counter after some time, eg. every
100ms, or every 500ms.

Before you change the sensor passive components to make
one of these methods easier to implement, you'll first
want to determine how accurate your humidity readings
need to be, and what the variation in capacitance is.
There are likely several methods you can use, without
needing to add the 555 timer. Eg. just measure the
impedance by injecting a sine-wave generated by the
DAC and measuring the response with an ADC. The
'sine correlation' of the output waveform and input
waveform gives you the loss and phase. You can
sweep frequency to get the transfer function of your
network.

I'm not sure if the LPC2119 has these features ... but
really you should determine the design first, and then
select an appropriate micro, not the other way around :)

Cheers,
Dave