AMS AS5048 Eval-Kit Manuel du kit - Page 10

Parcourez en ligne ou téléchargez le pdf Manuel du kit pour {nom_de_la_catégorie} AMS AS5048 Eval-Kit. AMS AS5048 Eval-Kit 16 pages. 14-bit rotary position sensor with digital angle (interface) and pwm output
Également pour AMS AS5048 Eval-Kit : Manuel d'utilisation (10 pages), Manuel de l'utilisateur (12 pages)

AS5048 Adapter Board
5

Software example source code

The following source code shows a 4-wire SPI application case.
/*!
*****************************************************************************
*
\brief
Reads out chip data via SPI interface
*
*
This function is used to read out cordic value from chips supporting SPI
*
interface.
*
After calling this function the data can be displayed using #displayData.
*
*
\param[in] die : index of the die to read out.
*
\param[out] dd : Buffer of type #t_displayData where the read out data
*
will be written to.
*
*****************************************************************************
*/
static void
spiReadData(u8
{
umword
i;
u16
dat;
u16
agcreg;
#ifdef
AS5048_CHIPDESCRIPTION
u16 magreg;
#endif
PARAMETER_UNUSED(die);
dd->angleprec
= 0;
/* read agc value */
for
(i = 0; i < 2; i++)
{
/* the result is available only just in the second transfer.
transfers must be separated by chip selects */
dat
= SPI_CMD_READ | SPI_REG_AGC;
dat |= spiCalcEvenParity(dat);
spiTransfer((u8*)&dat, sizeof(u16));
}
agcreg = dat;
#ifdef
AS5048_CHIPDESCRIPTION
for
(i = 0; i < 2; i++)
{
/* the result is available only just in the second transfer.
transfers must be separated by chip selects */
dat
= SPI_CMD_READ | SPI_REG_MAG;
ams Eval Kit Manual, Confidential
[v1-3] 2014-Aug-01
die,
t_displayData
* dd)
Page 10
Document Feedback