chap 2lesson09emsysnew

22
2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal, Publs.: McGraw-Hill Education 1 8051 AND ADVANCED PROCESSOR ARCHITECTURES AND REAL WORLD INTERFACING Lesson-9 Interfacing examples with keyboard, displays, D/A and A/D Conversions

Upload: phuc-vu-viet-phuc

Post on 04-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 1/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

1

8051 AND ADVANCED PROCESSOR 

ARCHITECTURES AND REAL WORLDINTERFACING––

Lesson-9 Interfacing examples withkeyboard, displays, D/A and A/D

Conversions

Page 2: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 2/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

2

1.1. KeyboardKeyboard

Page 3: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 3/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

3

Keyboard Interface to Serial Interface atKeyboard Interface to Serial Interface atMicrocontroller Microcontroller 

Processoror Microcontroller

SI

INTR 

INTA

Keyst0

t1

t2

TxD

Debouncer 

ROMKeycode

8-bit buffer 

Scan clock,

counter,

decoder Interface

KBINT

RxD

Page 4: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 4/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

4

Two signals KBINT andTwo signals KBINT and TxDTxD from afrom akeyboard controller keyboard controller 

• KBINT is interrupt from keyboard

controller.

• TxD is serial UART data output of 

controller connected to RxD at SI in 8051or UART Intel 8250 or UART 16550,

which includes a 16-byte buffer 

Page 5: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 5/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

5

Debouncer Debouncer 

• Bounces create on pressing ─ Each bounce

creates a false pulse.

• Keyboard controller has hardware

debouncer to the care of bouncing of akey.

Page 6: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 6/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

6

Scan Clock Scan Clock 

• Keyboard controller has counter driven by a

scan clock, which continuously increments at

certain rate and scans each key whether thatis in pressed or released state.

Page 7: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 7/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

7

• To encode the keyboard output for a ROM.

• ROM generates the ASCII code output for the pressed key.

• The code accounts the multiple keyssimultaneously pressed.

• Example, Shift key is also pressed then

generate the code for upper case character.

Encoder Encoder 

Page 8: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 8/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

8

TxDTxD

• The code bits are serially transferred as TxD

output

Page 9: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 9/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

9

2.2. LCD display controllerLCD display controller

Page 10: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 10/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

10

LCD Controller InterfaceLCD Controller Interface

Processoror Microcontroller

E

Port

RS

t0

t1

t2

TxDE

ROM

DisplayFont table,

CGRAM

and LCD

driver R/W

Page 11: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 11/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

11

• 3 bits for E, RS and R/W

• 8 output data.• One 8-bit port is used for output data for 

display.

• Another port is used for 3 bits• Section 3.3.4 for details.

Interface to LCD display controller 

Page 12: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 12/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

12

3.3. DACDAC

Page 13: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 13/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

13

• DAC ─ PWM circuit and an integrator.

• PWM ─ 

internal device in amicrocontroller 

• A pulse width register (PWR) is programmed according to a required

analog output.

DAC using PWM and integrator DAC using PWM and integrator 

Page 14: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 14/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

14

• A counter/timer device, which generates

two internal- interrupts one on timer 

overflow and another after an interval proportional to equal to PWR.

• On first interrupt, the output becomes 1and on second interrupt it becomes 0.

PWM FunctioningPWM Functioning

Page 15: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 15/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

15

Integrator Integrator 

• Generates the analog output as per the

 period of output = 1 (period between firstand interrupts) compared to total period of 

output pulses (period between successive

first interrupts).

Page 16: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 16/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

16

DAC Using a DAC external chipDAC Using a DAC external chip

Processor

or Microcontroller

Port

WR 

CS

Vref+Vref-

t0

t1

t2

Writedata 8-

lines

Filter 

OPAMP

DAC

Chip

select

Control

signal-

Write

Page 17: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 17/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

17

4.4. ADCADC

Page 18: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 18/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

18

ADC Using ADC external chipADC Using ADC external chip

Processor

or

Micro-

controller

Port

Start

ChAddr

Vref+Vref-

t0

t1

t2

Read data 8-

lines

Signal

conditioners

Multi channel

analog sample

inputs

ADC

Ch Addr

INTR

CS

t3

t4

Page 19: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 19/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

19

ADCADC

Start of conversion pulse generator 

circuit,

A sample hold amplifier circuit to holdthe signal constant for the conversion

 period and signal conditioner  Voltage references + and − for 

 providing the reference for conversion

of analog input

Page 20: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 20/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

20

nn-- bit ADC bit ADC

• A four or eight channel ADC is inbuilt in

microcontrollers or 

• an external ADC for example, ADC0808• Interfacing similar to that to the ports.

Page 21: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 21/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

21

SummarySummary

We learnt

• Keyboard controller and its interfacing

• Keyboard units- scan clock, debouncer,

encoder, ROM, driver 

• LCD display controller interface

• DAC interface using PWM and integrator 

• DAC interface using external DAC• ADC interface using external ADC

Page 22: Chap 2Lesson09EmsysNew

7/31/2019 Chap 2Lesson09EmsysNew

http://slidepdf.com/reader/full/chap-2lesson09emsysnew 22/22

2008 Chapter-2 L9: "Embedded Systems - " , Raj Kamal,Publs.: McGraw-Hill Education

22

End of Lesson 9 of Chapter 2End of Lesson 9 of Chapter 2