Chris Kelly
Well-known member
Hi guys
Hope all is well, and glad to see Hippy back again these days!
I'm using 5No 08M2's to generate sine waves in a harmonic series. E.g/
Pic 1 - f0 = 100Hz
Pic 2 - f1 = 200Hz
Pic 3 - f3 = 300Hz
Pic 4 - f4 = 400Hz
Pic 5 - f5 = 500Hz
Have tried this in a 'do' loop:
This works and gives a sine wave after filtering, and is therefore the fastest. Slower frequencies can be achieved with more PWMout commands and therefore more pauses. (E.g/ 0% duty, 50% duty, 100% duty, 50% duty gives the same result but at half the sine frequency)
And word w1 allows me to tune the speed coarsely.
I've scrabbled together a half decent series, but what I actually need is a SHIFTED series.
So each frequency is shifted by the same amount and not scaled. E.g 120hz, 220hz, 320hz, 420hz, 520hz is the original series shifted by 20hz.
This is totally beyond me . I'd hoped to just code in a different scaling factor for each, such as
But with varying factors for each pic. But am at a loss as to how use decimals.
Ideally I would control all 5 pics with 1 buffered voltage, so that once the shifted series is set, I could globally scale all 5 pics together and keep them tuned.
Any ideas would be appreciated!!
Cheers
Chris
Hope all is well, and glad to see Hippy back again these days!
I'm using 5No 08M2's to generate sine waves in a harmonic series. E.g/
Pic 1 - f0 = 100Hz
Pic 2 - f1 = 200Hz
Pic 3 - f3 = 300Hz
Pic 4 - f4 = 400Hz
Pic 5 - f5 = 500Hz
Have tried this in a 'do' loop:
Code:
Do
Readadc C.4, w1
PWMout C.2, 49, 0(0% duty)
Pauseus w1
PWMout C.2 49, 399(100% duty)
Pauseus w1
Loop
And word w1 allows me to tune the speed coarsely.
I've scrabbled together a half decent series, but what I actually need is a SHIFTED series.
So each frequency is shifted by the same amount and not scaled. E.g 120hz, 220hz, 320hz, 420hz, 520hz is the original series shifted by 20hz.
This is totally beyond me . I'd hoped to just code in a different scaling factor for each, such as
Code:
w1 = 1.25 w1
Ideally I would control all 5 pics with 1 buffered voltage, so that once the shifted series is set, I could globally scale all 5 pics together and keep them tuned.
Any ideas would be appreciated!!
Cheers
Chris
Last edited: