User manual

465
mikoPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
end;
end;
begin
ADPCFG := 0xFFFF; // Congure AN pins as digital I/O
TRISB := 0xF8; // Congure 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.