▲쿼드콥터용 Brushless Motor 드라이버 AN899 와 PIC18FXX31 MCU를 이용한 자료입니다.
참고로 Assembly 코드로 씌여있고, 혹시 C언어로 변경을 원하시는 분은
http://instructables.tistory.com/64
▲여기 링크를 눌러주세요
As seen in AN885,
BLDC motors are electronically commutated based on the rotor position.
Each commutation sequence has two of three phases connected
across the power supply and the third phase is left open.
AN885에서 보다시피,
BLDC모터는 전자적으로 commutated(=정류)된다. based on the rotor 포지션기반으로.
각 commutation 시퀀스는 갖고있다. 2개의 3상을 연결된
across the 파워서플라이를 가로지르는 and the 세번째 phase는 남아있다. 열린상태로.
Using PWMs, the average voltage supplied
across the windings can be controlled, thus controlling
the speed. In this section, we will see how the peripherals
on the PIC18FXX31 can be used to control a
BLDC motor.
Figure 1 shows a typical control block diagram for
controlling a BLDC motor.
The PWM outputs from the PIC18FXX31 control the
power switches, Q0 to Q5. A matching driver circuit
should be used for supplying the required gate current
drive for the power switches. As we have seen in
AN885, the Hall Sensor signals may have 60-degree,
or 120-degree, electrical phase difference to each
other. A sequence table is entered in the program
memory based on the type of Hall Sensor placement.
The sequence can be taken from the motor data sheet.
The sequence may be different for clockwise and
counterclockwise rotations.
The following section explains how PCPWM, IC and
ADCs are used for open-loop control.
▼시퀀스에 대한 부연설명을 드리자면 아래와 같습니다.
코드를 보면 눈치 빠른 사람이라면 이해하겠지만
그렇지 못한 사람들을 위해서 아래에 그림으로 정리해봤습니다.
그리느라 힘들었으니 잘 간직해주세요 ^^
(Red means DC+, Blue means DC-)
;Commutation definition. This should be loaded to OVDCOND to realize the sequence
;The Hall Sensor makes a transition every 60 degrees
#define POSITION1 b'00010010' ;PWM1 & PWM4 are active
#define POSITION2 b'00000110' ;PWM1 & PWM2 are active
#define POSITION3 b'00100100' ;PWM5 & PWM2 are active
#define POSITION4 b'00100001' ;PWM5 & PWM0 are active
#define POSITION5 b'00001001' ;PWM3 & PWM0 are active
#define POSITION6 b'00011000' ;PWM3 & PWM4 are active
#define DUMMY_POSITION b'00000000' ;All PWM outputs are inactive
;---------------------------------------------------------------------------------
;Table initialization, Table values are loaded to RAM
;Forward sequence
MOVLW POSITION2 ;When Hall Sensor = 000,
MOVWF POSITION_TABLE_FWD ;PWM1 & PWM2 should be active
MOVLW POSITION3 ;When Hall Sensor = 001,
MOVWF POSITION_TABLE_FWD+1 ;PWM1 & PWM4 should be active
MOVLW DUMMY_POSITION ;When Hall Sensor = 002,
MOVWF POSITION_TABLE_FWD+2 ;All PWM outputs should be inactive
MOVLW POSITION4 ;When Hall Sensor = 003,
MOVWF POSITION_TABLE_FWD+3 ;PWM3 & PWM4 should be active
MOVLW POSITION1 ;When Hall Sensor = 004,
MOVWF POSITION_TABLE_FWD+4 ;PWM5 & PWM2 should be active
MOVLW DUMMY_POSITION ;When Hall Sensor = 005,
MOVWF POSITION_TABLE_FWD+5 ;All PWM outputs should be inactive
MOVLW POSITION6 ;When Hall Sensor = 006,
MOVWF POSITION_TABLE_FWD+6 ;PWM5 & PWM0 should be active
MOVLW POSITION5 ;When Hall Sensor = 007,
MOVWF POSITION_TABLE_FWD+7 ;PWM3 & PWM0 should be active
;Reverse sequence
MOVLW POSITION5 ;When Hall Sensor = 000,
MOVWF POSITION_TABLE_REV ;PWM3 & PWM0 should be active
MOVLW POSITION6 ;When Hall Sensor = 001,
MOVWF POSITION_TABLE_REV+1 ;PWM5 & PWM0 should be active
MOVLW DUMMY_POSITION ;When Hall Sensor = 002,
MOVWF POSITION_TABLE_REV+2 ;All PWM outputs should be inactive
MOVLW POSITION1 ;When Hall Sensor = 003,
MOVWF POSITION_TABLE_REV+3 ;PWM5 & PWM2 should be active
MOVLW POSITION4 ;When Hall Sensor = 004,
MOVWF POSITION_TABLE_REV+4 ;PWM3 & PWM4 should be active
MOVLW DUMMY_POSITION ;When Hall Sensor = 005,
MOVWF POSITION_TABLE_REV+5 ;All PWM outputs should be inactive
MOVLW POSITION3 ;When Hall Sensor = 006,
MOVWF POSITION_TABLE_REV+6 ;PWM1 & PWM4 should be active
MOVLW POSITION2 ;When Hall Sensor = 007,
MOVWF POSITION_TABLE_REV+7 ;PWM1 & PWM2 should be active
'졸업작품 > Brushless Motor Control (PIC)' 카테고리의 다른 글
Brushless Motor Driver (L6235N) (0) | 2016.06.01 |
---|