전체 보기 : https://makershackers.tistory.com/tag/baremetal_stm32_f411
#include "stm32f4xx.h"
void DelayMilliseconds (int delay);
int main(void)
{
RCC->AHB1ENR |= 1;
GPIOA-> MODER |= 0x400;
while (1) {
GPIOA -> BSRR |= 0x20; // GPIOA -> ODR |= 0x20; // set PA5 high
DelayMilliseconds(100);
GPIOA -> BSRR = 0x00200000; // 0b 00000 0000 0010 0000 0000 0000 0000 0000
DelayMilliseconds(100);
}
}
// Taking into account 16Mhz system clock
void DelayMilliseconds (int delay)
{
int i;
for(;delay>0;delay--) {
for (i=0;i<3195;i++);
}
}
'hardwares > stm32' 카테고리의 다른 글
SysTick 시간기기(timer) (2/2), 1초 이상 (0) | 2021.07.20 |
---|---|
SysTick 시간기기(timer) (1/2) (0) | 2021.07.15 |
[ 번역 ] MOOC - STM32Cube.AI workshop (2/2) (0) | 2021.02.18 |
[ 번역 ] MOOC - STM32Cube.AI workshop (1/2) (0) | 2021.02.18 |
[ 번역 ] MOOC - Introduction to STM32Cube AI (0) | 2021.02.18 |