Advertisement
demoss

main.c_ver3_WORKING

Jul 23rd, 2015
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include <stm32f10x.h>
  2. #include <stm32f10x_rcc.h>
  3. #include <stm32f10x_gpio.h>
  4. //include H
  5. void delay(volatile uint32_t nCount) {
  6.     for (; nCount != 0; nCount--);
  7. }
  8. //timer_to_future_use
  9. int i;
  10. //i
  11. volatile void main(void)
  12. {
  13.   RCC->APB2ENR|=RCC_APB2ENR_IOPCEN; //power up PORT_C
  14.   GPIOC->CRH=0x80200000; //PORT_C_15 = input, push_down ,, PORT_C_13 = output
  15.    for(i=1;i!=0;i++){ //starting cycle
  16.   if(GPIOC->IDR&GPIO_IDR_IDR15)GPIOC->BRR=(1<<13); //if button presed - push down PORT_C_13
  17.   else
  18.     GPIOC->BSRR=(1<<13); //IF not pressed - push up PORT_C_13 (led)
  19.   }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement