frequency gen.


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


(with timers, can generate 3 different freq. should software solution!?)

thx

i making assumption intend generate several different frequencies @ once on different outputs. pretty easy in bitlash, presuming resolution , jitter requirements not tight: can run several background macros , have each 1 watch time flip bit @ own frequency.  something this, @ bitlash prompt:

code: [select]

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

repeat needed substituting different frequency , counter variable, example using 30 hz , v instead of 20 hz , t:

code: [select]

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


add startup macro run them both , have frequency generating engine:

code: [select]

startup:="run f20; run f30"
boot


hope helps.

bill

get bitlash: http://bitlash.net


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > frequency gen.


arduino

Comments