configuración Del Reloj: "STM32F7xx.h"

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

#include <stdio.

h>
#include "STM32F7xx.h"

int main(void)
{
//Configuración del reloj
RCC->AHB1ENR |=0xF;

//Configuración de Pines
GPIOB->MODER |=0x55555555;
GPIOB->OTYPER |=0x0;
GPIOB->OSPEEDR |=0x55555555;
GPIOB->PUPDR |=0x55555555;
GPIOC->MODER |=0x00000000;
GPIOC->OTYPER |=0x0;
GPIOC->OSPEEDR |=0x55555555;
GPIOC->PUPDR |=0xAAAAAAAA;
GPIOD->MODER |=0x55555555;
GPIOD->OTYPER |=0x0;
GPIOD->OSPEEDR |=0x55555555;
GPIOD->PUPDR |=0x55555555;

int a=0;
int c=0;
int b=0;
int d=0;

// 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , A , b , C , d , E , F , .
int numero[18]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x67,0x77,0x7C,0x39,0x5E,0x79,0x71,0x80};
int led[8] ={0x1,0x2,0x4,0x20,0x40,0x80,0x100,0x200};

//Ciclo While
while(true)
{

if(GPIOC->IDR &=0x2000)
{
a=1;
}
else if (GPIOC->IDR &=0x1)
{
a=2;
}

if(a==1)
{
GPIOD->ODR |=numero[c];
GPIOB->ODR |=led[d];
for(int i;i<1000000;i++);
GPIOD->ODR &=0x0000;
GPIOB->ODR &=0x0000;
for(int i;i<10000;i ++);
c++;
d++;
}
else if(a==2)
{
GPIOD->ODR |=numero[c];
GPIOB->ODR |=led[d];
for(int i;i<1000000;i++);
GPIOD->ODR &=0x0000;
GPIOB->ODR &=0x0000;
for(int i;i<10000;i ++);
c--;
d--;
}
if(d>=8){d=0;}
else if(d<0){d=7;}

if(GPIOC->IDR &=0x2)
{
b++;
for(int i;i<10000;i++);
}
if(b>3)
{
b=1;
}

switch(b)
{
// Decimal
case 1:
if (c>=10){c=0;}
else if (c<0){c=9;}
break;

// Octal
case 2:
if (c>=8){c=0;}
else if (c<0){c=7;}
break;

// Hexadecimal
case 3:
if (c>=16){c=0;}
else if (c<0){c=15;}
break;

default:
GPIOD->ODR |=numero[17];
for(int i;i<1000000;i++);

}
}

You might also like