Docsity

MIcocontroller based system design, Study notes of Microprocessors

Toggle sidebar
bg1
EC5551: MICROPROCESSORS AND
MICROCONTROLLERS
Dr. V. SATHIESH KUMAR Department of Electronics Engg., MIT
1
Unit IV: MICROCONTROLLER BASED SYSTEM DESIGN
1. Interfacing matrix display
2. (16x2) LCD
3. High power devices
4. Optical motor shaft encoder
5. Stepper Motor
6. DC Motor speed Control using PWM
7. ADC, DAC and Relay Interfacing
8. RTC and EEPROM interface using I2C protocol
TEXT BOOK
Muhammad Ali Mazidi, Janice Gillispie Mazidi and Rolin D. McKinley, "The 8051
Microcontroller and Embedded Systems", Second Edition, Pearson Education 2008. Fifth
impression 2011
Presented By,
Dr. V. Sathiesh Kumar
Department of Electronics Engg.,
MIT-Anna University
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28

Partial preview of the text

Download MIcocontroller based system design and more Study notes Microprocessors in PDF only on Docsity!

EC5551: MICROPROCESSORS AND

MICROCONTROLLERS

1

Unit IV: MICROCONTROLLER BASED SYSTEM DESIGN

  1. Interfacing matrix display
  2. (16x2) LCD
  3. High power devices
  4. Optical motor shaft encoder
  5. Stepper Motor
  6. DC Motor speed Control using PWM
  7. ADC, DAC and Relay Interfacing
  8. RTC and EEPROM interface using I2C protocol TEXT BOOK Muhammad Ali Mazidi, Janice Gillispie Mazidi and Rolin D. McKinley, "The 8051 Microcontroller and Embedded Systems", Second Edition, Pearson Education 2008. Fifth impression 2011

Presented By,

Dr. V. Sathiesh Kumar

Department of Electronics Engg., MIT-Anna University

2 Dotmatrix Displays: ➢To interface a single color 8 × 8 LED matrix with a 8051 microcontroller and display a few characters in it. ➢It has long life almost 50 , 000 hours if properly installed. ➢Available in different sizes and colors. ➢Its brightness and colors can be easily controlled. ➢It is capable of outputting 135 lumens/watt. ➢With low-voltage scanning , 8 × 8 LED Matrix LED display have advantages such as power saving, long service life, low cost, high brightness, a wide angle of view, long visual range, waterproofs and so on. ➢E.g. 5 x 7 , 8 x 8 , common anode, and common cathode types are available.

4 Dotmatrix Displays:

5 Dotmatrix Displays:

7 Dotmatrix Displays: LET_A: MOV ROW,# 01111110 B MOV COL,# 11111110 B ACALL DELAY MOV ROW,# 00010001 B MOV COL,# 11111101 B ACALL DELAY MOV ROW,# 00010001 B MOV COL,# 11111011 B ACALL DELAY MOV ROW,# 00010001 B MOV COL,# 11110111 B ACALL DELAY MOV ROW,# 01111110 B MOV COL,# 11101111 B CALL DELAY RET

8 Dotmatrix Displays: DELAY: MOV R 6 ,# 20 D ; 20 ms delay subroutine HERE 1 : MOV R 5 ,# 255 D HERE: DJNZ R 5 ,HERE DJNZ R 6 ,HERE 1 RET END

10 16 X 2 LCD Displays:

11 16 X 2 LCD Displays: ➢ Vcc and Vss provide + 5 V and ground respectively. ➢ VEE is used for controlling the LCD contrast. ➢ Register Select (RS) is used to select the command code register or data register (RS= 0 : command code register, RS= 1 : data register). ➢ Read/Write (R/W) input allows the user to write information to the LCD or read information from it (R/W= 0 : Write, R/W= 1 : Read). ➢ Enable (E) pin is used by the LCD to latch information presented to its data pin. When data is supplied to data pins, a high-to-low pulse must be applied to the E pin in order for the LCD to latch in the data present at the data pins. This pulse must be a minimum of 450 ns wide. ➢ D 0 - D 7 is 8 - bit data pins are used to send information to the LCD or read the contents of the LCD’s internal registers.

13 16 X 2 LCD Displays:

14 40 X 2 LCD Displays: Addressing

16 16 X 2 LCD Displays: ; P3.0 – P3.7 are connected to LCD data pins D0 – D ; P2.0 is connected to RS pin of LCD ; P2.1 is connected to R/W* pin of LCD ; P2.2 is connected to E pin of LCD ORG 0000H MOV A, #38H ; initialize LCD 16 X 2 ACALL COMD ; call command subroutine ACALL DELAY ; give LCD some time MOV A, #0EH ; display on, cursor on ACALL COMD ; call command subroutine ACALL DELAY ; give LCD some time MOV A, #01H ; clear LCD ACALL COMD ; call command subroutine ACALL DELAY ; give LCD some time

17 16 X 2 LCD Displays: MOV A, #06H ; shift cursor right ACALL COMD ; call command subroutine ACALL DELAY ; give LCD some time MOV A, #84H ; cursor at line 1, position 4 ACALL COMD ; call command subroutine ACALL DELAY ; give LCD some time MOV A, #’8’ ; display letter 8 ACALL DTA ; call display subroutine ACALL DELAY ; give LCD some time MOV A, #’0’ ; display letter 0 ACALL DTA ; call display subroutine MOV A, #’5’ ; display letter 5 ACALL DTA ; call display subroutine

19 16 X 2 LCD Displays: COMD: MOV P3, A ; copy reg A to port 3 CLR P2.0 ; RS=0 for command CLR P2.1 ; R/W=0 for write SETB P2.2 ; E=1 for high pulse ACALL DELAY ; give LCD some time CLR P2.2 ; E=0 for High to Low pulse RET DTA: MOV P3, A ; copy reg A to port 3 SETB P2.0 ; RS=1 for data CLR P2.1 ; R/W=0 for write SETB P2.2 ; E=1 for high pulse ACALL DELAY ; give LCD some time CLR P2.2 ; E=0 for High to Low pulse RET

20 16 X 2 LCD Displays: DELAY: MOV R3, #50 ; 50 or higher for fast CPUs HERE2: MOV R4, #255 ; R4= HERE: DJNZ R4, HERE ; stay until R4 becomes 0 DJNZ R3, HERE2 ; RET END