MikroElektronika PIC Microcontrollers PIC16 Ficha de datos Pagina 181

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 194
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 180
Programming PIC Microcontrollers in BASIC - mikroElektronika
Tone1
Tone2
Tone3
Tone3
Tone3
Tone2
Tone1
end sub
main:
TRISB = $F0
Sound_Init(PORTB, 2) ' Connect speaker on pins RB2 and
GND
Sound_Play(50, 100)
while true
if Button(PORTB,7,1,1) then ' RB7 plays Tone1
Tone1
end if
while TestBit(PORTB,7) = 1 ' Wait for button to be released
nop
wend
if Button(PORTB,6,1,1) then ' RB6 plays Tone2
Tone2
end if
while TestBit(PORTB,6) = 1 ' Wait for button to be released
nop
wend
if Button(PORTB,5,1,1) then ' RB5 plays Tone3
Tone3
end if
while TestBit(PORTB,5) = 1 ' Wait for button to be released
nop
wend
if Button(PORTB,4,1,1) then ' RB4 plays Melody
Melody
end if
while TestBit(PORTB,4) = 1 ' Wait for button to be released
nop
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/07.htm (15 sur 16)05/11/2004 02:27:46
Vista de pagina 180
1 2 ... 176 177 178 179 180 181 182 183 184 185 186 ... 193 194

Comentarios a estos manuales

Sin comentarios