User manual
mikroPascal PRO for PIC32
MikroElektronika
393
begin
ToneA();
ToneC();
ToneE();
end;
end;
begin
CHECON := 0x32;
AD1PCFG := 0xFFFF; // Congure AN pins as digital I/O
TRISB := 0xF8; // Congure RB7..RB3 as input
Sound_Init(PORTD, 3);
Sound_Play(880, 1000);
while TRUE do // endless loop
begin
if (Button(PORTB,7,1,1)) then // If PORTB.7 is pressed play Tone1
begin
Tone1();
while (RB7_bit <> 0) do nop; // Wait for button to be released
end;
if (Button(PORTB,6,1,1)) then // If PORTB.6 is pressed play Tone1
begin
Tone2();
while (RB6_bit <> 0) do nop; // Wait for button to be released
end;
if (Button(PORTB,5,1,1)) then // If PORTB.5 is pressed play Tone1
begin
Tone3();
while (RB5_bit <> 0) do nop; // Wait for button to be released
end;
if (Button(PORTB,4,1,1)) then // If PORTB.4 is pressed play Tone1
begin
Melody2();
while (RB4_bit <> 0) do nop; // Wait for button to be released
end;
if (Button(PORTB,3,1,1)) then // If PORTB.3 is pressed play Tone1
begin
Melody();
while (RB3_bit <> 0) do nop; // Wait for button to be released
end;
end;
end.