TM4C123 GPIO Port Interrupt Tasks
1. Sample program (SW1 Interrupt)
- Create a CCS Project with "Empty Project"
- Download sw1_int.c program and Add this file to your project.
- Open tm4c123gh6pm_startup_ccs_gcc.c for editing and replace IntDefaultHandler with the GPIOPortF_Handler in the GPIO PortF vector position.
- Build and Debug (Run) the program.
- Run this code and load it into the flash of microcontroller. You will see that the blue LED gets turned on when user switch is pressed first then if it is pressed again it gets turned off.
2. GPIOF interrupt from SW1 and SW2
- Rewrite sw1_int.c program to distinguish the interrupt pin. Toggle Red LED on PF1 continuously. Upon pressing either SW1 or SW2, the Green or Blue LED will toggle three times. main program toggles Red LED while waiting for interrupt from SW1 or SW2.
3. Interrupt from External Source
- Write a program to toggle an LED at the same rate as the input frequency by connecting a square wave of 3.3V to a pin of Portx. (You can make it to toggle on positive or negative edge)
- Hint: Configure PORTD6 to trigger interrupt by falling edge. In the interrupt handler, the green LED (PF3) is toggled. The green LED should have half the frequency of the input signal at PORTD6. IRQ3 is assigned to PORTD6.
- EK-TM4C123GXL LaunchPad Board
- GPIO Programming