synchronizing data collection on picaxe

chipwich

Member
My beatbox made the Makezine blog! No doubt it will guide some new minds to experiment with these neat little chips as I've already received a handful of emails.

One email was from someone pointing out a similar beatbox concept located at <A href='http://extraversion.co.uk/beatbox/' Target=_Blank>External Web Link</a> which is very cool, even though it probably does cost more than $5 and probably doesn't fit in 256 bytes!

So this brings me back to a question regarding my implementation:

My device contains some small &quot;jitter&quot; on the sample timing. I believe it is on playback (and not record) since it is most noticable *after* the loop is played one time. How best to synchronize the playback and avoid timing errors? Is there a way to do this with an *internal* timer? On the 08M?

Thanks.
 

chipwich

Member
One thought I had was to use PWMOUT to create a timer and loop this back through an input pin. Unfortunately, the slowest PWMOUT frequency still looks to be far too high for reasonable sampling on an input pin.

I could create a timing signal with another 08M, but prefer to keep it on one chip if possible. Do any picaxe chips have the capability for accurate timings without using an external timebase?
 

xstamp

Senior Member
I know its not the single chip solution you are looking for but how about feeding the pwmout pulses back to a PICAXE input via a ripple counter? For example, the 74HC4040 would give you upto 12-stages.

 

xstamp

Senior Member
Just to make things a bit clearer, for a PWMOUT of 4kHz the output from the 12-stage of the ripple counter would be about 1Hz but you also have the option of driving the PICAXE input from another output stage/frequency. Although a two chip solution it has the advantage of being directly adjustable from the standard PWMOUT command, rather than address an internal timer.

 

Dippy

Moderator
Have you experimented with poking Timer2 prescaler? (12h bits 0&amp;1).
(I haven't understood the original question - but thought I'd throw this in).

And didn't Jeremy fiddle with his scalers for something like this? I don't know whether anything else would get mucked if care not taken.
 

chipwich

Member
xstamp, The ripple counter is a good idea if I have to go to a second chip. With 12 stages, I can definitely find a useful clock signal. Unfortunately I don't have one in my very limited IC box. Though I do have spare 08M's, so that's probably what I'll end up doing.

Dippy, sorry if the question wasn't clear. I would like to acquire samples regularly (i.e. a datalogger), and then play them back with the same timing. Using the &quot;pause&quot; command for delay, however, I noticed that there is a small amount of timing inaccuracy in the process. This is presumably due to calculations which much be performed (i.e. data compression) and take variable lengths of time to compute.

Using a clock for timing rather than a software command is probably the way to solve this. I was wondering: can I implement this with a single chip or is it necessary to use 2 ICs?

Thanks.

BTW, the device is at <A href='http://www.medcosm.com/picaxe_beatbox.htm' Target=_Blank>External Web Link</a>
if it helps to see the current implementation.
 

hippy

Technical Support
Staff member
It should be possible to poke the Timer/CCP SFR's in the 08M to generate an output toggle at a fixed rate of your own choosing.

I haven't tried it with an 08M but it worked okay on the 18X. Make sure Pin 2 is made an output.

http://homepage.ntlworld.com/the.happy.hippy/picaxe/timers.zip

An alternative approach might be to sample the timer when inputting then poke the timer when outputting and wait for a timeout to move on to the next sample.
 
Top