MikroElektronika PIC Microcontrollers PIC16 Ficha Técnica Página 180

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
Vista de página 179
Programming PIC Microcontrollers in BASIC - mikroElektronika
7.5 Sound Signalization
Some applications require sound signalization in addition to visual or instead of it. It is commonly used to alert or
announce the termination of some long, time-consuming process. The information presented by such means is fairly
simple, but relieves the user from having to constantly look into displays and dials.
BASIC’s Sound library facilitates generating sound signals and output on specified port. We will present a simple
demonstration using piezzo speaker connected to microcontroller’s port.
program Sound
' The following three tones are calculated for 4MHz crystal
sub procedure Tone1
Sound_Play(200, 200) ' Period = 2ms <=> 500Hz, Duration = 200 periods
end sub
sub procedure Tone2
Sound_Play(180, 200) ' Period = 1.8ms <=> 555Hz
end sub
sub procedure Tone3
Sound_Play(160, 200) ' Period = 1.6ms <=> 625Hz
end sub
sub procedure Melody ' Plays the melody "Yellow house"
Tone1
Tone2
Tone3
Tone3
Tone1
Tone2
Tone3
Tone3
Tone1
Tone2
Tone3
Tone1
Tone2
Tone3
Tone3
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/07.htm (14 sur 16)05/11/2004 02:27:46
Vista de página 179
1 2 ... 175 176 177 178 179 180 181 182 183 184 185 ... 193 194

Comentários a estes Manuais

Sem comentários