Advertisement
teplofizik

main.c (sdcc helooworld)

Jul 2nd, 2013
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. //
  2. // Первый проект с stm8 и sdcc!
  3. //
  4.  
  5. #include <stm8s.h>
  6.  
  7. static void delay(uint32_t t)
  8. {
  9.     while(t--) {}
  10. }
  11.  
  12. int main(void)
  13. {
  14.     // led
  15.     GPIOD->DDR |= (1 << 0);
  16.     GPIOD->ODR |= (1 << 0);
  17.  
  18.     while(1)
  19.     {
  20.         GPIOD->ODR |= (1 << 0);
  21.         delay(100000UL);
  22.         GPIOD->ODR &= ~(1 << 0);
  23.         delay(100000UL);
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement