Searching \ for '[PIC] RC oscillator calculation' in subject line. ()
Help us get a faster server
FAQ page: massmind.org/techref/microchip/time.htm?key=oscillator
Search entire site for: 'RC oscillator calculation'.

Exact match. Not showing close matches.
'[PIC] RC oscillator calculation'
2012\06\13@064346 by

Hi all,

I've got a PIC project with a speed control that is a pot as the
R in RC mode

One option I would like is to be able to set a mid-point frequency
such that moving the pot fully counter-clockwise will be the same
ratio as slow as fully clockwise is as fast

The equation would be x * (1/y) < x > x * y

For example, in the range 2 to 32, 8 (=x) is the 'midpoint' and y = 4

2 is 8 * 1/4 and 32 is 8 * 4

How would I (can I) resolve the equation to find 'x', the midpoint,
if I have just the range, which in this case is 500kHz to 4100kHz ?

I can guess at say 1400kHz. 1400/500 = 2.8. 2.8 * 1400 = 3920,
which is close but there must be a better way

TI

{Quote hidden}

SQRT(500kHz * 4100kHz) = 1431.78kHz

Cheers

Mike

=======================================================================
This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
services.
=======================================================================
> The equation would be x * (1/y) < x > x * y

This doesn't look like an equation to me, but I think I get what you want. You are looking for a geometric progression with a known value at each end of the scale and the geometric mean in the center.

> How would I (can I) resolve the equation to find 'x', the midpoint,
> if I have just the range, which in this case is 500kHz to 4100kHz ?

> I can guess at say 1400kHz. 1400/500 = 2.8. 2.8 * 1400 = 3920,
> which is close but there must be a better way

There sure is. Look at the following to compute the middle value:

SQRT(500*4100) = 1431.8

Now lets check that:

1431.8 / 500 = 2.8636

4100 / 1431.8 = 2.8636

So, we have found the correct 'middle' value.

Assume that the value we read from the pot (lets call it X) ranges from 0 to 1, then we want:
0 to map to 500,
0.5 to map to 1431.8, and
1 to map to 4100

The ugly function:

500 * 2.8636^(X*2)

gives you what you want. Lets check it:

500 * 2.8636^0 = 500 * 1 = 500
500 * 2.8636^(0.5*2) = 500 * 2.8636 = 1431.8
500 * 2.8636^(1*2) = 500 * 8.2000 = 4100.1

So, aside from a little rounding error we get the right answer.

-- Bob Ammerman
RAm  Systems
> SQRT(500kHz * 4100kHz) = 1431.78kHz

Thank

Thanks

> -- Bob Ammerman
> RAm  System

More... (looser matching)
- Last day of these posts
- In 2012 , 2013 only
- Today
- New search...