大家好、我将 EduBase ARM 培训师与 LaunchPad 配合使用。 根据其中一个图表、LED 连接到端口 B、但只有 PB0亮起:
这是我拥有的代码、我在 Keil uVision5上运行该代码:
Lab4_2.h
(三
#include #include #define SYSCTL_RCGC2_R(*(volatile UINT32_t*) 0x400FE108) #define GPIO_PORTB_DATA_R(*(volatile UINT32_t*) 0x400053FC) #define GPIO_PORTD_DATA_R(*(volatile UINT32_t*) 0x4000FC2/t2 0x000C2000_C2000_RC000B 时钟控制#define GPT/ SYSCTR门 控控制#define RC000B / SYSCTR门 控#define C2000_TREND/ SYSCC2000_TR门 控控制#define C2000_TRENTRENTREM_TREMTREM_TREM_
Lab4_2.c
(三
#include "Lab4_2.h" #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/gpio.h" #include "driverlib/sysctl.h" int main (void){ uint32_t ui32Input; bool res; //设置 GPIO_sysbclock_pet_pet_gpet_ipt2 ;gp2_ipt1_sysct2_gp2_ipt2|p_ipt2_ipt2_ipt2_ipt2_ipt2_ipt2|p_ipt_ipt1_s_ipt1_s_ipt2_ipt2_ipt2_ipt1_s_ipt1_syt1_r_ipt2_ipt1_syt1_s_ipt2_ipt2_ipt2|p_ipt_ipt_ipt_ipt2_ipt2_ipt2_ipt2_ipt2_ipt2_ipt_ipt2_ipt_ipt2_ GPIO_PIN_1); GPIOPinTypeGPIOOutput (GPIO_PORTB_BASE、GPIO_PIN_0); //将 PD0-PD3设置为输入引脚 GPIOPinTypeGPIOInput (GPIO_PORTD_BASE、GPIO_PIN_3); GPIOPinTypeGPIOInput (GPIO_PORTD_BASE、GPIOPIN_BASE);GPIOPIN_BASE (GPIOPIN_GPIO2) GPIO_PIN_1); GPIOPinTypeGPIOInput (GPIO_PORTD_BASE、GPIO_PIN_0); //检查两个端口是否都准备就绪、可供访问 = SysCtlPeripheralReady (SYSCTL_PERIPH_GPIOB)| SysCtl_Periph_GPIOD); if = 0xTB_INPUT (0x8)、GPIO_PRIM_1 (while)、GPIO_PRIM_IN_GPIO1 (0xT_IN_GPIOPT_IN_GPIO1);if = 0xTB_IN_IN_IN_TO_IN_IN_8 (while) 0x1); GPIOPinWrite (GPIO_PORTB_BASE、GPIO_PIN_2、0x1); GPIOPinWrite (GPIO_PORTB_BASE、 GPIO_PIN_3、0x1); SysCtlDelay (50000); GPIOPinWrite (GPIO_PORTB_BASE、GPIO_PIN_0、 0x0); GPIOPinWrite (GPIO_PORTB_BASE、GPIO_PIN_1、0x0); GPIOPinWrite (GPIO_PORTB_BASE、 GPIO_PIN_2、0x0); GPIOPinWrite (GPIO_PORTB_BASE、GPIO_PIN_3、0x0); SysCtlDelay (50000); } } } }
我是否遗漏了什么?
谢谢你。