I am trying to create a signal generator to produce a square wave at frequencies between 0Hz and 200Hz, I want to be able to vary the frequency by sending serial commands to the picaxe.
Currently I am using a pixaxe 08M to read the serial commands and produce an analogue output (PWM smoothed by an RC) which I am feeding into an AD654 to convert the analogue voltage to a frequency (I have set up the AD654 to produce frequencies in the range of 0Hz to 200Hz)
I however would really like to eliminate the AD654 and produce the output frequency directly using only the one picaxe
Here is the code I am currently using:
I am thinking I might get a 28X2 or similar and use the internal timer, overflow flags and interrupts to produce my signal, but I am not too sure how to go about that and I still think that might be overkill for something which seems so simple.
Any ideas or hints on how to go about this would be gladly appreciated
Currently I am using a pixaxe 08M to read the serial commands and produce an analogue output (PWM smoothed by an RC) which I am feeding into an AD654 to convert the analogue voltage to a frequency (I have set up the AD654 to produce frequencies in the range of 0Hz to 200Hz)
I however would really like to eliminate the AD654 and produce the output frequency directly using only the one picaxe
Here is the code I am currently using:
Code:
b1 = MAX_speed
pwmout 2,64,b1
serin 4,T1200_4,("DATA"),b2,b3 'Wait for serial command
if b3="%"
then goto test1
test1:
symbol T1_speed = 100 'Test1 min speed
symbol T1_rate = 5 'Test1 rate of change
do
dec b1
pwmout 2,64,b1
pause T1_rate
loop while b1>T1_speed
do
inc b1
pwmout 2,64,b1
pause T1_rate
loop while b1<MAX_speed
goto main
Any ideas or hints on how to go about this would be gladly appreciated