[sdiy] DsPIC timer issue when used as DCO!

karl dalen dalenkarl at yahoo.se
Thu Dec 10 21:35:45 CET 2009


> On 10 Dec 2009, at 16:52, Colin f wrote:
> 
> > I haven't been following this thread...
> > But that picture looks to me like the change of pitch
> applies immediately to
> > the CV for the waveshaper (the timing cap charges at
> the correct new rate
> > causing the triangle wave to complete its full cycle
> in the correct time),
> > but the timer generated reset of the cap doesn't
> happen until the end of the
> > period for the old pitch.
> > Superimpose another cycle of the lower pitch triangle
> wave in your head as
> > it continues - the switch to the higher pitch occurs
> after that cycle
> > completes.
> 
> I think you're on the right track, Colin:
> 
> http://www.electricdruid.com/P08Glitch.gif
> 
> I copied the image into a graphics package, traced the
> original triangle wave on the far left, then shifted the
> waveform across horizontally to match the other.
> Surprise surprise, it's a good fit. Is this a fluke or
> vital information?
> 
> > This says to me that the new pitch period is being put
> into a reload
> > register in the timer, when it should be written to
> the current timer value.
> 
> 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?
-----------------------------------------------------------
Timer manual says:
The state of the output pin changes when the timer
value matches the compare register value. The Output
Compare module generates either a single output
pulse or a sequence of output pulses, by changing the
state of the output pin on the compare match events.
-----------------------------------------------------------

If the timer would have been able to change instantly at new load
of count the Microchip people would have promoted that as a feature! :)
Also it seams that only the toggle mode are viable for use in the p08.

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).


      __________________________________________________________
Ta semester! - sök efter resor hos Kelkoo.
Jämför pris på flygbiljetter och hotellrum här:
http://www.kelkoo.se/c-169901-resor-biljetter.html?partnerId=96914052




More information about the Synth-diy mailing list