You are on page 1of 1

#include "main.

h"

void tempo(){
while((TIM10->SR&0x01)==0x00){}
TIM10->SR&=~(0x01);
}

int main(void)
{
int aux;
RCC->AHB1ENR=0X87;
RCC->APB2ENR|=0x20000;
GPIOC->MODER|=0x00005555;
GPIOA->MODER|=0x28000400;

TIM10->CR1|=0x05;
TIM10->PSC=15999;
TIM10->ARR=999;

while (1)
{
for(aux=0; aux<7; aux++){
tempo();
GPIOC->ODR|=1<<aux;

for(aux=6; aux>=0; aux--){


tempo();
GPIOC->ODR&=~(1<<aux);
}
}
}

You might also like