[sdiy] DsPIC timer issue when used as DCO!
Tom Wiltshire
tom at electricdruid.net
Thu Dec 10 21:49:18 CET 2009
On 10 Dec 2009, at 20:35, karl dalen wrote:
>>
>> As far as I know, there is no such buffering on the dsPIC
>> timers. However, you might get a similar effect this way:
>>
>> 1) Start off with a low freq. This requires a large value
>> for the timer to count towards. On dsPIC this goes in the
>> PRx register.
>> 2) Count up towards it, but don't quite get there yet.
>> 3) Change to a high freq. This requires a small value in
>> PRx. Unfortunately, our counter is already at a value larger
>> than our new PRx value, because it was counting towards the
>> old PRx value, which was much larger.
>> 4) The counter keeps counting, since it hasn't matched (the
>> new small value of) PRx. It wraps round, and then eventually
>> matches PRx and resets.
>
> According to timer manual that seams to be the cause of the problem,
> i.e no absolute jump to new timer count value as the old 8253 could
> do?
No, you can do that on dsPIC too. There's TMRx registers that store
the current timer count. You can set those to whatever you like.
The tricky bit is the working out *what* the correct value should be.
I don't think this problem is insurmountable. I think it can be
improved, at the least.
> I noticed Dave uses 2 concatenated 16bit timers to form two 32 bit one
> so for one 33FJ128MC he got 4 32 biters which shows well with the
> pictures
> of the P08 PCB! (4 pieces of dsPIc for the 8 voices).
Yes. 32-bit counters are a big improvement over the 16-bit counter +2-
bit divider that the Juno108 used. The frequency accuracy and hence
frequency stepping is enormously improved. And as you say, there are
4 32-bit counters on each dsPIC chip they're using, so they've got
half-a-processor per voice for working out modulations and such like.
If you want to build a better synth that Dave Smith, just use a whole
dsPIC per voice!
T.
More information about the Synth-diy
mailing list