初级会员
- 积分
- 60
- 金钱
- 60
- 注册时间
- 2016-1-11
- 在线时间
- 12 小时
|
楼主 |
发表于 2023-1-5 17:28:17
|
显示全部楼层
#include "main.h"
#include "stm32f10x.h"
#include "fram.h"
uint16_t USART_Scan=0;
int main(void)
{
float fAcc[3],xy,ReadData;//¶¨òåèyλshortêy×飬′æ·Å¼óËù¶èêy¾Y
SysTick_Config(7200);//0.1ms
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //ÖD¶Ï·Ö×éÅäÖÃ
USART1_Init(9600);
// USART2_Init(9600);
delay_ms(2000);
ADXL375_Init( 0X00); //ê1óÃMoudbusÄ£ÄaSPI½«′«¸DÆ÷½øDD3õê¼»ˉ
//′«¸DÆ÷3õê¼»ˉ3é1|½«·μ»ØSensor xx Init Success
while(1)
{
if(USART_Scan) //¶¨ê±2é¼ˉ£¬2é¼ˉê±¼ä100ms£¬ê1óÃÏμí3¶¨ê±Æ÷½øDD¶¨ê±
{
ADXL375_GetData( 0X00 , fAcc); //ê1óÃMoudbus¶áè¡′«¸DÆ÷¼óËù¶è£¬2¢′òó¡
printf("ACC:%.2f %.2f %.2f",fAcc[0],fAcc[1],fAcc[2]);
USART_Scan=0;
}
}
MB_CS_L;
SPIx_ReadWriteByte(0x06); //???????
MB_CS_H;
//delay_ms(1);
MB_CS_L;
SPIx_ReadWriteByte(0x01); //???????
xy = SPIx_ReadWriteByte(0x80);
MB_CS_H;
SPI_write_MB85RS256A(16,16);
ReadData=SPI_read_MB85RS256A(16);
}
|
|