The Stm32f103 Arm Microcontroller And Embedded Systems Work
An embedded system is a dedicated computer system designed to perform one or a few specific functions, often with real-time computing constraints. Unlike a general-purpose PC, it is embedded as part of a complete device (e.g., microwave, car engine control, medical pump).
A mechanical switch bounces. Without debouncing, one press might register as 10 presses.
A simple program to toggle an LED on GPIO pin PC13 (typical Blue Pill onboard LED) demonstrates embedded systems work: the stm32f103 arm microcontroller and embedded systems work
#include "stm32f1xx.h"
int main(void) = RCC_APB2ENR_IOPCEN;
// Configure PC13 as push-pull output, max speed 2 MHz
GPIOC->CRH
Alternatively, using HAL simplifies development at the cost of code size and execution speed.
#include "stm32f1xx_hal.h"
void main(void)
HAL_Init();
__HAL_RCC_GPIOC_CLK_ENABLE();
GPIO_InitTypeDef gpio = GPIO_PIN_13, GPIO_MODE_OUTPUT_PP, GPIO_PULLUP, GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOC, &gpio); An embedded system is a dedicated computer system
while(1)
HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
HAL_Delay(500);