PICAXE Frequency Counter and Output

Started by mth5044, May 25, 2015, 11:49:27 PM

Previous topic - Next topic

mth5044

I've got a handful of projects that use Electric Druids fantastic TAPLFO chip. Since each chip has the ability to sync and be sync'd to other chips, I want to crest a control station that could help with keeping then all under control.

TAPLFO reference: http://www.electricdruid.net/datasheets/TAPLFO2Datasheet.pdf

The idea is to have a clock input and output on each effect via a stereo 3.5mm cable. Each effect would then run to the control station. Inside the control station, one of the clock signals would be selected as the master clock which would slave the other effects clocks. This clock signal is sent into a PICAXE and by using the count function, the number of pulses would be counted and output back into all of the slave clocks. Bells and whistles like LCD with BPM, flashing LED and whatnot, but I'm having a problem determining how to go about setting a time scale for reading the clock input pulse.

The TAPLFO, with the multiplier function, is capable of producing pulse cycles of 100Hz to 0.025Hz, or 10ms to 40,000ms.

The PICAXE is capable of counting pulses over 65,000ms, but it needs to know for how long to keep the count window open before starting over. If I set it at 40,000ms, and the actual pulse time is very short, it will be a long long time before the PICAXE updates and changes pulse time. If I set it too short, it won't get the longer pulses.

Any ideas on how to get around this? I thought about a frequency switch to select a range of frequencies, but that is both annoying if you don't know about what BPM you want to put in, and since the frequency range is so large, there would have to be quite a few range selections.

I appreciate your thoughts! Thank you.

Edit: there is a pulsin command that reads pulses in, but it can only ready up to 0.65s. After that it times out and auto zeros.

Tightpants

Hi Matt, The X2 Picaxe chips have hardware interrupt pins (3 I think, see hintsetup command). You could set one of these to trigger on a pulse and call an interrupt routine. Inside the interrupt routine you could set up a millisecond timer to time the pulse frequency. This would free up the Picaxe to do other things and would have no limit on length of timing (other than what can be stored in the time variable). I have never done anything like this so I'm not sure that it would work but it might be worth a try.
Cheers,
Pat 

mth5044

Hi Pat! Thanks for the thoughtful reply. I will do some more research. I can flip relays and LED's with a PICAXE but I'm still figuring out the bugger.

Before reading your reply, I had a thought that it might be easy enough to put another TAPLFO in the control center to automatically do the counter stuff, but where is the fun in that?

Tightpants

Yes why bother buying something to do a job when you can spend a few weeks of sweat toil and misery (and probably more money) working it out yourself  :icon_lol:

I'm sure you know this already but just in case, have a look at the Picaxe forum - I found it a big help, especially at the beginning: http://www.picaxeforum.co.uk/