ARM LPC2138/48 Mini Development Board – BUZZER Interfacing
LPC 2138/48 mini development board has an on-board buzzer connected to port pin P0.21 via jumper J10. To use the buzzer, it is necessary to short the jumper. If P0.21 is to be used for any other purpose, then the jumper should be left open.
Sample code to test the on-board buzzer using switch is given below. Here, pressing the switch SW1 generates an interrupt and toggles the status of buzzer.
Schematic
Note: To use buzzer, don’t forget to short jumper J10. Leaving it open frees P0.21 and can be used for any other desired purpose.
Sample Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
/************************************************************************************** HEADER FILES ***************************************************************************************/ #include<lpc21xx.h> /************************************************************************************** INTERRUPT SERVICE ROUTINE ***************************************************************************************/ void Ext_Interrupt(void)__irq { EXTINT = 0X02; /* Clear interrupt flag */ IO0PIN = (IO0PIN ^ 0X00200000) & 0x00200000; /* Toggle P0.21 on every interrupt */ VICVectAddr = 0x00000000; /* Acknowledge Interrupt */ } /************************************************************************************** * Function : Init_Ext * * * * Description : Function for initialising interrupt * * * * Parameters : None * ***************************************************************************************/ void Init_Ext(void) { PINSEL0 |= 0X20000000; /* Enable EXT1 */ EXTMODE = 0X02; /* Edge sensitive */ EXTPOLAR = 0X02; /* Rising edge */ VICVectAddr0 =(unsigned int)Ext_Interrupt; /* Set Interrupt Vector in 0 */ VICVectCntl0 = 0x0000002F; /* Use it for EXT1 Interrupt */ VICIntEnable = 0x00008000; /* Enable EXT1 INTERRUPT */ } /************************************************************************************** MAIN FUNCTION ***************************************************************************************/ int main(void) { IO0DIR = 0X00200000; /* P0.21 configured as output */ Init_Ext(); while(1); } /********************************** END OF PROGRAM **********************************/ |
Topics related to ARM LPC2138/48 Mini Development Board
- ARM LPC2138/48 Mini Development Board – Overview
- ARM LPC2138/48 Mini Development Board – LED Interfacing
- ARM LPC2138/48 Mini Development Board – LCD Interfacing
- ARM LPC2138/48 Mini Development Board – UART0 Interfacing
- ARM LPC2138/48 Mini Development Board – UART1 Interfacing
- ARM LPC2138/48 Mini Development Board – Switches Interfacing
- ARM LPC2138/48 Mini Development Board – BUZZER Interfacing
- ARM LPC2138/48 Mini Development Board – POT Interfacing (ADC)
- ARM LPC2138/48 Mini Development Board – Temperature Sensor Interfacing(ADC)
- ARM LPC2138/48 Mini Development Board – Interfacing Servo motor
- ARM LPC2138/48 Mini Development Board – Internal Real Time Clock (RTC)
- ARM LPC2148 Mini Development Board – USB Interfacing (Human Interface Device)
Resources
- Softwares
- Datasheets
How to buy?
- Click here to buy rhydoLABZ ARM LPC2129 Development board-Mini
- Click here to buy rhydoLABZ ARM LPC2138 Development Board-Mini
- Click here to buy rhydoLABZ ARM LPC2148 Development Board-Mini
Support
Please share your ideas with us, visit our forum for discussion