User Guide
GD32130F-START
8 /11
5.2.
GPIO_Key_Polling_mode
5.2.1.
DEMO purpose
This Demo includes the following functions of GD32 MCU:
Learn to use GPIO control the LED and the KEY
Learn to use SysTick to generate 1ms delay
GD32130F-START-V1.0 board has two keys and two LEDs. The two keys are Reset key and
User key. The LED1 and LED2 are controlled by GPIO.
This demo will show how to use the User key to control the LED1. When press down the
User Key, it will check the input value of the IO port. If the value is 1, wait for 50ms. Then
check the input value of the IO port again. If the value is still 1, indicates that the button is
pressed down successfully, and light the LED1.
5.2.2.
DEMO running Result
Download the program <02_GPIO_Key_Polling_mode> to the board, first of all, all the LEDs
will be flashed once for test. Then press down the User Key, LED1 will be turned on. Press
down the User Key again, LED1 will be turned off.
5.3.
EXTI_Key_Interrupt_mode
5.3.1.
DEMO purpose
This Demo includes the following functions of GD32 MCU:
Learn to use GPIO to control the LED and the KEY
Learn to use EXTI to generate external interrupt
GD32130F-START-V1.0 board has two keys and two LEDs. The two keys are Reset key and
User key. The LED1 and LED2 are controlled by GPIO.
This demo will show how to use EXTI interrupt line to control the LED1. When press down
the User Key, it will produce an interrupt. In the interrupt service function, the demo will
toggle LED1.
5.3.2.
DEMO running Result
Download the program <03_EXTI_Key_Interrupt_mode> to the board, first of all, all the
LEDs will be flashed once for test. Then press down the User Key, LED1 will be turned on.
Press down the User Key again, LED1 will be turned off.