Вы находитесь на странице: 1из 5

//ANA MARIA LOPEZ MIRANDA

#include "main.h"

void SystemClock_Config(void);

static void MX_GPIO_Init(void);

int entero=32526;

uint32_t hexa;//depende de la longitud del numero

int cociente=0, residuo=0, convert=0;//auxiliares

int dato1=0,dato2=0;

int main(void)

HAL_Init();

SystemClock_Config();

MX_GPIO_Init();

residuo = entero%16;//se parta la parte del residuo

cociente = entero / 16;

hexa = hexa | (residuo<<4);//se corre de a 4 beats

residuo = cociente%16;

cociente = cociente/16;

hexa = hexa | (residuo<<8);//interaccion cambia el cociente

hexa = hexa | (cociente << 12);//necesito 4 beats por numero

//cociente da un número menor a 16

convert = (int)hexa;//conversion de un numero cualquiera a entero

//se convierte a entero


dato1 = 0x0F & hexa;//(una and) cifras menos significativas ,dejo todos los beats
despues del 4 en 0 y los primeros 4 me quedan en 1 y realizo una and con el
numero hexa (solo mi primera cifra)

dato2 = (0xF00 & hexa)>>8;//corrimiento aseguro los 4 ceros y los últimos


en 1

//agrego un corrimiento de 8 beats para el otro lado para que me muestre F


//12 no porque se va mas alla

while (1){

if (entero){

residuo = entero%16;

{cociente = entero / 16;};

if (entero){

hexa = residuo << 0;

residuo = cociente%16;

cociente = cociente/16;

if(entero){

hexa = hexa | (residuo<<4);

residuo = cociente%16;

cociente = cociente/16;

hexa = hexa | (residuo<<8);

if (entero){

hexa = hexa | (cociente << 12);

convert = (int)hexa;

dato1 = 0x0F & hexa;

dato2 = (0xF00 & hexa)>>8;

}
void SystemClock_Config(void)

RCC_OscInitTypeDef RCC_OscInitStruct = {0};

RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

/** Initializes the CPU, AHB and APB busses clocks

*/

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;

RCC_OscInitStruct.HSIState = RCC_HSI_ON;

RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;

RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;

RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL12;

if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)

Error_Handler();

/** Initializes the CPU, AHB and APB busses clocks

*/

RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK

|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;

RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;

RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;

RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;

RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)

Error_Handler();

static void MX_GPIO_Init(void)

GPIO_InitTypeDef GPIO_InitStruct = {0};

/* GPIO Ports Clock Enable */

__HAL_RCC_GPIOE_CLK_ENABLE();

/*Configure GPIO pin Output Level */

HAL_GPIO_WritePin(GPIOE, GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14, GPIO_PIN_RESET);

/*Configure GPIO pins : PE11 PE12 PE13 PE14 */

GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14;

GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);

}
void Error_Handler(void)

/* USER CODE BEGIN Error_Handler_Debug */

/* User can add his own implementation to report the HAL error return state */

/* USER CODE END Error_Handler_Debug */

#ifdef USE_FULL_ASSERT

/**

* @brief Reports the name of the source file and the source line number

* where the assert_param error has occurred.

* @param file: pointer to the source file name

* @param line: assert_param error line source number

* @retval None

*/

void assert_failed(uint8_t *file, uint32_t line)

/* USER CODE BEGIN 6 */

/* User can add his own implementation to report the file name and line number,

tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

/* USER CODE END 6 */

#endif /* USE_FULL_ASSERT */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

Вам также может понравиться

  • PR
    PR
    Документ3 страницы
    PR
    Ana Lopez
    Оценок пока нет
  • GS
    GS
    Документ3 страницы
    GS
    Ana Lopez
    Оценок пока нет
  • HC
    HC
    Документ4 страницы
    HC
    Ana Lopez
    Оценок пока нет
  • NN
    NN
    Документ2 страницы
    NN
    Ana Lopez
    Оценок пока нет
  • Sam
    Sam
    Документ2 страницы
    Sam
    Ana Lopez
    Оценок пока нет
  • FR
    FR
    Документ3 страницы
    FR
    Ana Lopez
    Оценок пока нет
  • MP
    MP
    Документ3 страницы
    MP
    Ana Lopez
    Оценок пока нет
  • GQ
    GQ
    Документ4 страницы
    GQ
    Ana Lopez
    Оценок пока нет
  • Glo
    Glo
    Документ8 страниц
    Glo
    Ana Lopez
    Оценок пока нет
  • DRC
    DRC
    Документ5 страниц
    DRC
    Ana Lopez
    Оценок пока нет
  • MS
    MS
    Документ3 страницы
    MS
    Ana Lopez
    Оценок пока нет
  • FP
    FP
    Документ9 страниц
    FP
    Ana Lopez
    Оценок пока нет
  • GQ
    GQ
    Документ4 страницы
    GQ
    Ana Lopez
    Оценок пока нет
  • Sam
    Sam
    Документ2 страницы
    Sam
    Ana Lopez
    Оценок пока нет
  • PR
    PR
    Документ3 страницы
    PR
    Ana Lopez
    Оценок пока нет
  • MS
    MS
    Документ3 страницы
    MS
    Ana Lopez
    Оценок пока нет
  • FGHJ
    FGHJ
    Документ2 страницы
    FGHJ
    Ana Lopez
    Оценок пока нет
  • MP
    MP
    Документ3 страницы
    MP
    Ana Lopez
    Оценок пока нет
  • FR
    FR
    Документ3 страницы
    FR
    Ana Lopez
    Оценок пока нет
  • DRC
    DRC
    Документ5 страниц
    DRC
    Ana Lopez
    Оценок пока нет
  • Glo
    Glo
    Документ8 страниц
    Glo
    Ana Lopez
    Оценок пока нет
  • HC
    HC
    Документ4 страницы
    HC
    Ana Lopez
    Оценок пока нет
  • FGHJ
    FGHJ
    Документ2 страницы
    FGHJ
    Ana Lopez
    Оценок пока нет
  • NN
    NN
    Документ2 страницы
    NN
    Ana Lopez
    Оценок пока нет
  • GS
    GS
    Документ3 страницы
    GS
    Ana Lopez
    Оценок пока нет
  • Biological and Computer Vision Chapter2.en - Es
    Biological and Computer Vision Chapter2.en - Es
    Документ21 страница
    Biological and Computer Vision Chapter2.en - Es
    Ana Lopez
    Оценок пока нет
  • C-Arm Positioning Using Virtual Fluoroscopy - En.es
    C-Arm Positioning Using Virtual Fluoroscopy - En.es
    Документ6 страниц
    C-Arm Positioning Using Virtual Fluoroscopy - En.es
    Ana Lopez
    Оценок пока нет
  • FP
    FP
    Документ9 страниц
    FP
    Ana Lopez
    Оценок пока нет
  • Ana Maria Lopez Mirand Quiz
    Ana Maria Lopez Mirand Quiz
    Документ2 страницы
    Ana Maria Lopez Mirand Quiz
    Ana Lopez
    Оценок пока нет
  • Diseño e Implementacion de Una Herramienta Didactica de Software - v2.2
    Diseño e Implementacion de Una Herramienta Didactica de Software - v2.2
    Документ74 страницы
    Diseño e Implementacion de Una Herramienta Didactica de Software - v2.2
    Ana Lopez
    Оценок пока нет
  • Taller de Algoritmia y Programación I
    Taller de Algoritmia y Programación I
    Документ1 страница
    Taller de Algoritmia y Programación I
    laura bermuda
    0% (1)
  • Formato de Pedimento
    Formato de Pedimento
    Документ4 страницы
    Formato de Pedimento
    J Rocco Xlr
    Оценок пока нет
  • Documento - Técnico Sistema de Medidas
    Documento - Técnico Sistema de Medidas
    Документ36 страниц
    Documento - Técnico Sistema de Medidas
    Fernando Ramos
    Оценок пока нет
  • Proyecto Final
    Proyecto Final
    Документ13 страниц
    Proyecto Final
    Cristhian Berrocal
    Оценок пока нет
  • ENI Prácticas de LINUX, Comandos Básicos Ejercicios y Correcciones
    ENI Prácticas de LINUX, Comandos Básicos Ejercicios y Correcciones
    Документ205 страниц
    ENI Prácticas de LINUX, Comandos Básicos Ejercicios y Correcciones
    Ainara matias
    Оценок пока нет
  • Evaluación Del Software
    Evaluación Del Software
    Документ3 страницы
    Evaluación Del Software
    dewfewfwefewfew
    Оценок пока нет
  • Combinar Correspondencia
    Combinar Correspondencia
    Документ16 страниц
    Combinar Correspondencia
    Osvi Dgz
    Оценок пока нет
  • Programación I - Guía 1 - Introducción A La Programación
    Programación I - Guía 1 - Introducción A La Programación
    Документ8 страниц
    Programación I - Guía 1 - Introducción A La Programación
    Luis Eduardo Ramírez Carvajal
    Оценок пока нет
  • Jerko Zoccola Tarea 3
    Jerko Zoccola Tarea 3
    Документ18 страниц
    Jerko Zoccola Tarea 3
    Gonzalingonzalo
    Оценок пока нет
  • Configuración de Boteo
    Configuración de Boteo
    Документ6 страниц
    Configuración de Boteo
    miguel
    Оценок пока нет
  • Bits Bytes
    Bits Bytes
    Документ3 страницы
    Bits Bytes
    olunaf
    Оценок пока нет
  • Mapa Conceptual Automatización
    Mapa Conceptual Automatización
    Документ4 страницы
    Mapa Conceptual Automatización
    Juan Leonardo Medina Sanchez
    50% (2)
  • Brochure Corporativo
    Brochure Corporativo
    Документ8 страниц
    Brochure Corporativo
    Sergio Alexis Vargas Hernandez
    Оценок пока нет
  • Aa Requerimientos Técnicos Juegos Operados Internet - 5 Octubre 2022
    Aa Requerimientos Técnicos Juegos Operados Internet - 5 Octubre 2022
    Документ76 страниц
    Aa Requerimientos Técnicos Juegos Operados Internet - 5 Octubre 2022
    Jhony Reyes
    Оценок пока нет
  • Cómo Crear Gráficos Interactivos Dinámicos en Excel
    Cómo Crear Gráficos Interactivos Dinámicos en Excel
    Документ17 страниц
    Cómo Crear Gráficos Interactivos Dinámicos en Excel
    Inseguridad Asaltos
    Оценок пока нет
  • Gmail - CICLO DE CONFERENCIAS MAGISTRALES 19 - 06 - 2023
    Gmail - CICLO DE CONFERENCIAS MAGISTRALES 19 - 06 - 2023
    Документ3 страницы
    Gmail - CICLO DE CONFERENCIAS MAGISTRALES 19 - 06 - 2023
    MARCO GANTE
    Оценок пока нет
  • Tendencias Agilidad
    Tendencias Agilidad
    Документ8 страниц
    Tendencias Agilidad
    Andres Rodriguez Rubio
    Оценок пока нет
  • Fuente Del JVC
    Fuente Del JVC
    Документ1 страница
    Fuente Del JVC
    Sebastian Becker
    Оценок пока нет
  • Gastos Generales - Hoja Calculo Presa Redes
    Gastos Generales - Hoja Calculo Presa Redes
    Документ4 страницы
    Gastos Generales - Hoja Calculo Presa Redes
    HV Fico
    Оценок пока нет
  • RM N 259-2020-Minedu-24 PDF
    RM N 259-2020-Minedu-24 PDF
    Документ1 страница
    RM N 259-2020-Minedu-24 PDF
    Diana Noriega
    Оценок пока нет
  • Acumulado
    Acumulado
    Документ3 страницы
    Acumulado
    HUGO PACOTAYPE MEZA
    Оценок пока нет
  • FINAL Diseño Organizacional
    FINAL Diseño Organizacional
    Документ19 страниц
    FINAL Diseño Organizacional
    carlanatali
    Оценок пока нет
  • Pasos convertir archivos texto Excel caracteres
    Pasos convertir archivos texto Excel  caracteres
    Документ4 страницы
    Pasos convertir archivos texto Excel caracteres
    Yemsy Arratia Aquino
    Оценок пока нет
  • Memorándum Como Reducir El Consumo de Datos Con Los Comunicadores de La Serie G16 y G16T
    Memorándum Como Reducir El Consumo de Datos Con Los Comunicadores de La Serie G16 y G16T
    Документ4 страницы
    Memorándum Como Reducir El Consumo de Datos Con Los Comunicadores de La Serie G16 y G16T
    christian yelpo
    Оценок пока нет
  • Clase 12 IO Teoria de Colas Costos
    Clase 12 IO Teoria de Colas Costos
    Документ10 страниц
    Clase 12 IO Teoria de Colas Costos
    Gabriela
    Оценок пока нет
  • Mfit-29-23 09 Aplicacion de Pintura en Polvo
    Mfit-29-23 09 Aplicacion de Pintura en Polvo
    Документ9 страниц
    Mfit-29-23 09 Aplicacion de Pintura en Polvo
    Sebastian Resendiz
    Оценок пока нет
  • Programación Avanzada Python
    Programación Avanzada Python
    Документ5 страниц
    Programación Avanzada Python
    Gonzalo Naval
    Оценок пока нет
  • 2 5 Modelo de Carta de Referencia Personal 39
    2 5 Modelo de Carta de Referencia Personal 39
    Документ3 страницы
    2 5 Modelo de Carta de Referencia Personal 39
    Nini Johanna Celis Ospina
    Оценок пока нет
  • Identificando La Metodologia 1
    Identificando La Metodologia 1
    Документ5 страниц
    Identificando La Metodologia 1
    luz
    Оценок пока нет
  • Introducción: WWW - Freelibros.Me
    Introducción: WWW - Freelibros.Me
    Документ76 страниц
    Introducción: WWW - Freelibros.Me
    SINAI DE JESUS LEON CORTES
    Оценок пока нет