/* Sound the speaker at 440Hz * * The speaker is connected to P5.6. * The delay counter is empirically derived. * * Built and tested with MSP432P401R Rev. C, Keil MDK-ARM v5.24a and MSP432P4xx_DFP v3.1.0 */ #include "msp.h" void delay(void); int main(void) { P5->DIR |= 0x40; /* configure P5.6 as output */ for (;;) { P5->OUT |= 0x40; delay(); P5->OUT &= ~0x40; delay(); } } void delay(void) { int i; for (i = 851; i > 0; i--); /* Delay */ }