[sdiy] Really Low, LFO
Tom Wiltshire
tom at electricdruid.net
Sat Apr 3 12:39:32 CEST 2010
On 3 Apr 2010, at 08:52, Simon Brouwer wrote:
> Tom Wiltshire schreef:
>> My PIC LFO goes down to 0.05Hz (20 seconds) as it stands. If you
>> were to slash a factor of 256 out of the sample rate (to a 76Hz
>> sample rate!), that'd go down to 0.000195Hz, 85 mins a cycle.
> To put this into perspective for Kyle, would this be any more
> complicated than:
>
> 1) adding a variable PRESCALE (line 151)
>
> 2) adding the following 2 lines just before the SelectDDSOrNoise
> label (line 233):
> incfsz PRESCALE, f
> goto InterruptExit
No, it's no more complicated than that.
Adding a 'PRESCALE' variable would be one way, but TIMER2 has a
prescalers in the hardware, so you can just change the initialisation
of TIMER2 to enable it. Unfortunately it only goes to 1:16, so we
have to get rid of another factor of 16 somewhere. (There's a
postscaler too, but the PWM rate isn't affected by it - that'd make
life *too* simple!).
Perhaps we could change the crystal from 20MHz to 1MHz too. That'd
drop the overall frequency range by 320!
movlw b'00000100' ; Enable TMR2 (prescale set to 1:1)
movwf T2CON
becomes
movlw b'00000111' ; Enable TMR2 (prescale set to 1:16)
movwf T2CON
My line numbering doesn't match yours for some reason, but this is
just under the 'Main' label at the start of the main code. About line
500 for me.
In short, there are quite a few ways of achieving this, and none of
them are particularly difficult.
Regards,
Tom
More information about the Synth-diy
mailing list