frequency gen.

hej guys,
i want to program an frequency gen. it have to generate abaout 6-7 different freq. about 20HZ ....and up .
how should i go on, on this work, any ideas?
what should i use to implement it.(interrupts......)

(with the timers, i can only generate 3 different freq. so it should be an software solution!?)

thx

I am making the assumption you intend to generate several different frequencies at once on different outputs. This is pretty easy in Bitlash, presuming your resolution and jitter requirements are not so tight: you can run several background macros and have each one watch the time to flip its bit at its own frequency. Something like this, at the Bitlash prompt:

"toggle D2 at 20hz"
pinmode(2,1)
f20 := "if millis > t: d2=!d2; t=millis + 1000/20/2"
run f20
ps  // this should show f20 running and d2 should be toggling

Repeat as needed substituting a different frequency and counter variable, for example using 30 hz and v instead of 20 hz and t:

"toggle D3 at 30hz"
pinmode(3,1)
f30 := "if millis > v: d3=!d3; v=millis + 1000/30/2"
run f30
ps

Add a startup macro to run them both and you have a frequency generating engine:

startup:="run f20; run f30"
boot

Hope that helps.

Bill

Get Bitlash: http://bitlash.net