初级会员

- 积分
- 53
- 金钱
- 53
- 注册时间
- 2016-4-3
- 在线时间
- 15 小时
|
发表于 2016-4-21 10:46:12
|
显示全部楼层
void TIM3_IRQHandler(void)
{
u8 t=0;
short aacx,aacy,aacz; //加速度传感器原始数据
short gyrox,gyroy,gyroz; //陀螺仪原始数据
short temp; //温度
time++;
if(time>=1000000) time = 0;
if(TIM_GetITStatus(TIM3,TIM_IT_Update)==SET) //溢出中断
{
TIM_ClearITPendingBit(TIM3,TIM_IT_Update); //清除中断标志位
if(mpu_dmp_get_data(&pitch,&roll,&yaw)==0)
{
// temp=MPU_Get_Temperature(); //得到温度值
// MPU_Get_Accelerometer(&aacx,&aacy,&aacz); //得到加速度传感器数据
MPU_Get_Gyroscope(&gyrox,&gyroy,&gyroz); //得到陀螺仪数据
if((t%10)==0)
{
// if(temp<0)
// {
// LCD_ShowChar(30+48,200,'-',16,0); //显示负号
// temp=-temp; //转为正数
// }else LCD_ShowChar(30+48,200,' ',16,0); //去掉负号
// LCD_ShowNum(30+48+8,200,temp/100,3,16); //显示整数部分
// LCD_ShowNum(30+48+40,200,temp%10,1,16); //显示小数部分
// temp=pitch*10;
// if(temp<0)
// {
// LCD_ShowChar(30+48,220,'-',16,0); //显示负号
// temp=-temp; //转为正数
// }else LCD_ShowChar(30+48,220,' ',16,0); //去掉负号
// LCD_ShowNum(30+48+8,220,temp/10,3,16); //显示整数部分
// LCD_ShowNum(30+48+40,220,temp%10,1,16); //显示小数部分
// temp=roll*10;
// if(temp<0)
// {
// LCD_ShowChar(30+48,240,'-',16,0); //显示负号
// temp=-temp; //转为正数
// }else LCD_ShowChar(30+48,240,' ',16,0); //去掉负号
// LCD_ShowNum(30+48+8,240,temp/10,3,16); //显示整数部分
// LCD_ShowNum(30+48+40,240,temp%10,1,16); //显示小数部分
temp=yaw*10;
if(temp<0)
{
LCD_ShowChar(30+48,260,'-',16,0); //显示负号
temp=-temp; //转为正数
}else LCD_ShowChar(30+48,260,' ',16,0); //去掉负号
LCD_ShowNum(30+48+8,260,temp/10,3,16); //显示整数部分
LCD_ShowNum(30+48+40,260,temp%10,1,16); //显示小数部分
t=0;
}
}
t++;
}
} |
|