Definition in file motor.h.
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Defines | |
#define | ADC_PHASE1 ((1 << REFS0) | (1 << ADLAR) | (1 << MUX1) | (0 << MUX0)) |
ADMUX setting for measurement over phase 1 windings. | |
#define | ADC_PHASE2 ((1 << REFS0) | (1 << ADLAR) | (1 << MUX1) | (1 << MUX0)) |
ADMUX setting for measurement over phase 2 windings. | |
#define | ADC_PRESCALER ((0 << ADPS2) | (1 << ADPS1) | (1 << ADPS0)) |
Selects ADC prescaler. | |
#define | ADC_SPEED_REF ((1 << REFS0) | (1 << ADLAR) | (0 << MUX1) | (1 << MUX0)) |
ADMUX setting for measurement of external speed reference. | |
#define | ADC_THRESHOLD 0x78 |
ADC value of the threshold used to detect a zero-crossing. | |
#define | ADC_WAIT_TICKS 50 |
Number of ticks to wait after a commutation before a new zero-crossing can be detected. | |
#define | COMMUTATIONS_PER_REV 4UL |
Number of commutations per mechanical revolution. | |
#define | CRITICALLY_LOW_RPM 500UL |
The lowest speed where sensorless commutation can be expected to work reliably. | |
#define | CRITICALLY_LOW_RPM_TICKS (RPM2COMM_TICKS(CRITICALLY_LOW_RPM)) |
The number of ticks corresponding to critically low speed. | |
#define | MAX_OCR_VALUE 0xff |
The maximum allowed OCR value. | |
#define | MAX_RPM 2800UL |
Maximum rated speed of the motor. | |
#define | MAX_RPM_TICKS (RPM2COMM_TICKS(MAX_RPM)) |
The number of ticks corresponding to max. speed. | |
#define | MILLISEC_NUM_CYCLES (SYS_FREQ / 1000U) |
Number of clock cycles per second. | |
#define | MIN_OCR_VALUE 0x01 |
The minimum allowed OCR value. | |
#define | MIN_RPM 550UL |
Minimum speed of the motor. | |
#define | MIN_RPM_TICKS (RPM2COMM_TICKS(MIN_RPM)) |
The number of ticks corresponding to min. speed. | |
#define | PHASE1 0 |
Phase 1 state variable. | |
#define | PHASE2 1 |
Phase 2 state variable. | |
#define | PWM_OFF ((0 << COM0A1) | (0 << COM0A0) | (0 << COM0B1) | (0 << COM0B0) | (0<<WGM01) | (1<<WGM00)) |
TCCR0A setting when no windings are active. | |
#define | PWM_PHASE1 ((1 << COM0A1) | (0 << COM0A0) | (0 << COM0B1) | (0 << COM0B0) | (0<<WGM01) | (1<<WGM00)) |
TCCR0A setting when phase 1 is active. | |
#define | PWM_PHASE2 ((0 << COM0A1) | (0 << COM0A0) | (1 << COM0B1) | (0 << COM0B0) | (0<<WGM01) | (1<<WGM00)) |
TCCR0A setting when phase 2 is active. | |
#define | ROTOR_LOCK_RAMPDOWN_DELAY_MS 1U |
The delay in milliseconds between each decrease of duty cycle after startup locking. | |
#define | ROTOR_LOCK_RAMPUP_DELAY_MS 5U |
The delay in milliseconds between each increase of duty cycle during startup locking. | |
#define | ROTOR_STABILIZATION_TIME_MS 1800U |
Time to wait for rotor to stabilize after first phase excitation. | |
#define | RPM2COMM_TICKS(RPM) (unsigned int)(SYS_FREQ / ((RPM * TICK_NUM_CYCLES * COMMUTATIONS_PER_REV) / 60)) |
Macro that converts speed (RPM) to ticks. | |
#define | SET_DUTY_BOTH_PHASES(duty) (OCR0A = OCR0B = (duty)) |
Sets the duty cycle of both phases. | |
#define | SET_DUTY_PHASE1(duty) (OCR0A = (duty)) |
Tacho signal output selection flag.Sets the duty cycle of phase 1. | |
#define | SET_DUTY_PHASE2(duty) (OCR0B = (duty)) |
Sets the duty cycle of phase 2. | |
#define | SYS_FREQ 9600000UL |
System clock frequency. | |
#define | TICK_NUM_CYCLES (510UL) |
The number of clock cycles in 1 "Tick". | |
#define | WINDING1_PIN PB0 |
Pin where phase 1 winding is connected. | |
#define | WINDING2_PIN PB1 |
Pin where phase 1 winding is connected. |
|
ADMUX setting for measurement over phase 1 windings. This parameter specifies the full contents of the ADMUX register for reading the voltage over phase 1 windings. Definition at line 174 of file motor.h. Referenced by Timer0_Overflow_ISR(). |
|
ADMUX setting for measurement over phase 2 windings. This parameter specifies the full contents of the ADMUX register for reading the voltage over phase 2 windings. Definition at line 181 of file motor.h. Referenced by Timer0_Overflow_ISR(). |
|
Selects ADC prescaler.
|
|
ADMUX setting for measurement of external speed reference. This parameter specifies the full contents of the ADMUX register for reading the external speed reference. Definition at line 188 of file motor.h. Referenced by Timer0_Overflow_ISR(). |
|
ADC value of the threshold used to detect a zero-crossing. This parameter specifies ADC value of the threshold used to detect a zero-crossing. Adjusting this parameter changes the precise instant of commutation. A higher threshold generally results in an earlier commutation. Definition at line 212 of file motor.h. Referenced by Timer0_Overflow_ISR(). |
|
Number of ticks to wait after a commutation before a new zero-crossing can be detected. This parameter specifies the number of ticks to wait after a commutation, before the ADC value will be used to detect a new zero-cross. Definition at line 204 of file motor.h. Referenced by Timer0_Overflow_ISR(). |
|
Number of commutations per mechanical revolution. The number of commutations per mechanical revolution. |
|
The lowest speed where sensorless commutation can be expected to work reliably. This parameter specifies the lowest speed where sensorless commutation can be expected to work reliably. In this implementation, the duty cycle is increased to 100% if the speed is below this limit. |
|
The number of ticks corresponding to critically low speed.
|
|
The maximum allowed OCR value. This is the maximum value that can be written to OCR0A/B. This determines the maximum duty cycle. (Duty cycle = OCR0A/B val / 255). A value of 0xff (255) equals max. 100% duty cycle. |
|
Maximum rated speed of the motor. This parameter specifies the maximum rated speed of the motor. |
|
The number of ticks corresponding to max. speed.
Definition at line 120 of file motor.h. Referenced by Timer0_Overflow_ISR(). |
|
Number of clock cycles per second. The number of clock cycles per second. This is used for the timed sequence in the motor startup routine. |
|
The minimum allowed OCR value. This is the minimum value that can be written to OCR0A/B. This determines the minimum duty cycle. (Duty cycle = OCR0A/B val / 255). |
|
Minimum speed of the motor. This parameter specifies the minimum speed the motor should be operated at. The motor must be able to operate with sensorless commutation at this speed. It is recommended that a safety margin is put in, such that the motor can operate with sensorless commutation for even lower speeds. |
|
The number of ticks corresponding to min. speed.
|
|
Phase 1 state variable.
Definition at line 194 of file motor.h. Referenced by Timer0_Overflow_ISR(). |
|
Phase 2 state variable.
Definition at line 197 of file motor.h. Referenced by Timer0_Overflow_ISR(). |
|
TCCR0A setting when no windings are active. This parameter specifies the full contents of the TCCR0A register when no windings are active. Definition at line 167 of file motor.h. Referenced by Timer0_Overflow_ISR(). |
|
TCCR0A setting when phase 1 is active. This parameter specifies the full contents of the TCCR0A register when phase 1 is active. This should only be changed if winding 1 is connected to a different pin than PB0. Definition at line 151 of file motor.h. Referenced by Timer0_Overflow_ISR(). |
|
TCCR0A setting when phase 2 is active. This parameter specifies the full contents of the TCCR0A register when phase 2 is active. This should only be changed if winding 1 is connected to a different pin than PB1. Definition at line 160 of file motor.h. Referenced by Timer0_Overflow_ISR(). |
|
The delay in milliseconds between each decrease of duty cycle after startup locking.
|
|
The delay in milliseconds between each increase of duty cycle during startup locking.
|
|
Time to wait for rotor to stabilize after first phase excitation. This is the time, in milliseconds, to wait for the rotor to stabilize after the first phase excitation. This parameter will be different for different kinds of motors. |
|
Macro that converts speed (RPM) to ticks. This macro converts a speed given mechanical revolutions per minute (RPM) to the number of ticks between commutations at this speed.
|
|
Sets the duty cycle of both phases. This macro sets the duty cycle of both phases.
Definition at line 253 of file motor.h. Referenced by main(). |
|
Tacho signal output selection flag.Sets the duty cycle of phase 1. This macro sets the duty cycle of phase 1.
|
|
Sets the duty cycle of phase 2. This macro sets the duty cycle of phase 2.
|
|
System clock frequency. This is the system clock frequency in Hz. Several parameters depends on the correct setting of this parameter. |
|
The number of clock cycles in 1 "Tick". This parameter describes the number of clock cycles that passes during 1 "Tick". (Between two timer overflow interrups.) In phase correct mode, the counter counts from 0 to 255 to 0, then overflows. |
|
Pin where phase 1 winding is connected. This defines the pin where the phase 1 winding is connected. If it is connected to another pin, change both this value and PWM_PHASE1 must be changed. |
|
Pin where phase 1 winding is connected. This defines the pin where the phase 2 winding is connected. If it is connected to another pin, change both this value and PWM_PHASE2 must be changed. |