piclist 2000\06\06\094036a >
Thread: Frequency Scaling - remapping
www.piclist.com/techref/microchip/devices.htm?key=pic
picon face BY : Peter Betts email (remove spam text)



Hello,

I'm Pete and I'm a recent convert to the PIC chip.

I am trying to build a project at home which measures the frequency of a
digital signal, modifies the frequency value and uses this to generate a new
frequency output.

e.g.  1kHz in gets scaled by 2/3 say and frequency output is 666.66Hz

Firstly I wanted to just get the reading of the frequency working (exact
frequency is not important just the relative scaling)
So I set up a timer at a rate of approx 3.9ms which I used to call an
interrupt routine. The interrupt routine then tested/checked the input
signal level (hi or lo) and then incremented a counter. This gave me a
resolution from 1Hz to 256Hz using a 5MHz XTAL. (Just using a single 8 bit
counter)

The counter was used to count the time between successive high pulses (this
was to ensure if I had an input which was not a 50:50 duty cycle I could
still scale it and generate a 50:50 duty cycle output.) The counter value/2
was the hi or lo period respectively.

First: Does anybody have a better way of measuring the period of an
incomming signal in order to generate a scaled frequency output.

Second: My output signal seems to gitter quite a bit and I don't know why.

Third: (and finally) I ideally want to remap the input so I guess I could
use a 256 element look up table and for every frequency input value I can
look up a new output value so I can have my own user defined mapping. Good
or bad?

I have a basic system working but it doesn't look at all elegant so I would
appreciate new ideas.

Thanks

Pete

<FFD4860870E0D2119F8C0008C7894980023D39CE@caeis01nok>

See also: www.piclist.com/techref/microchip/devices.htm?key=pic
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Frequency Scaling - remapping

month overview.

new search...