vxl-ch04-tk he vxl p2end 81slides

81
1 Chng 4 Thit k h vi x HBK Tp HCM-Khoa -T BMT GVPT: H Trung M Môn hc: Vi X

Upload: tan-phat-tran

Post on 27-May-2017

226 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: VXL-Ch04-TK He VXL P2end 81slides

1

Ch��ng 4Thi�t k� h� vi x� lý

�HBK Tp HCM-Khoa �-�TBM�TGVPT: H� Trung M�Môn h�c: Vi X� Lý

Page 2: VXL-Ch04-TK He VXL P2end 81slides

2

4.6 Giao ti�p b��hi�n t���(Display)4.6.2 Giao ti�p v�i LCD

Page 3: VXL-Ch04-TK He VXL P2end 81slides

3

LCD controller

Page 4: VXL-Ch04-TK He VXL P2end 81slides

4

LCD Operation

LCD is gaining popular and replacing LEDs (7-segment …), due to

1. declining price2. the ability to display numbers, characters, and

graphics3. relieving the CPU task by incorporating a refreshing

controller4. ease of programming for characters and graphics

(OLED is the coming display)

Page 5: VXL-Ch04-TK He VXL P2end 81slides

5

LCD Pin Descriptions14-pin LCD module is discussed here, table 12-1 lists pin’s function,

Fig 12-1 shows the pin positions for various LCDs– Vcc, Vss provide +5V and ground– Vee is used for contrast controlling– RS (register select) is used to select the instruction command code

register (RS = 0) or data register (RS = 1)– LCD command codes is listed at table 12-2– R/W (read/write) allows user to write to (R/W = 0) or read from

(R/W = 1) information– E (enable) latch information at data pins; when data is supplied to

data pins, a high-to-low pulse must be applied to this pin– D0-D7 are the 8-bit data pins; send information to LCD (R/W = 0)

and read contents of LCD internal registers (R/W = 1)– to display letters and numbers, ASCII codes are sent while RS = 1

Page 6: VXL-Ch04-TK He VXL P2end 81slides

6

Page 7: VXL-Ch04-TK He VXL P2end 81slides

7

Page 8: VXL-Ch04-TK He VXL P2end 81slides

8

Pin diagrams

– RS = 0, the command code register is selected, we can send instructionto LCD to perform clear, shift, blink …– when RS = 0, and R/W = 1, D7 is busy flag, when D7 = 0, LCD is readyto receive new information; it is recommended to check the busy flagbefore writing any data to the LCD

Page 9: VXL-Ch04-TK He VXL P2end 81slides

9

LCD Interfacing

• Liquid Crystal Displays (LCDs) have become a cheap and easy way to display text for an embedded system – Various configurations (1 line by 20 characters upto 8

lines by 80 characters).• LCD needs a driving circuit to work.• Driving circuit and LCD are often integrated into a single

chip Hitachi LM015 can display one line of 16 characters• The display has one register into which commands are sent

and one register into which data to be displayed are sent• Two registers are differentiated by the RS input• Data lines (DB7-DB0) are used to transfer both commands

(clearing, cursor positioning, etc) and data (character to be displayed)

Page 10: VXL-Ch04-TK He VXL P2end 81slides

10

Alphanumeric LCD Interfacing

• Pinout– 8 data pins D7:D0– RS: Data or Command

Register Select– R/W: Read or Write– E: Enable (Latch data)

• RS – Register Select– RS = 0 → Command Register– RS = 1 → Data Register

• R/W = 0 → Write, R/W = 1 → Read• E – Enable

– Used to latch the data present on the data pins.• D0 – D7

– Bi-directional data/command pins. – Alphanumeric characters are sent in ASCII format.

E

R/WRS

DB7–DB0

LCD controller

communications bus

Microcontroller

8

LCD Module

Page 11: VXL-Ch04-TK He VXL P2end 81slides

11

LCD Commands

• The LCD’s internal controller can accept several commands and modify the display accordingly. These commands would be things like:– Clear screen– Return home– Decrement/Increment cursor

• After writing to the LCD, it takes some time for it to complete its internal operations. During this time, it will not accept any new commands or data.– We need to insert time delay between any two

commands or data sent to LCD

Page 12: VXL-Ch04-TK He VXL P2end 81slides

12

Interfacing LCD with 8051

LM015

8051

P1.7-P1.0 D7-D0

RW

RS

E

P3.4

P3.5

P3.3

Page 13: VXL-Ch04-TK He VXL P2end 81slides

13

Interfacing LCD with 8051

In main program:. . .MOV A, COMMANDCALL CMDCALL DELAYMOV A, ANOTHER_CMDCALL CMDCALL DELAYMOV A, #’A’CALL DATACALL DELAYMOV A, #’B’CALL DATACALL DELAY ….

Command and Data Write RoutinesDATA: MOV P1, A ; A is ascii data

SETB P3.3 ; RS=1 dataCLR P3.4 ; RW=0 for writeSETB P3.5 ; H->L pulse on ECLR P3.5RET

CMD: MOV P1, A ; A has the cmd wordCLR P3.3 ; RS=0 for cmdCLR P3.4 ; RW=0 for writeSETB P3.5 ; H->L pulse on ECLR P3.5RET

Page 14: VXL-Ch04-TK He VXL P2end 81slides

14

Page 15: VXL-Ch04-TK He VXL P2end 81slides

15

Page 16: VXL-Ch04-TK He VXL P2end 81slides

16

Page 17: VXL-Ch04-TK He VXL P2end 81slides

17

Page 18: VXL-Ch04-TK He VXL P2end 81slides

18

LCD

Page 19: VXL-Ch04-TK He VXL P2end 81slides

19

LCD Timing

Page 20: VXL-Ch04-TK He VXL P2end 81slides

20

Page 21: VXL-Ch04-TK He VXL P2end 81slides

21

Page 22: VXL-Ch04-TK He VXL P2end 81slides

22

Stepper Motors

• more accurately controlled than a normal motor allowing

fractional turns or n revolutions to be easily done

• low speed, and lower torque than a comparable D.C.

motor

• useful for precise positioning for robotics• Servomotors require a position feedback signal for control

Page 23: VXL-Ch04-TK He VXL P2end 81slides

23

Stepper Motor Diagram

Page 24: VXL-Ch04-TK He VXL P2end 81slides

24

Stepper Motor Step Angles

Page 25: VXL-Ch04-TK He VXL P2end 81slides

25

Terminology

• Steps per second, RPM

– SPS = (RPM * SPR) /60

• Number of teeth

• 4-step, wave drive 4-step, 8-step

• Motor speed (SPS)

• Holding torque

Page 26: VXL-Ch04-TK He VXL P2end 81slides

26

Stepper Motor Types

– Variable Reluctance

– Permanent Magnet

Page 27: VXL-Ch04-TK He VXL P2end 81slides

27

Variable Reluctance Motors

Page 28: VXL-Ch04-TK He VXL P2end 81slides

28

Variable Reluctance Motors

• This is usually a four wire motor – the common wire goes to the +ve supply and the windings are stepped through

• Our example is a 30o motor• The rotor has 4 poles and the stator has 6 poles• Example

Page 29: VXL-Ch04-TK He VXL P2end 81slides

29

Variable Reluctance Motors

• To rotate we excite the 3 windings in sequence– W1 - 1001001001001001001001001 – W2 - 0100100100100100100100100 – W3 - 0010010010010010010010010

• This gives two full revolutions

Page 30: VXL-Ch04-TK He VXL P2end 81slides

30

Unipolar Motors

Page 31: VXL-Ch04-TK He VXL P2end 81slides

31

Unipolar Motors

• To rotate we excite the 2 windings in sequence– W1a - 1000100010001000100010001 – W1b - 0010001000100010001000100 – W2a - 0100010001000100010001000– W2b - 0001000100010001000100010

• This gives two full revolutions

Page 32: VXL-Ch04-TK He VXL P2end 81slides

32

Basic Actuation Wave Forms

Page 33: VXL-Ch04-TK He VXL P2end 81slides

33

Unipolar Motors

• To rotate we excite the 2 windings in sequence– W1a - 1100110011001100110011001 – W1b - 0011001100110011001100110 – W2a - 0110011001100110011001100 – W2b - 1001100110011001100110011

• This gives two full revolutions at 1.4 times greater torque but twice the power

Page 34: VXL-Ch04-TK He VXL P2end 81slides

34

Enhanced Waveforms

• better torque• more precise control

Page 35: VXL-Ch04-TK He VXL P2end 81slides

35

Unipolar Motors

• The two sequences are not the same, so by combining the two you can produce half stepping– W1a - 11000001110000011100000111 – W1b - 00011100000111000001110000 – W2a - 01110000011100000111000001 – W2b - 00000111000001110000011100

Page 36: VXL-Ch04-TK He VXL P2end 81slides

36

Motor Control Circuits

• For low current options the ULN200x family of Darlington Arrays will drive the windings direct.

Page 37: VXL-Ch04-TK He VXL P2end 81slides

37

Interfacing to Stepper Motors

Page 38: VXL-Ch04-TK He VXL P2end 81slides

38

Example��v�i 80x86)

• BT: SV t� v� l�i m�ch và��������ình khi dùng 8051?

Page 39: VXL-Ch04-TK He VXL P2end 81slides

39

Giao ti�p v�i DAC

Page 40: VXL-Ch04-TK He VXL P2end 81slides

40

Page 41: VXL-Ch04-TK He VXL P2end 81slides

41

Page 42: VXL-Ch04-TK He VXL P2end 81slides

42

Page 43: VXL-Ch04-TK He VXL P2end 81slides

43

Page 44: VXL-Ch04-TK He VXL P2end 81slides

44

Page 45: VXL-Ch04-TK He VXL P2end 81slides

45

Page 46: VXL-Ch04-TK He VXL P2end 81slides

46

Page 47: VXL-Ch04-TK He VXL P2end 81slides

47

Page 48: VXL-Ch04-TK He VXL P2end 81slides

48

Digital to Analog Converter

Page 49: VXL-Ch04-TK He VXL P2end 81slides

49

Example – Step Ramp

Page 50: VXL-Ch04-TK He VXL P2end 81slides

50

Giao ti�p v�i ADC

Page 51: VXL-Ch04-TK He VXL P2end 81slides

51

Page 52: VXL-Ch04-TK He VXL P2end 81slides

52

Page 53: VXL-Ch04-TK He VXL P2end 81slides

53

Page 54: VXL-Ch04-TK He VXL P2end 81slides

54

Page 55: VXL-Ch04-TK He VXL P2end 81slides

55

Page 56: VXL-Ch04-TK He VXL P2end 81slides

56

Page 57: VXL-Ch04-TK He VXL P2end 81slides

57

Page 58: VXL-Ch04-TK He VXL P2end 81slides

58

Page 59: VXL-Ch04-TK He VXL P2end 81slides

59

Page 60: VXL-Ch04-TK He VXL P2end 81slides

60

Page 61: VXL-Ch04-TK He VXL P2end 81slides

61

Page 62: VXL-Ch04-TK He VXL P2end 81slides

62

Analog to Digital

Page 63: VXL-Ch04-TK He VXL P2end 81slides

63

Vin Range

Page 64: VXL-Ch04-TK He VXL P2end 81slides

64

Timing Diagram for ADC transaction

Page 65: VXL-Ch04-TK He VXL P2end 81slides

65

CLK IN and CLK R

Page 66: VXL-Ch04-TK He VXL P2end 81slides

66

External clocking scheme for ADC0804

Page 67: VXL-Ch04-TK He VXL P2end 81slides

67

Assembly for ADC0804

Page 68: VXL-Ch04-TK He VXL P2end 81slides

68

Interfacing ADC

Page 69: VXL-Ch04-TK He VXL P2end 81slides

69

Example��v�i 80x86)

Page 70: VXL-Ch04-TK He VXL P2end 81slides

70

8051 giao�� �p v�i ADC

Page 71: VXL-Ch04-TK He VXL P2end 81slides

71

Temperature Sensor

Page 72: VXL-Ch04-TK He VXL P2end 81slides

72

ADC0808/0809: multi-(analog)-channel

Page 73: VXL-Ch04-TK He VXL P2end 81slides

73

Pin interface on ADC0808/0809

Page 74: VXL-Ch04-TK He VXL P2end 81slides

74

Timing Diagram for the ADC0809

Page 75: VXL-Ch04-TK He VXL P2end 81slides

75

Schematic for 8051 connected to ADC0809up to 8 inputs selects input

Page 76: VXL-Ch04-TK He VXL P2end 81slides

76

Reference voltages

Page 77: VXL-Ch04-TK He VXL P2end 81slides

77

Single-ended vsDifferential Pair input

Page 78: VXL-Ch04-TK He VXL P2end 81slides

78

Digital vs Analog Ground

Page 79: VXL-Ch04-TK He VXL P2end 81slides

79

Assembly for ADC0809

Page 80: VXL-Ch04-TK He VXL P2end 81slides

80

Assembly for ADC0809 (2/2)

Page 81: VXL-Ch04-TK He VXL P2end 81slides

81

Useful Links

• http://www.kmitl.ac.th/~kswichit/• http://www.8052.com/codelib.phtml• http://www.circuits-city.com/• http://www.ikalogic.com/cat_microcontrolle

rs.php