AMS AS5048 Eval-Kit 사용자 설명서 - 페이지 10

{카테고리_이름} AMS AS5048 Eval-Kit에 대한 사용자 설명서을 온라인으로 검색하거나 PDF를 다운로드하세요. AMS AS5048 Eval-Kit 12 페이지. 14-bit rotary position sensor with digital angle (interface) and pwm output
AMS AS5048 Eval-Kit에 대해서도 마찬가지입니다: 키트 매뉴얼 (16 페이지), 운영 매뉴얼 (10 페이지)

User Manual – AS5048-AB
dat
= SPI_CMD_READ | SPI_REG_CLRERR;
dat |= spiCalcEvenParity(dat)<<15;
spiTransfer((u8*)&dat, sizeof(u16));
}
else
{
agc = agcreg & 0xff
value = dat & (16384 - 31 - 1);
angle = (value * 360) / 16384
(0..359.9°)
magnitude = magreg & (16384 - 31 - 1);
alarmLo = (agcreg >> 10) & 0x1;
alarmHi = (agcreg >> 11) & 0x1;
}
}
/*!
*****************************************************************************
*
Calculate even parity of a 16 bit unsigned integer
*
*
This function is used by the SPI interface to calculate the even parity
*
of the data which will be sent via SPI to the encoder.
*
*
\param[in] value : 16 bit unsigned integer whose parity shall be calculated
*
*
\return : Even parity
*
*****************************************************************************
*/
static
u8 spiCalcEvenParity(ushort value)
{
u8 cnt = 0;
u8 i;
for
(i = 0; i < 16; i++)
{
if
(value & 0x1)
{
cnt++;
}
value >>= 1;
}
return
cnt & 0x1;
}
/*!
*****************************************************************************
*
Calculate even parity of a 16 bit unsigned integer
*
*
This function is used by the SPI interface to calculate the even parity
*
of the data which will be sent via SPI to the encoder.
*
*
\param[in] value : 16 bit unsigned integer whose parity shall be calculated
*
*
\return : Even parity
*
*****************************************************************************
*/
static
u8 spiCalcEvenParity(ushort value)
{
u8 cnt = 0;
u8 i;
for
(i = 0; i < 16; i++)
{
if
(value & 0x1)
{
cnt++;
}
value >>= 1;
}
return
cnt & 0x1;
}
www.ams.com
// AGC value (0..255)
// Angle value (0.. 16384 steps)
Revision 1.2 / 14.01.2014
// Angle value in degree
page 10/12