Posted: Tue Nov 27, 2007 10:24 am Post subject: Sine wave - how to?
Hello All.
In my device i need good quality sinusoidal signal vith 5000 Hz frequency at base. Frequncy variation is +- 3000 Hz. I need good precision to set frequency - error not more 10 Hz at all range
Amplitude - any - i can use amplification cirquit.
How i can get this signal with BASCOM and AVR? on my board i have external DAC on SPI - but this chip relativly slovely and already bussy to another task. I use Mega 64 and 8MHz clock.
HELP!!!! My brain can explode, but i have no idea ....
Posted: Tue Nov 27, 2007 7:21 pm Post subject: Re: Sine wave - how to?
CrazyIgels wrote:
Hello All.
In my device i need good quality sinusoidal signal vith 5000 Hz frequency at base. Frequncy variation is +- 3000 Hz. I need good precision to set frequency - error not more 10 Hz at all range
Amplitude - any - i can use amplification cirquit.
How i can get this signal with BASCOM and AVR? on my board i have external DAC on SPI - but this chip relativly slovely and already bussy to another task. I use Mega 64 and 8MHz clock.
HELP!!!! My brain can explode, but i have no idea ....
Thanks all.
Sorry my bad english.
This is what I use with both the M128 and M2560 (it will generate 2 simultaneous sine waves):
Code:
Dim Tone1 AsInteger Dim Tone2 AsInteger Dim Duration asInteger Dim l Width AsWord Dim Phase1 AsWord Dim Phase2 AsWord Dim I AsInteger Dim J AsByte , R1 AsByte , R2 AsByte
'Examples:
'Generate 5000 Hz tone for 1 second:
Tone1 =5000
Tone2 =0
Duration =1000
'Generate 660 Hz and 440 Hz for 100 milliseconds
Tone1 =660
Tone2 =440
Duration =100
ConfigTimer1= Pwm , Pwm =8 , Compare A Pwm =Clear Up , Prescale =1Compare B Pwm = Disconnect
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum