deepak gupta bidirectional em tested em tested motor …

5
CONSTRUCTION DEEPAK GUPTA EM TESTED EM TESTED EM TESTED DR. D.G.VYAS To connect a motor to 89c51 controller an optocoupler and driver are used. The optocoupler used is ILQ74.It is used to suppress back emf and to isolate the two drivers at different voltage levels.The driver used is L293.The pin numbers of the 8051 have been changed for the simplicity.On pressing ‘1’ the motors runs clockwise and on pressing ‘2’ it runs anticlockwise. The 8051 architecture consists of these specific features: 8 bit CPU with registers A (the accumulator) and B 16 bit program counter (PC) and data pointer (DPTR) 8 bit program status word (PSW) RAM of 128 bytes and ROM of 4K 8051 Controller Four register banks, each containing 8 registers 32I/O pins organized as 4 ports P0-P3 Two 16 bit timers, T0,T1 Two external and three internal interrupt sources Oscillator and cloak circuit The IL74 is an optically coupled pair with a Gallium Arsenide infrared LED and a silicon NPN phototransistor. Signal information, including a DC level, can be transmitted by the device while maintaining a high degree of electrical isolation between input and output. The IL74 is especially designed for driving medium-speed logic, where it may be used to eliminate troublesome gound loop and noise problems. Also it can be used to replace relays and transformers in many digital interface applications, as well as analog applications such as CRT modulation. The L293B and L293E are quad push-pull drivers ILQ74 L293 Bidirectional Motor Using 8051 P0.7/AD7 P0.6/AD6 P0.5/AD5 P0.4/AD4 P0.3/AD3 P0.2/AD2 P0.1/AD1 P0.0/AD0 PSEN ALE P1.7 P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0 Pins Pins XTL1 XTL2 RD/P3.7 WR/P3.6 T1/P3.5 T0/P3.4 INT1/P3.3 INT0/P3.2 TXD/P3.1 RXD/P3.0 A15/P2.7 A14/P2.6 A13/P2.5 A12/P2.4 A11/P2.3 A10/P2.2 A9/P2.1 A8/P2.0 RST EA Vss Vcc 32 33 34 35 36 37 38 39 17 16 15 14 13 12 11 10 28 27 26 25 24 23 22 21 8 7 6 5 4 3 2 1 19 18 20 9 31 29 30 8051 40 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Anode Cathode Cathode Anode Anode Cathode Cathode Anode Emitter Emitter Emitter Emitter Collector Collector Collector Collector

Upload: others

Post on 22-Feb-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: DEEPAK GUPTA Bidirectional EM TESTED EM TESTED Motor …

CONSTRUCTION

DEEPAK GUPTA

EM TESTEDEM TESTED

EM TESTED

DR. D.G.VYAS

To connect a motor to 89c51 controller an optocoupler and driver are used.The optocoupler used is ILQ74.It is used to suppress back emf and to isolate the two drivers at different voltage levels.The driver used is L293.The pin numbers of the 8051 have been changed for the simplicity.On pressing ‘1’ the motors runs clockwise and on pressing ‘2’ it runs anticlockwise.

The 8051 architecture consists of these specific features:8 bit CPU with registers A (the accumulator) and B16 bit program counter (PC) and data pointer (DPTR)8 bit program status word (PSW)RAM of 128 bytes and ROM of 4K

8051 Controller

Four register banks, each containing 8 registers32I/O pins organized as 4 ports P0-P3Two 16 bit timers, T0,T1Two external and three internal interrupt sourcesOscillator and cloak circuit

The IL74 is an optically coupled pair with a Gallium Arsenide infrared LED and a silicon NPN

phototransistor. Signal information, including a DC level, can be transmitted by the device while maintaining a high degree of electrical isolation between input and output. The IL74 is especially designed for driving medium-speed logic, where it may be used to eliminate troublesome gound loop and noise problems. Also it can be used to replace relays and transformers in many digital interface applications, as well as analog applications such as CRT modulation.

The L293B and L293E are quad push-pull drivers

ILQ74

L293

Bidirectional Motor Using 8051

P0.7/AD7

P0.6/AD6

P0.5/AD5

P0.4/AD4

P0.3/AD3

P0.2/AD2

P0.1/AD1

P0.0/AD0

PSEN

ALE

P1.7

P1.6

P1.5

P1.4

P1.3

P1.2

P1.1

P1.0

Pins Pins

XTL1

XTL2

RD/P3.7

WR/P3.6

T1/P3.5

T0/P3.4

INT1/P3.3

INT0/P3.2

TXD/P3.1

RXD/P3.0

A15/P2.7

A14/P2.6

A13/P2.5

A12/P2.4

A11/P2.3

A10/P2.2

A9/P2.1

A8/P2.0

RST

EA

Vss

Vcc32

33

34

35

36

37

38

39

17

16

15

14

13

12

11

10

28

27

26

25

24

23

22

21

8

7

6

5

4

3

2

1

19

18

20

9

31

29

308051

40

1

2

3

4

5

6

7

8 9

10

11

12

13

14

15

16Anode

Cathode

Cathode

Anode

Anode

Cathode

Cathode

Anode

Emitter

Emitter

Emitter

Emitter

Collector

Collector

Collector

Collector

Page 2: DEEPAK GUPTA Bidirectional EM TESTED EM TESTED Motor …

capable of delivering output currents to 1A per channel. Each channel is controlled by a TTL compatible logic input and each pair of drivers (a full bridge) is equipped with an inhibit input which turns off al l four transistors. A separate supply input is provided for the logic so that it may be run off a lower voltage to reduce d i s s i p a t i o n . Additionally, the L293E h a s e x t e r n a l connection of sensing resistors, for switch mode control.The L293B and L293E are package in 16 and

20-pin plastic DIPs respectively; both use the four center pins to conduct heat to the printed circuit board.

The LCD panel's Enable and Register Select is connected to the Control Port. The Control Port is an open collector / open drain output. While most

Parallel Ports have internal pull-up resistors, there are a few which don't. Therefore by incorporating the two 10K external pull up resistors, the circuit is more portable for a wider range of computers, some of which may have no internal pull up resistors. The 10k Potentiometer controls the contrast of the LCD panel.The 2 line x 16 character LCD modules are available from a wide range of manufacturers and should all be compatible with the HD44780.The pin out on most LCD's will be 14 to 16 pins in a single row with the standard 100 mil spacing. The 16 pin version has two extra pins to accommodate a back-light. However, sometimes the pins are present but not connected to anything.function is usually used to poll the "Busy Flag" which

16x2 LCD

CONSTRUCTION

Symbol

Vs

Vss

Vi

Vih

Iout

Ptot

Tstg,Tj

Parameter

Supply Voltage

Logic Supply Voltage

Input voltage

Inhibit voltage

Peak Output voltage

Total Power dissipation

Storage and Junction temperature

Value

36

36

7

7

2

5

-40 to 150

Unit

V

V

V

V

A

W

ºC

L2931

2

3

4

5

6

7

89

1

3

10

12

11

16

15

14

13

4

PARALLEL

PORT

D0 (2)

D1 (3)

D2 (4)

D3 (5)

D4 (6)

D5 (7)

D6 (8)

D7 (9)

D0

D1

D2

D3

D4

D5

D6

D7

7

8

9

10

11

12

13

14

2 Line x 16 Character

GND (18.25)

Stobe (1)

Vcc

10k

Select Printer (12)

Vcc

10k

Vcc6 5 4 1 3 2

10k

Cantiest

E RW RS GND VO Vcc

R/S

0

0

0

0

0

0

0

0

0

1

1

R/W

0

0

0

0

0

0

0

0

1

0

1

D7

0

0

0

0

0

0

0

1

BF

D

D

D6

0

0

0

0

0

0

1

A

*

D

D

D5

0

0

0

0

0

1

A

A

*

D

D

D4

0

0

0

0

1

DL

A

A

*

D

D

D3

0

0

0

1

SC

N

A

A

*

D

D

D2

0

0

1

D

RL

F

A

A

*

D

D

D1

0

1

ID

C

*

*

A

A

*

D

D

D0

1

*

S

B

*

*

A

A

*

D

D

Instruction/Description

Clear Display and Home the Cursor

Return Cursor and LCD to Home Position

Set Cursor Move Direction

Enable Display/Cursor

Move Cursor/Shift Display

Set Interface Length

Move Cursor into CGRAM

Move Cursor to Display

Poll the "Busy Flag"

Write a Character to the Display at the Current Cursor Position

Read the Character on the Display at the Current Cursor Position

Page 3: DEEPAK GUPTA Bidirectional EM TESTED EM TESTED Motor …

If all the rows are grounded and a key is pressed, one of the columns will have zero since all the keys provide path to ground. It is the function of the controller to scan the keyboard continuously to detect and identify the key pressed.

A DC motor wil have only + and – leads.Connecting them to a DC voltage source moves the rotor in one direction.By reversing the

polarity,the DC motor will move in opposite direction.The maximum speed of motor is indicated in RPM and specified in datasheet.The code is as follows:#include<reg51.h>sbit RS=P2^0;sbit RW=P2^1;sbit EN=P2^2;sbit busy=P0^7;sbit pin1=P1^0;sbit pin2=P1^2;sbit pin3=P1^4;

void msdelay(unsigned int value){

DC Motor

appears on D7 while the device is incapable of accepting a command (it's busy..get it). However, this function may be ignored by simply waiting the maximum amount of time for each command to complete (most are completed in less than 200us).

The rows are connected to the output port and columns connected to the input port. If no key has been pressed ,reading the input port will yield ‘1’ for all columns since they are all connected to Vcc.

Command Set

4x4 Keypad

CONSTRUCTION

Ground (Vss), 0V

Power (Vdd), +5V

Contrast Voltage (usually less than 1V)

"R/S" Register Select ( 1 for Data Write, 0 for Command Write)

"R/W" Read/Write (1 for Read, 0 for Write)

"EN" Enable line (Pulsing high latches a command or data _|¯|_ )

Data Pins (D0-D7) D0 is LSB, in 4-bit mode only D4-D7 are used

(Optional) Back-light Anode and Cathode, NC, or Not There at All

1

2

3

4

5

6

7-14

15-16

Pin Function

1 2 3

4 5 6

7 8 9

0* #

3 1 5

2

7

6

4

C1 C2 C33x150R

R1

R2

R3

R4

4x10k

Keypad

Page 4: DEEPAK GUPTA Bidirectional EM TESTED EM TESTED Motor …

{lcdcmd(0x38);msdelay(250);lcdcmd(0x0e);msdelay(250);lcdcmd(0x01);msdelay(250);lcdcmd(0x06);msdelay(250);lcddata('c');msdelay(250);

lcddata('l');msdelay(250);lcddata('o');msdelay(250);lcddata('c');msdelay(250);lcddata('k');msdelay(250);pin1=0;pin2=0;pin3=0;msdelay(250);pin1=1;pin2=1;pin3=0;

}void funct2(){

lcdcmd(0x38);msdelay(250);lcdcmd(0x0e);msdelay(250);lcdcmd(0x01);msdelay(250);lcdcmd(0x06);msdelay(250);lcddata('A');msdelay(250);

unsigned int i,j;for(i=0;i<value;i++)for(j=0;j<1275;j++);

}

void lcdready(){

busy=1;RS=0;RW=1;while(busy==1){

EN=0;msdelay(250);EN=1;

}}void lcddata(unsigned char value){

lcdready();P0=value;RS=1;RW=0;EN=1;msdelay(250);EN=0;

}

void lcdcmd(unsigned char value){

lcdready();P0=value;RS=0;RW=0;EN=1;msdelay(250);EN=0;

} void funct1()

CONSTRUCTION

Page 5: DEEPAK GUPTA Bidirectional EM TESTED EM TESTED Motor …

}while(colloc==0x0f);msdelay(250);colloc=P3;colloc&=0x0f;

}while(colloc==0x0f); P2=0xf7;

colloc=P3;colloc&=0x0f;if(colloc!=0x0f){

rowloc=0;break;

}P2=0xef;colloc=P3;colloc&=0x0f;if(colloc!=0x0f){

rowloc=1;break;

} P2=0xdf;colloc=P3;colloc&=0x0f;if(colloc!=0x0f){

rowloc=2;break;

}P2=0xbf;colloc=P3;colloc&=0x0f;if(colloc!=0x0f){

rowloc=3;break;

}i f ( c o l l o c = = 0 x 0 D & &

rowloc==1){

funct1();}e l s e i f ( co l l o c==0x0b &&

rowloc==2){

funct2();}else {

exit();}

}}

lcddata('n');msdelay(250);lcddata('t');msdelay(250);lcddata('i');msdelay(250);lcddata('c');msdelay(250);

lcddata('l');msdelay(250);lcddata('o');msdelay(250);lcddata('c');msdelay(250);lcddata('k');msdelay(250);

pin1 = 0;pin2 = 0;pin3 = 0;msdelay(250);pin1 = 1;pin2 = 0;pin3 = 1;

}void main(){

unsigned char colloc,rowloc;P3=0xff;while(1){

do{P2=0x00;colloc=3;colloc&=0x0f;}while(colloc!=0x0f);

do{do{ msdelay(250);

colloc=P3;colloc&=0x0f;

CONSTRUCTION

Components Used89c51 Microcontroller16x2 LCD4x4 KeypadILQ74 optocouplerL293 DriverDC MotorResistors of 1KOhm,10KOhm10K Potentiometer Supply of 12V and 5V

COMPONENT LIST