Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stm32f10x.h>
- #include <stm32f10x_rcc.h>
- #include <stm32f10x_gpio.h>
- //include H
- void delay(volatile uint32_t nCount) {
- for (; nCount != 0; nCount--);
- }
- //timer_to_future_use
- int i;
- //i
- volatile void main(void)
- {
- RCC->APB2ENR|=RCC_APB2ENR_IOPCEN; //power up PORT_C
- GPIOC->CRH=0x80200000; //PORT_C_15 = input, push_down ,, PORT_C_13 = output
- for(i=1;i!=0;i++){ //starting cycle
- if(GPIOC->IDR&GPIO_IDR_IDR15)GPIOC->BRR=(1<<13); //if button presed - push down PORT_C_13
- else
- GPIOC->BSRR=(1<<13); //IF not pressed - push up PORT_C_13 (led)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement