Advertisement
Guest User

Untitled

a guest
May 30th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. int main(void)
  2. {
  3.     GPIO_InitTypeDef GPIO_InitStructure;
  4.  
  5. // Wlaczenie sygnalu taktujacego port D
  6.     RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD , ENABLE);
  7.  
  8.     GPIO_InitStructure.GPIO_Pin = (GPIO_Pin_12 | GPIO_Pin_14);
  9.     GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
  10.     GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
  11.     GPIO_Init(GPIOD, &GPIO_InitStructure);
  12.  
  13.     // Wyzerowanie wyjscia PD14
  14.     GPIO_ResetBits(GPIOD, GPIO_Pin_14);
  15.  
  16.     // Ustawienie wyjscia PD12
  17.     GPIO_SetBits(GPIOD, GPIO_Pin_12);
  18.  
  19.     while(1){
  20.         // Zmiana stanu wyjsc na przeciwny
  21.         GPIO_ToggleBits(GPIOD, GPIO_Pin_12 | GPIO_Pin_14);
  22.  
  23.         // Czekaj
  24.         Delay();
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement