#include "stm32f4xx.h" #include "LCD2x16.c" void main (void){ int PtrSteps = 0, Del = 1000000; int Steps[4] = {0x0c0, 0x180, 0x300, 0x240}; RCC->AHB1ENR |= 16 + 4; // Enable clock for GPIO C, E: motor, switches GPIOC->MODER |= 0x001055000; // MODE Register LCD_init(); // init LCD LCD_string("Stepper PC:K500", 0x00); // display title string LCD_string("pos=", 0x42); // display initial text while (1) { if (GPIOE->IDR & 0x01) PtrSteps++; // if button S370 -> move right if (GPIOE->IDR & 0x02) PtrSteps--; // if button S371 -> move left LCD_sInt16(PtrSteps,0x46,1); // write position to LCD GPIOC->ODR = (GPIOC->ODR & ~0x3c0) | Steps[PtrSteps & 0x03] | 0x1000; // move motor for (int i = 0; i