• 大小: 1.73MB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-01-04
  • 语言: 其他
  • 标签: STM32F407  HMC5883  I2C  

资源简介

利用STM32F407的I2C1(PB8、PB9),采集HMC5883的三个方向的磁场大小,计算相应的航向角,并在液晶屏上显示结果

资源截图

代码片段和文件信息


#include “stm32F407Tek_COM2.h“
#include “stm32f4xx_gpio.h“
#include “stm32f4xx_rcc.h“
#include “stm32f4xx_usart.h“
#include 
#include 
#include 

#define STR_BUF_SIZE 120

void STM32F407Tek_COM2_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOAENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2ENABLE);

GPIO_PinAFConfig(GPIOAGPIO_PinSource2GPIO_AF_USART2);
GPIO_PinAFConfig(GPIOAGPIO_PinSource3GPIO_AF_USART2);

GPIO_InitStructure.GPIO_Pin=GPIO_Pin_2;
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType=GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd=GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
GPI

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      35016  2014-01-02 17:22  STM32F407Tek_HMC5883-kdy20150820\FONT.H

     文件      75083  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\Listings\startup_stm32f40_41xxx.lst

     文件     196604  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\Listings\STM32F407Tek_HMC5883-kdy20150820.map

     文件         19  2015-08-20 15:35  STM32F407Tek_HMC5883-kdy20150820\objects\ExtDll.iex

     文件         62  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\startup_stm32f40_41xxx.d

     文件       8020  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\startup_stm32f40_41xxx.o

     文件     301560  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_com2.crf

     文件        876  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_com2.d

     文件     324964  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_com2.o

     文件     453436  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\STM32F407Tek_HMC5883-kdy20150820.axf

     文件       1812  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\STM32F407Tek_HMC5883-kdy20150820.build_log.htm

     文件      20579  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_hmc5883-kdy20150820.crf

     文件        607  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_hmc5883-kdy20150820.d

     文件     118354  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\STM32F407Tek_HMC5883-kdy20150820.htm

     文件        793  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\STM32F407Tek_HMC5883-kdy20150820.lnp

     文件      26208  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_hmc5883-kdy20150820.o

     文件        479  2015-08-20 13:07  STM32F407Tek_HMC5883-kdy20150820\objects\STM32F407Tek_HMC5883-kdy20150820.sct

     文件      11844  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\STM32F407Tek_HMC5883-kdy20150820_HMC5883.dep

     文件     299584  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_hmc5883.crf

     文件        821  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_hmc5883.d

     文件     324748  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_hmc5883.o

     文件     289799  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_led.crf

     文件        660  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_led.d

     文件     313408  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_led.o

     文件     312510  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_systick.crf

     文件        920  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_systick.d

     文件     338848  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_systick.o

     文件     325640  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_tft_lcd.crf

     文件        919  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_tft_lcd.d

     文件     418092  2015-08-20 21:48  STM32F407Tek_HMC5883-kdy20150820\objects\stm32f407tek_tft_lcd.o

............此处省略58个文件信息

评论

共有 条评论