Actions

EmSys

Difference between revisions of "TM4C123 GPIO Port Interrupt Tasks"

From EdWiki

m (2. Multiple Interrupts of the same Portx)
m (2. GPIOF interrupt from SW1 and SW2)
Line 9: Line 9:
  
 
=== 2. GPIOF interrupt from SW1 and SW2 ===
 
=== 2. GPIOF interrupt from SW1 and SW2 ===
* Rewrite the above program ([{{SERVER}}/emsys/tivac/sw1_int.c <big>sw1_int.c</big>]) to distinguish between various pins of PortF. Toggle Red LED on PF1 continuously. Upon pressing either SW1 or SW2, the Green LED of PF3 should toggle for three times.
+
* Rewrite of the interrupt handler in [{{SERVER}}/emsys/tivac/sw1_int.c <big>program</big>]) 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 ===
 
=== 3. Interrupt from External Source ===

Revision as of 06:07, 7 February 2020

GPIO Interrupt Programming 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 Port F 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 of the interrupt handler in 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 or both)



Prev.gif
Home.gif