📄 read_acquisitionadc.c
字号:
/**
* @file space_vector_PWM.c
*
* Copyright (c) 2004 Atmel.
*
* @brief Ce fichier permet de
*
* This file is included by all source files in order to access to system wide
* configuration.
* @version 1.0 (CVS revision : 1.2)
* @date 2006/03/08 17:03:49 (created on 06/04/2004)
* @author raubree (created by Emmanuel David)
*****************************************************************************/
#include "config.h"
#include "inavr.h"
// speed measurement thanks to the ADC
S16 read_acquisition(void)
{
Union16 resultADC ;
LSB(resultADC) = ADCL ; // the ADC output has 10 bit resolution
MSB(resultADC) = ADCH ;
// convert from shifted code to 2's complement code
// when the ADC output is higher than 512, the measure is positive
// when the ADC output is lower then 512, the measure is negative
// if ( (resultADC.b[1] & 0x02) == 2) resultADC.b[1] &= 0x01 ;
// else resultADC.b[1] |= 0xFE ;
return (resultADC.w) ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -