⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pmsm_tables.h

📁 ATtiny261 461 861 这份资料介绍了执行Attiny261 461 861微控制器系列正弦波驱动三相无刷直流电动机霍尔传感器。
💻 H
字号:
/* This file has been prepared for Doxygen automatic documentation generation.*/
/*! \file *********************************************************************
 *
 * \brief
 *      Motor control tables.
 *
 *      This file contains the table definitions used for motor control.
 *
 * \par Application note:
 *      AVR447: Sinusoidal driving of three-phase permanent motor using
 *      ATtiny261/461/861.
 *
 * \par Documentation
 *      For comprehensive code documentation, supported compilers, compiler
 *      settings and supported devices see readme.html
 *
 * \author
 *      Atmel Corporation: http://www.atmel.com \n
 *      Support email: avr@atmel.com
 *
 * $Name: RELEASE_1_0 $
 * $Revision: 1.4 $
 * $RCSfile: PMSM_tables.h,v $
 * $Date: 2006/05/18 07:59:26 $  \n
 ******************************************************************************/

#ifndef _PMSM_TABLES_H_
#define _PMSM_TABLES_H_

#include "PMSM.h"
#include "stdint.h"


/*! \brief Sine wave modulation table
 *
 *  Table containing modulation values for all three phases.
 *  The table is organized as [U1, V1, W1, U2, V2, W2, ...]
 *  for forward driving, and [U1, W1, V1, U2, W2, V2, ...]
 *  for reverse driving.
 */
#if (SINE_TABLE_SIZE == SINE_TABLE_SIZE_LARGE)
__flash const uint8_t sineTable[SINE_TABLE_LENGTH * 3] = {
0,       0,      221,
8,       0,      225,
17,      0,      229,
25,      0,      232,
33,      0,      236,
42,      0,      239,
50,      0,      241,
58,      0,      244,
66,      0,      246,
74,      0,      248,
82,      0,      250,
90,      0,      252,
98,      0,      253,
105,     0,      254,
113,     0,      254,
120,     0,      255,
128,     0,      255,
135,     0,      255,
142,     0,      254,
149,     0,      254,
155,     0,      253,
162,     0,      252,
168,     0,      250,
174,     0,      248,
180,     0,      246,
186,     0,      244,
192,     0,      241,
197,     0,      239,
202,     0,      236,
207,     0,      232,
212,     0,      229,
217,     0,      225,
221,     0,      221,
225,     0,      217,
229,     0,      212,
232,     0,      207,
236,     0,      202,
239,     0,      197,
241,     0,      192,
244,     0,      186,
246,     0,      180,
248,     0,      174,
250,     0,      168,
252,     0,      162,
253,     0,      155,
254,     0,      149,
254,     0,      142,
255,     0,      135,
255,     0,      127,
255,     0,      120,
254,     0,      113,
254,     0,      105,
253,     0,      98,
252,     0,      90,
250,     0,      82,
248,     0,      74,
246,     0,      66,
244,     0,      58,
241,     0,      50,
239,     0,      42,
236,     0,      33,
232,     0,      25,
229,     0,      17,
225,     0,      8,
221,     0,      0,
225,     8,      0,
229,     17,     0,
232,     25,     0,
236,     33,     0,
239,     42,     0,
241,     50,     0,
244,     58,     0,
246,     66,     0,
248,     74,     0,
250,     82,     0,
252,     90,     0,
253,     98,     0,
254,     105,    0,
254,     113,    0,
255,     120,    0,
255,     127,    0,
255,     135,    0,
254,     142,    0,
254,     149,    0,
253,     155,    0,
252,     162,    0,
250,     168,    0,
248,     174,    0,
246,     180,    0,
244,     186,    0,
241,     192,    0,
239,     197,    0,
236,     202,    0,
232,     207,    0,
229,     212,    0,
225,     217,    0,
221,     221,    0,
217,     225,    0,
212,     229,    0,
207,     232,    0,
202,     236,    0,
197,     239,    0,
192,     241,    0,
186,     244,    0,
180,     246,    0,
174,     248,    0,
168,     250,    0,
162,     252,    0,
155,     253,    0,
149,     254,    0,
142,     254,    0,
135,     255,    0,
128,     255,    0,
120,     255,    0,
113,     254,    0,
105,     254,    0,
98,      253,    0,
90,      252,    0,
82,      250,    0,
74,      248,    0,
66,      246,    0,
58,      244,    0,
50,      241,    0,
42,      239,    0,
33,      236,    0,
25,      232,    0,
17,      229,    0,
8,       225,    0,
0,       221,    0,
0,       225,    8,
0,       229,    17,
0,       232,    25,
0,       236,    33,
0,       239,    42,
0,       241,    50,
0,       244,    58,
0,       246,    66,
0,       248,    74,
0,       250,    82,
0,       252,    90,
0,       253,    98,
0,       254,    105,
0,       254,    113,
0,       255,    120,
0,       255,    128,
0,       255,    135,
0,       254,    142,
0,       254,    149,
0,       253,    155,
0,       252,    162,
0,       250,    168,
0,       248,    174,
0,       246,    180,
0,       244,    186,
0,       241,    192,
0,       239,    197,
0,       236,    202,
0,       232,    207,
0,       229,    212,
0,       225,    217,
0,       221,    221,
0,       217,    225,
0,       212,    229,
0,       207,    232,
0,       202,    236,
0,       197,    239,
0,       192,    241,
0,       186,    244,
0,       180,    246,
0,       174,    248,
0,       168,    250,
0,       162,    252,
0,       155,    253,
0,       149,    254,
0,       142,    254,
0,       135,    255,
0,       128,    255,
0,       120,    255,
0,       113,    254,
0,       105,    254,
0,       98,     253,
0,       90,     252,
0,       82,     250,
0,       74,     248,
0,       66,     246,
0,       58,     244,
0,       50,     241,
0,       42,     239,
0,       33,     236,
0,       25,     232,
0,       17,     229,
0,       8,      225
};

#elif (SINE_TABLE_SIZE == SINE_TABLE_SIZE_SMALL)

__flash const uint8_t sineTable[SINE_TABLE_LENGTH / 3] = {
0,      8,      17,     25,     33,     42,     50,     58,
66,     74,     82,     90,     98,     105,    113,    120,
128,    135,    142,    149,    155,    162,    168,    174,
180,    186,    192,    197,    202,    207,    212,    217,
221,    225,    229,    232,    236,    239,    241,    244,
246,    248,    250,    252,    253,    254,    254,    255,
255,    255,    254,    254,    253,    252,    250,    248,
246,    244,    241,    239,    236,    232,    229,    225
};
#endif


/*! \brief Block commutation Output Compare Override Enable masks.
 *
 *  This array contains Output Compare Override Enable masks for block
 *  commutation when running in the forward direction.
 */
uint8_t __flash const blockCommutationTableForward[8] =
{
  0x00,
  ((1 << WH_OCOE) | (1 << UL_OCOE)),
  ((1 << UH_OCOE) | (1 << VL_OCOE)),
  ((1 << WH_OCOE) | (1 << VL_OCOE)),
  ((1 << VH_OCOE) | (1 << WL_OCOE)),
  ((1 << VH_OCOE) | (1 << UL_OCOE)),
  ((1 << UH_OCOE) | (1 << WL_OCOE)),
  0x00
};


/*! \brief Block commutation Output Compare Override Enable masks.
 *
 *  This array contains Output Compare Override Enable masks for block
 *  commutation when running in the reverse direction.
 */
uint8_t __flash const blockCommutationTableReverse[8] =
{
  0x00,
  ((1 << UH_OCOE) | (1 << WL_OCOE)),
  ((1 << VH_OCOE) | (1 << UL_OCOE)),
  ((1 << VH_OCOE) | (1 << WL_OCOE)),
  ((1 << WH_OCOE) | (1 << VL_OCOE)),
  ((1 << UH_OCOE) | (1 << VL_OCOE)),
  ((1 << WH_OCOE) | (1 << UL_OCOE)),
  0x00
};


/*! \brief Table of next expected hall sensor value when running forward.
 *
 *  This array contains the next expected hall sensor value when
 *  running in the forward direction. The value at the index pointed
 *  to by the current hall sensor value is the next expected hall
 *  sensor value in the forward direction.
 */
__flash const uint8_t expectedHallSequenceForward[8] =
{
  0xff,    3,    6,    2,    5,    1,    4,   0xff
};


/*! \brief Table of next expected hall sensor value when running in the reverse direction.
 *
 *  This array contains the next expected hall sensor value when
 *  running in the reverse direction. The value at the index pointed
 *  to by the current hall sensor value is the next expected hall
 *  sensor value in the reverse direction.
 */
__flash const uint8_t expectedHallSequenceReverse[8] =
{
  0xff,    5,    3,    1,    6,    4,    2,   0xff
};


/*! \brief Sine table offset values corresponding to hall sensor values when running in the forward direction.
 *
 *  This array contains the sine table offset that corresponds to
 *  the hall sensor values when running in the forward direction.
 *  At the moment of a hall change, using the new hall sensor value
 *  as index into this table returns the sine table offset that will
 *  synchronize the generated sine waves to the back-EMF of the motor.
 */
__flash const uint16_t CSOffsetsForward[8] =
{
  0,
  5 * (SINE_TABLE_LENGTH / 6),
  1 * (SINE_TABLE_LENGTH / 6),
  0 * (SINE_TABLE_LENGTH / 6),
  3 * (SINE_TABLE_LENGTH / 6),
  4 * (SINE_TABLE_LENGTH / 6),
  2 * (SINE_TABLE_LENGTH / 6),
  0
};


/*! \brief Sine table offset values corresponding to hall sensor values when running in the reverse direction.
 *
 *  This array contains the sine table offset that corresponds to
 *  the hall sensor values when running in the reverse direction.
 *  At the moment of a hall change, using the new hall sensor value
 *  as index into this table returns the sine table offset that will
 *  synchronize the generated sine waves to the back-EMF of the motor.
 */
__flash const uint16_t CSOffsetsReverse[8] =
{
  0,
  1 * (SINE_TABLE_LENGTH / 6),
  5 * (SINE_TABLE_LENGTH / 6),
  0 * (SINE_TABLE_LENGTH / 6),
  3 * (SINE_TABLE_LENGTH / 6),
  2 * (SINE_TABLE_LENGTH / 6),
  4 * (SINE_TABLE_LENGTH / 6),
  0
};


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -