Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/05/03 13:58
Read: times


 
#38300 - RE: About speaker
Responding to: ???'s previous message
Humans ear can hear the frequencies between 20 Hz and 20 Khz. Any oscillation in this range is audible. Obtaining an audible wave with 8051 is easy. For ex. if you use 12 Mhz crystal you have a 1us timebase. Period (T) of the sound you want to have is:
T=1/f
lets say f=2 Khz then
T=(1/2000) = 500 us

Now your timer reload value is :
(65536-(500/2))

We divided value by 2 because half of the period is 1 and other half 0.
Run your timer in 16 bit mode and reload
(65536-250) for 2 Khz signal.
Of course you will compile your output pin (p1.0) in every timer interrupt (thets why we divided the period by 2).
This is %50 duty square wave signal. Try to change duty , add some rc to your hardware to have triangle and sinusoidal waves.
Using max038 chip (from maxim) may be brilliant idea.
Thats all.

List of 12 messages in thread
TopicAuthorDate
About speaker            01/01/70 00:00      
   RE: About speaker            01/01/70 00:00      
      RE: About speaker            01/01/70 00:00      
      RE: About speaker            01/01/70 00:00      
         RE: About speaker            01/01/70 00:00      
            RE: About speaker            01/01/70 00:00      
               RE: About speaker            01/01/70 00:00      
   RE: About speaker            01/01/70 00:00      
   RE: About speaker            01/01/70 00:00      
   RE: ASM sound generation routines            01/01/70 00:00      
   RE: ASM sound generation routines            01/01/70 00:00      
   RE: how not to comment code            01/01/70 00:00      

Back to Subject List