User manual

Table Of Contents
mikroC PRO for PIC32
MikroElektronika
429
void main() {
CHECON = 0x32;
AD1PCFG = 0xFFFF; // Congure AN pins as digital
TRISB = 0xF8; // Congure RB7..RB3 as input
LATB = 0;
Sound_Init(&PORTD, 3);
Sound_Play(880, 1000); // Play sound at 880Hz for 1 second
while (1) {
if (Button(&PORTB,7,1,1)) // RB7 plays Tone1
Tone1();
while (RB7_bit); // Wait for button to be released
if (Button(&PORTB,6,1,1)) // RB6 plays Tone2
Tone2();
while (RB6_bit); // Wait for button to be released
if (Button(&PORTB,5,1,1)) // RB5 plays Tone3
Tone3();
while (RB5_bit); // Wait for button to be released
if (Button(&PORTB,4,1,1)) // RB4 plays Melody2
Melody2();
while (RB4_bit); // Wait for button to be released
if (Button(&PORTB,3,1,1)) // RB3 plays Melody
Melody();
while (RB4_bit); // Wait for button to be released
}
}