Motor Evaluation Kit
NEVC-MCTRL-100-t01-1.0.0
Firmware for NEVB-MCTRL-100-01 for trapezoidal control of BLDC motors using Hall-effect sensors
Loading...
Searching...
No Matches
tables.h
Go to the documentation of this file.
1
/* This file has been prepared for Doxygen automatic documentation generation. */
22
#ifndef _TABLES_H_
23
#define _TABLES_H_
24
26
#define __AVR_ATmega32U4__ 1
27
28
// Include main Arduino library for basic Arduino functions
29
#include <Arduino.h>
30
31
// Include standard integer type definitions
32
#include <stdint.h>
33
34
#ifdef __INTELLISENSE__
35
#define PROGMEM
36
#else
37
#include <avr/pgmspace.h>
38
#endif
39
#include "
main.h
"
40
80
const
uint8_t
blockCommutationTableForward
[32] PROGMEM =
81
{
82
0, 0, 0, 0,
83
(1 <<
AL_PIN
), (0 <<
BL_PIN
), (0 <<
CL_PIN
),
OC_ENABLE_PORTD
,
// UL, WH // AL, CH // AL, CH
84
(0 <<
AL_PIN
), (1 <<
BL_PIN
), (0 <<
CL_PIN
),
OC_ENABLE_PORTB
,
// UH, VL // AH, BL // CL, BH
85
(0 <<
AL_PIN
), (1 <<
BL_PIN
), (0 <<
CL_PIN
),
OC_ENABLE_PORTD
,
// VL, WH // BL, CH // AL, BH
86
(0 <<
AL_PIN
), (0 <<
BL_PIN
), (1 <<
CL_PIN
),
OC_ENABLE_PORTC
,
// VH, WL // BH, CL // BL, AH
87
(1 <<
AL_PIN
), (0 <<
BL_PIN
), (0 <<
CL_PIN
),
OC_ENABLE_PORTC
,
// UL, VH // AL, BH // BL, CH
88
(0 <<
AL_PIN
), (0 <<
BL_PIN
), (1 <<
CL_PIN
),
OC_ENABLE_PORTB
,
// UH, WL // AH, CL // CL, AH
89
0, 0, 0, 0};
90
128
const
uint8_t
blockCommutationTableReverse
[32] PROGMEM =
129
{
130
0, 0, 0, 0,
131
(0 <<
AL_PIN
), (0 <<
BL_PIN
), (1 <<
CL_PIN
),
OC_ENABLE_PORTB
,
// UH, WL // AH, CL // CL, AH
132
(1 <<
AL_PIN
), (0 <<
BL_PIN
), (0 <<
CL_PIN
),
OC_ENABLE_PORTC
,
// UL, VH // AL, BH // BL, CH
133
(0 <<
AL_PIN
), (0 <<
BL_PIN
), (1 <<
CL_PIN
),
OC_ENABLE_PORTC
,
// VH, WL // BH, CL // BL, AH
134
(0 <<
AL_PIN
), (1 <<
BL_PIN
), (0 <<
CL_PIN
),
OC_ENABLE_PORTD
,
// VL, WH // BL, CH // AL, BH
135
(0 <<
AL_PIN
), (1 <<
BL_PIN
), (0 <<
CL_PIN
),
OC_ENABLE_PORTB
,
// UH, VL // AH, BL // CL, BH
136
(1 <<
AL_PIN
), (0 <<
BL_PIN
), (0 <<
CL_PIN
),
OC_ENABLE_PORTD
,
// UL, WH // AL, CH // AL, CH
137
0, 0, 0, 0};
138
149
const
uint8_t
expectedHallSequenceForward
[7] PROGMEM =
150
{
151
0xff, 3, 6, 2, 5, 1, 4};
152
163
const
uint8_t
expectedHallSequenceReverse
[7] PROGMEM =
164
{
165
0xff, 5, 3, 1, 6, 4, 2};
166
167
#endif
/* _TABLES_H_ */
CL_PIN
#define CL_PIN
PIN where low side gate PWM for phase C is connected.
Definition
main.h:554
AL_PIN
#define AL_PIN
PIN where low side gate PWM for phase A is connected.
Definition
main.h:550
BL_PIN
#define BL_PIN
PIN where low side gate PWM for phase B is connected.
Definition
main.h:552
OC_ENABLE_PORTB
#define OC_ENABLE_PORTB
Definition
main.h:565
OC_ENABLE_PORTC
#define OC_ENABLE_PORTC
Definition
main.h:568
OC_ENABLE_PORTD
#define OC_ENABLE_PORTD
Definition
main.h:571
main.h
Motor control header file.
expectedHallSequenceReverse
const uint8_t expectedHallSequenceReverse[7]
Table of Expected Hall Sensor Values in Reverse Direction.
Definition
tables.h:163
expectedHallSequenceForward
const uint8_t expectedHallSequenceForward[7]
Table of Expected Hall Sensor Values in Forward Direction.
Definition
tables.h:149
blockCommutationTableReverse
const uint8_t blockCommutationTableReverse[32]
Block Commutation Port Direction Masks for Reverse Driving.
Definition
tables.h:128
blockCommutationTableForward
const uint8_t blockCommutationTableForward[32]
Block Commutation Port Direction Masks for Forward Driving.
Definition
tables.h:80
tables.h
Generated by
1.10.0