62
KyungHee Univ. 2-1 Chapter 8 Parallel Port Interfaces Chapter 8 Parallel Port Interfaces

KyungHee Univ. 2-0 Chapter 8 Parallel Port Interfaces

Embed Size (px)

Citation preview

KyungHee Univ. 2-1

Chapter 8 Parallel Port InterfacesChapter 8 Parallel Port Interfaces

KyungHee Univ. 2-2

8.4 Transistors Used for Computer-Controlled Current Switches

전류 제어 Switch(BJT)

KyungHee Univ. 2-3

8.4 Transistors Used for Computer-Controlled Current Switches

KyungHee Univ. 2-4

8.4 Transistors Used for Computer-Controlled Current Switches

KyungHee Univ. 2-5

8.5 Computer-Controlled Relays, Solenoids, and DC Motors 8.5.1 Introduction to Relays

KyungHee Univ. 2-6

8.5.1 Introduction to Relays

제어 회로와 다른 전원으로 구동하는 Relay 의 예

KyungHee Univ. 2-7

8.5.1 Introduction to Relays

KyungHee Univ. 2-8

8.5.2 Electromagnetic Relays Basics

KyungHee Univ. 2-9

8.5.2 Electromagnetic Relays Basics

KyungHee Univ. 2-10

8.5.2 Electromagnetic Relays Basics

KyungHee Univ. 2-11

8.5.3 reed Relays

KyungHee Univ. 2-12

8.5.4 Solenoids

KyungHee Univ. 2-13

8.5.4 Solenoids

KyungHee Univ. 2-14

8.5.5 Pulse-Width Modulated DC Motors

DC 모터의 속도 제어 ( 모터에 가해지는 실효 전력을 제어 함 ) 를 위하여 펄스 폭 변조 기술을 사용 한다 .

KyungHee Univ. 2-15

8.5.6 Interfacing EM Relays, Solenoids, and DC Motors

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. 2-17

8.5.6 Interfacing EM Relays, Solenoids, and DC Motors

KyungHee Univ. 2-18

8.5.6 Interfacing EM Relays, Solenoids, and DC Motors

KyungHee Univ. 2-19

8.5.6 Interfacing EM Relays, Solenoids, and DC Motors

KyungHee Univ. 2-20

8.5.6 Interfacing EM Relays, Solenoids, and DC Motors

KyungHee Univ. 2-21

8.5.6 Interfacing EM Relays, Solenoids, and DC Motors

KyungHee Univ. 2-22

8.5.6 Interfacing EM Relays, Solenoids, and DC Motors

KyungHee Univ. 2-23

8.5.6 Interfacing EM Relays, Solenoids, and DC Motors

KyungHee Univ. 2-24

8.5.6 Interfacing EM Relays, Solenoids, and DC Motors

KyungHee Univ. 2-25

8.5.6 Interfacing EM Relays, Solenoids, and DC Motors

KyungHee Univ. 2-26

8.5.6 Interfacing EM Relays, Solenoids, and DC Motors

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

L289 Block Diagram

KyungHee Univ. 2-29

M M

KyungHee Univ. 2-30

8.5.7 Solid-State Relays

KyungHee Univ. 2-31

8.5.7 Solid-State Relays

KyungHee Univ. 2-32

8.5.7 Solid-State Relays

KyungHee Univ. 2-33

8.6 Stepper Motors

KyungHee Univ. 2-34

8.6.1 Stepper Motors Example

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-36

8.6.1 Stepper Motors Example

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(); } }}

KyungHee Univ. 2-40

8.6.2 Basic Operation

KyungHee Univ. 2-41

8.6.2 Basic Operation

KyungHee Univ. 2-42

8.6.2 Basic Operation

KyungHee Univ. 2-43

8.6.2 Basic Operation

KyungHee Univ. 2-44

8.6.2 Basic Operation

KyungHee Univ. 2-45

8.6.2 Basic Operation

KyungHee Univ. 2-46

8.6.2 Basic Operation

KyungHee Univ. 2-47

8.6.2 Basic Operation

KyungHee Univ. 2-48

8.6.3 Stepper Motor Hardware Interface

KyungHee Univ. 2-49

8.6.3 Stepper Motor Hardware Interface

KyungHee Univ. 2-50

8.6.3 Stepper Motor Hardware Interface

KyungHee Univ. 2-51

8.6.3 Stepper Motor Hardware Interface

KyungHee Univ. 2-52

8.6.4 Stepper Motor Shaft Encoder

KyungHee Univ. 2-53

8.6.4 Stepper Motor Shaft Encoder

KyungHee Univ. 2-54

8.6.4 Stepper Motor Shaft Encoder

KyungHee Univ. 2-55

KyungHee Univ. 2-56

KyungHee Univ. 2-57

KyungHee Univ. 2-58

KyungHee Univ. 2-59

KyungHee Univ. 2-60

KyungHee Univ. 2-61

KyungHee Univ. 2-62