- This Is An Excerpt Of A Code Written For An Stm32f407 Microcontroller Describe What You Expect To See When The Code Run 1 (37.99 KiB) Viewed 24 times
This is an excerpt of a code written for an STM32F407 microcontroller. Describe what you expect to see when the code run
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
This is an excerpt of a code written for an STM32F407 microcontroller. Describe what you expect to see when the code run
This is an excerpt of a code written for an STM32F407 microcontroller. Describe what you expect to see when the code runs. static void MX_TIM2_Init(void) { htim2. Instance = TIM2; htim2.Init.Prescaler = 1049; htim2.Init. CounterMode = TIM_COUNTERMODE_UP; htim2.Init. Period 999; htim2. Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim2. Init. AutoReload Preload = TIM_AUTORELOAD_PRELOAD_DISABLE; } void HAL_TIM_PeriodElapsedCallback(TIM_Handle Type Def *htim) { if(htim->Instance == htim2. Instance) { HAL_GPIO_TogglePin (GPIOD, GPIO_PIN_15); } } int main(void) { } HAL_Init(); SystemClock_Config(); MX_GPIO_Init(); MX_TIM2_Init(); HAL_TIM_Base_Start_IT(&htim2); while (1) { TIM2->PSC = 20999; HAL_Delay(5000); TIM2->PSC = 41999; HAL_Delay(5000); }