Samuel Peña Moronta 20170570 Tarea # 5 Microprocesadores
Samuel Peña Moronta 20170570 Tarea # 5 Microprocesadores
#include "stm32f10x.h"
#include "stdint.h"
#include <stdbool.h>
/*
SAMUEL P. MORONTA 20170570/10131492
TAREA # 5
*/
//*************************DEFINES*************************//
#define PIN_0 0x00000001
#define PIN_1 0x00000002
#define PIN_2 0x00000004
#define PIN_3 0x00000008
#define PIN_4 0x00000010
#define PIN_5 0x00000020
#define PIN_6 0x00000040
#define PIN_7 0x00000080
#define PIN_8 0x00000100
#define PIN_9 0x00000200
#define PIN_10 0x00000400
#define PIN_11 0x00000800
#define PIN_12 0x00001000
#define PIN_13 0x00002000
#define PIN_14 0x00004000
#define PIN_15 0x00008000
#define PIN_012 0x7
//*************************GLOBALES*************************//
volatile uint32_t hundred;
volatile uint32_t decency;
volatile uint32_t unit;
volatile uint32_t tecla;
unsigned int cont = 0;
//*************PROTOTIPOS DE FUNCIONES*********************//
void display(volatile uint32_t T[], volatile uint32_t K);
void timerSetUp(void);
void deco_teclado(void);
bool aux(GPIO_TypeDef *port, uint16_t num);
bool timerControl(void);
void readReg(void);
int main(void)
SAMUEL PEÑA MORONTA 20170570 TAREA # 5 MICROPROCESADORES.
{
readReg();
unsigned int typePin = 0;
while(1) {
do{
deco_teclado();
display(arrNum, TIM1->CNT);
do{
display(arrNum, TIM1->CNT);
timerControl();
}while(numCajas > TIM1->CNT);
}while(tecla < 1);
}
}
void readReg(void){
//Registro de lectura/
GPIOA->ODR = 0x00000000;
/*Columnas */
GPIOB->ODR = PIN_0;
GPIOB->ODR = PIN_1;
GPIOB->ODR = PIN_2;
}
void timerSetUp(void){
}
switch (aux(GPIOB, PIN_3)){
case PIN_0: if(cont == 0){num1_present = arrNum[2]; cont+=1;}else if(cont == 1){num2_present = arrNum[2];}break;
case PIN_1: if(cont == 0){num1_present = arrNum[5]; cont+=1;}else if(cont == 1){num2_present = arrNum[5];}break;
case PIN_2: if(cont == 0){num1_present = arrNum[8]; cont+=1;}else if(cont == 1){num2_present = arrNum[8];}break;
default: break;
}
num1_present = 0;
num2_present = 0;
}
void display(volatile uint32_t T[], volatile uint32_t K){
/*Centena */
hundred = K/100;
/* Descena*/
decency = ((K-hundred *100)/10);
/* Unidad */
unit = (K - hundred * 100 - decency * 10);