Upload
janis-johnson
View
226
Download
2
Embed Size (px)
Citation preview
KyungHee Univ. 2-5
8.5 Computer-Controlled Relays, Solenoids, and DC Motors 8.5.1 Introduction to Relays
KyungHee Univ. 2-14
8.5.5 Pulse-Width Modulated DC Motors
DC 모터의 속도 제어 ( 모터에 가해지는 실효 전력을 제어 함 ) 를 위하여 펄스 폭 변조 기술을 사용 한다 .
KyungHee Univ. 2-16
8.5.6 Interfacing EM Relays, Solenoids, and DC Motors
Diode Maximum voltage (V)
1N4001 50
1N914 75
1N4002 100
1N4003 200
1N4004 400
1N4005 600
1N4006 800
1N4007 1000
Table 8.12 Maximum voltage parameter for typical snubber diodes
KyungHee Univ.
DC Motor and Stepper Controller
Current Motor Supply Logic CurrentSensing Voltage Enable Supply Enable Sensing
A Out Out Vs In A In GND Vs In B In Out Out B 1 2 1 2 3 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1 2 3 4 5 6 GND Dir1 En1 Dir2 En2 Vcc In Put Control Signal Connector
+Vout 1Motor 1-Vout1
+Vout 2Motor 2-Vout2
VsSupplyVoltageGND
+-
470uF35V
104
1+
1+
2
4
3 3
4
2
Vs2W062W06
L298N
274141
474143
VsSupplyVoltageGND
Dual Full-Bridge Driver L298
High voltage : 46Vhigh current : 4ADual full-bridge driverAccept standard TTL logic levelsDrive inductive loads such as • Relays, Solenoids, DC and, Stepping motors
KyungHee Univ. 2-28
KyungHee Univ. 2-35
8.6.1 Stepper Motors Example
PORTBOutput
A A’ B B’
10 Activate Deactivate
Activate Deactivate
9 Activate Deactivate
Deactivate
Activate
5 Deactivate
Activate Deactivate
Activate
6 Deactivate
Activate Activate Deactivate
Table 8.13 Stepper motor sequence
KyungHee Univ. 2-37
Program 8.24. A double circular linked list used to control the stepper motor.
// 6811 or 6812const struct State{ unsigned char Out; // Output const struct State *Next[2]; // CW/CCW};typedef struct State StateType;typedef StateType *StatePtr;#define clockwise 0 // Next index#define counterclockwise 1 // Next indexStateType fsm[4]={ {10,{&fsm[1],&fsm[3]}}, { 9,{&fsm[2],&fsm[0]}}, { 5,{&fsm[3],&fsm[1]}}, { 6,{&fsm[0],&fsm[2]}}};unsigned char Pos; // between 0 and 199 StatePtr Pt; // Current State
KyungHee Univ. 2-38
Program 8.25. Helper functions used to control the stepper motor.
// 6811 or 6812// Move 1.8 degrees clockwise void CW(void){ Pt = Pt->Next[clockwise]; // circular PORTB = Pt->Out; // step motor if(Pos==199){ // shaft angle Pos = 0; // reset } else{ Pos++; // CW }}
// Move 1.8 degrees counterclockwisevoid CCW(void){ Pt = Pt->Next[counterclockwise PORTB = Pt->Out; // step motor if(Pos==0){ // shaft angle Pos = 199; // reset } else{ Pos--; // CCW }}
// Initialize Stepper interface void Init(void){ Pos = 0; Pt = &fsm[0]; DDRB = 0xFF; // 6812 only}
KyungHee Univ. 2-39
Program 8.26. High-level function to control the stepper motor.
// 6811 or 6812 void Seek(unsigned char desired){short CWsteps; if((CWsteps=desired-Pos)<0){ CWsteps+=200; } // CW steps is 0 to 199 if(CWsteps>100){ while(desired<>Pos){ CCW(); } } else{ while(desired<>Pos){ CW(); } }}