Guest User

LED

a guest
Jun 29th, 2021
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <stdint.h>
  2. #include <stdio.h>
  3.  
  4. #define GPIOD_MODER *((volatile uint32_t*)0x40020C00)
  5. #define GPIOD_ODR *((volatile uint32_t*)0x40020C14)
  6. #define RCC_ENR *((volatile uint32_t*)0x40023830)
  7.  
  8.  
  9. int main(void)
  10. {
  11. RCC_ENR|=(1<<3);//GPIOD CLOCK ENABLED
  12.  
  13. GPIOD_MODER|=(1<<24);//setting pin 12 as output
  14. GPIOD_MODER|=(1<<26);//setting pin 13 as output
  15. GPIOD_MODER|=(1<<28);//14
  16. GPIOD_MODER|=(1<<30);//15
  17.  
  18.  
  19. GPIOD_ODR|=(1<<12); //setting output value to 1 (pin 12)
  20. GPIOD_ODR|=(1<<13);
  21. GPIOD_ODR|=(1<<14);
  22. GPIOD_ODR|=(1<<15);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment