你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

STm32F3的MEMS的测试

[复制链接]
瑟瑟秋风 提问时间:2013-3-29 21:21 /
 #include "stm32f30x.h"
#include "stm32f3_discovery_lsm303dlhc.h"
#define   uchar unsigned char
#define   uint unsigned int       
uchar ge,shi,bai,qian,wan,shiwan;           //????
 
 
unsigned char  Buffer[6];
unsigned char XOffset;
unsigned char  YOffset;
static void USART_Config(void)

  USART_InitTypeDef USART_InitStructure;
  GPIO_InitTypeDef GPIO_InitStructure; 
  
  /* Enable GPIOD clock */
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC|RCC_AHBPeriph_GPIOE , ENABLE);
  
  /* Enable USART1 APB clock */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
  
  /* Configure the HSI as USART clock */
  RCC_USARTCLKConfig(RCC_USART1CLK_HSI);
  
  /* USART1 Pins configuration ***********************************************/
 
  /* Connect pin to Periph */
  GPIO_PinAFConfig(GPIOC, GPIO_PinSource4, GPIO_AF_7);    
  GPIO_PinAFConfig(GPIOE, GPIO_PinSource1, GPIO_AF_7); 
  
  /* Configure pins as AF pushpull */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  GPIO_Init(GPIOC, &GPIO_InitStructure); 
  
   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
   GPIO_Init(GPIOE, &GPIO_InitStructure);
   
  /* USARTx configured as follow:
  - BaudRate = 115200 baud  
  - Word Length = 8 Bits
  - Stop Bit = 1 Stop Bit
  - Parity = No Parity
  - Hardware flow control disabled (RTS and CTS signals)
  - Receive and transmit enabled
  */
  
  USART_DeInit(USART1);
  USART_InitStructure.USART_BaudRate = 115200;
  USART_InitStructure.USART_WordLength = USART_WordLength_8b;
  USART_InitStructure.USART_StopBits = USART_StopBits_1;
  USART_InitStructure.USART_Parity = USART_Parity_No;
  USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
  USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
  USART_Init(USART1, &USART_InitStructure);
  
 
  
  /* Enable USART1 */ 
  USART_Cmd(USART1, ENABLE);
  
  /* Before entering the USART in STOP mode the REACK flag must be checked to ensure the USART RX is ready */
  while(USART_GetFlagStatus(USART1, USART_FLAG_REACK) == RESET)
  {}
  
  /* Enable USART STOP mode by setting the UESM bit in the CR1 register.*/
//  USART_STOPModeCmd(USART1, ENABLE);
  
  /* Enable the wake up from stop Interrupt */ 
//  USART_ITConfig(USART1, USART_IT_WU, ENABLE);   
  
  /* Enter USART in STOP mode with regulator in low power mode */
//  PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
  
}
 
void conversion(long temp_data)  
{     
    shiwan=temp_data/100000+0x30 ;
    temp_data=temp_data%100000;   //???? 
    wan=temp_data/10000+0x30 ;
    temp_data=temp_data%10000;   //????
        qian=temp_data/1000+0x30 ;
    temp_data=temp_data%1000;    //????
    bai=temp_data/100+0x30   ;
    temp_data=temp_data%100;     //????
    shi=temp_data/10+0x30    ;
    temp_data=temp_data%10;      //????
    ge=temp_data+0x30;        
}
 void Delayms(vu32 m)
{
  u32 i;
  
  for(; m != 0; m--)       
       for (i=0; i
收藏 评论1 发布时间:2013-3-29 21:21

举报

1个回答
zykzyk-93033 回答时间:2013-3-29 21:59:12

RE:STm32F3的MEMS的测试

能不能加点说明呢比较好吧

所属标签

相似问题

关于意法半导体
我们是谁
投资者关系
意法半导体可持续发展举措
创新和工艺
招聘信息
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
关注我们
st-img 微信公众号
st-img 手机版