SlideShare a Scribd company logo
1 of 11
EE 134 / EE 101
Spring, 2002
Lecture 19
Exam 2 Solutions
Problem 1. Figure 9.16 in text: Input Handshake Timing Diagrams
Peter Spasov
Microcontroller Technology: The
68HC11, Fourth Edition
Copyright ©2002 by Pearson Education, Inc.
Upper Saddle River, New Jersey 07458
All rights reserved.
We are using
Interlocked mode.
STRB active low.
We are not using
pulsed mode here.
Another view of Problem 1: FIGURE 9-19 Centronics Parallel Interface Timing Diagram
Peter Spasov
Microcontroller Technology: The
68HC11, Fourth Edition
Copyright ©2002 by Pearson Education, Inc.
Upper Saddle River, New Jersey 07458
All rights reserved.
68HC11
PORTC
STRA
STRB
PORTCL is read
Data is latched into PORTCL
The Centronics
standard is a good
example of input
handshaking, where
the MCU is inside
the printer.
In this problem
we do not have
an ACK signal.
* EE101/EE134 Exam 2 (The following is just a sample Main program)
Main
LDX #REGBAS ;set IX for indexed addressing of ports
BSR Init_PortC
New_Data
BSR Input_Data
BSR Display_Bit
BRA New_Data
*********************************************************
*Subroutine: Initialize Port C
*The MCU receives parallel data from the peripheral
*using interlocked handshaking.
* HNDS = 1, all other bits = 0
*Calling register: IX = REGBAS
*Return regiester: none, but ACCA changed
Init_PortC
BCLR DDRC,X $FF ; all inputs (It was OK to not include this)
LDAA #$10
STAA PIOC,X
RTS
*********************************************************
*Subroutine: Wait for data in PORTCL
*Calling register: IX = REGBAS
*Return register: ACCA contains input data
Input_Data
BRCLR PIOC,X $80 Input_Data ; wait for STAF=1
LDAA PORTCL,X ; ACCA = data
RTS
Problem 3: FIGURE 9-3 Seven-Segment LED Display Connections
Peter Spasov
Microcontroller Technology: The
68HC11, Fourth Edition
Copyright ©2002 by Pearson Education, Inc.
Upper Saddle River, New Jersey 07458
All rights reserved.
This is the type
of LED display
specified in the
problem.
A low (zero) bit
turns that segment
on.
FIGURE 9-4 Seven-Segment Code Examples
Peter Spasov
Microcontroller Technology: The
68HC11, Fourth Edition
Copyright ©2002 by Pearson Education, Inc.
Upper Saddle River, New Jersey 07458
All rights reserved.
*********************************************************
*Subroutine: Display 0 if Z set, 1 if Z clear
*Uses common-anode 7-segment LED display (0=on, 1=off)
*Assume PB0 -> a, PB1 -> b, ..., PB6 -> g, PB7 -> N.C.
*Calling registers: IX = REGBAS, Z bit in CCR
*Return register: none, but ACCA changed
Display_Bit
BNE One ; be sure Z isn't changed before test
Zero
LDAA #$40 ; or $C0
STAA PORTB,X
RTS
One
LDAA #$79 ; or $F9
STAA PORTB,X
RTS
Problem 4: FIGURE 9-9 3 x 4 Matrix Keyboard (Telephone Format)
Peter Spasov
Microcontroller Technology: The
68HC11, Fourth Edition
Copyright ©2002 by Pearson Education, Inc.
Upper Saddle River, New Jersey 07458
All rights reserved.
Problem 4: FIGURE 9-10 Parallel I/O with Keyboard. Also connect PC7 high using a pull-up resistor.
Peter Spasov
Microcontroller Technology: The
68HC11, Fourth Edition
Copyright ©2002 by Pearson Education, Inc.
Upper Saddle River, New Jersey 07458
All rights reserved.
With this layout we need to
setup the Port C Data Direction
Register, DDRC, with $0F.
Problem 5:
a. Printers
b. Instruments
c. One microsecond (two clock cycles)
d. IRQ
e. 0
f. $D6
g. $1007
h. 0 (or no change)
i. Read, receive, or load
j. Data bus

More Related Content

What's hot

An_FPGA_Based_Passive_K_Delta_1_Sigma_Modulator
An_FPGA_Based_Passive_K_Delta_1_Sigma_ModulatorAn_FPGA_Based_Passive_K_Delta_1_Sigma_Modulator
An_FPGA_Based_Passive_K_Delta_1_Sigma_Modulator
Matthew Albert Meza
 
Fpga 09-behavioral-modeling-moore-machine
Fpga 09-behavioral-modeling-moore-machineFpga 09-behavioral-modeling-moore-machine
Fpga 09-behavioral-modeling-moore-machine
Malik Tauqir Hasan
 
EE312 Embedded Microcontrollers Lab
EE312 Embedded Microcontrollers LabEE312 Embedded Microcontrollers Lab
EE312 Embedded Microcontrollers Lab
Loren Schwappach
 
Dw2645274531
Dw2645274531Dw2645274531
Dw2645274531
IJMER
 

What's hot (19)

8085 branching instruction
8085 branching instruction8085 branching instruction
8085 branching instruction
 
Msp430 assembly language instructions &addressing modes
Msp430 assembly language instructions &addressing modesMsp430 assembly language instructions &addressing modes
Msp430 assembly language instructions &addressing modes
 
My Project
My ProjectMy Project
My Project
 
TinyML - 4 speech recognition
TinyML - 4 speech recognition TinyML - 4 speech recognition
TinyML - 4 speech recognition
 
Bcd to 7 segment display
Bcd to 7 segment displayBcd to 7 segment display
Bcd to 7 segment display
 
MOSFET based Digital Circuits
MOSFET based Digital CircuitsMOSFET based Digital Circuits
MOSFET based Digital Circuits
 
A Low power and area efficient CLA adder design using Full swing GDI technique
A Low power and area efficient CLA adder design using Full swing GDI techniqueA Low power and area efficient CLA adder design using Full swing GDI technique
A Low power and area efficient CLA adder design using Full swing GDI technique
 
Seven Segment Displau
Seven Segment DisplauSeven Segment Displau
Seven Segment Displau
 
An_FPGA_Based_Passive_K_Delta_1_Sigma_Modulator
An_FPGA_Based_Passive_K_Delta_1_Sigma_ModulatorAn_FPGA_Based_Passive_K_Delta_1_Sigma_Modulator
An_FPGA_Based_Passive_K_Delta_1_Sigma_Modulator
 
5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron) 5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron)
 
Branching instructions in 8086 microprocessor
Branching instructions in 8086 microprocessorBranching instructions in 8086 microprocessor
Branching instructions in 8086 microprocessor
 
Fpga 09-behavioral-modeling-moore-machine
Fpga 09-behavioral-modeling-moore-machineFpga 09-behavioral-modeling-moore-machine
Fpga 09-behavioral-modeling-moore-machine
 
A NEW APPROACH TO DESIGN LOW POWER CMOS FLASH A/D CONVERTER
A NEW APPROACH TO DESIGN LOW POWER CMOS FLASH A/D CONVERTERA NEW APPROACH TO DESIGN LOW POWER CMOS FLASH A/D CONVERTER
A NEW APPROACH TO DESIGN LOW POWER CMOS FLASH A/D CONVERTER
 
Tensorflow lite for microcontroller
Tensorflow lite for microcontrollerTensorflow lite for microcontroller
Tensorflow lite for microcontroller
 
EE312 Embedded Microcontrollers Lab
EE312 Embedded Microcontrollers LabEE312 Embedded Microcontrollers Lab
EE312 Embedded Microcontrollers Lab
 
18 ec41 analog circuits model papers
18 ec41 analog circuits model papers18 ec41 analog circuits model papers
18 ec41 analog circuits model papers
 
SPICE MODEL of BT151X-650 in SPICE PARK
SPICE MODEL of BT151X-650 in SPICE PARKSPICE MODEL of BT151X-650 in SPICE PARK
SPICE MODEL of BT151X-650 in SPICE PARK
 
Pp05
Pp05Pp05
Pp05
 
Dw2645274531
Dw2645274531Dw2645274531
Dw2645274531
 

Similar to Exam 2 solutions

Find all hazards in this circuit. Redesign the circuit as a three-le.pdf
Find all hazards in this circuit.  Redesign the circuit as a three-le.pdfFind all hazards in this circuit.  Redesign the circuit as a three-le.pdf
Find all hazards in this circuit. Redesign the circuit as a three-le.pdf
Arrowdeepak
 
Embedded system (Chapter 3) io_port_programming
Embedded system (Chapter 3) io_port_programmingEmbedded system (Chapter 3) io_port_programming
Embedded system (Chapter 3) io_port_programming
Ikhwan_Fakrudin
 
What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdf
SIGMATAX1
 
8251
82518251
8251
Aisu
 

Similar to Exam 2 solutions (20)

LCD WITH 8051.docx
LCD WITH 8051.docxLCD WITH 8051.docx
LCD WITH 8051.docx
 
Find all hazards in this circuit. Redesign the circuit as a three-le.pdf
Find all hazards in this circuit.  Redesign the circuit as a three-le.pdfFind all hazards in this circuit.  Redesign the circuit as a three-le.pdf
Find all hazards in this circuit. Redesign the circuit as a three-le.pdf
 
Program LCD ARM
Program LCD ARMProgram LCD ARM
Program LCD ARM
 
PIC16F877A C Programming.ppt
PIC16F877A C Programming.pptPIC16F877A C Programming.ppt
PIC16F877A C Programming.ppt
 
LCD_Example.pptx
LCD_Example.pptxLCD_Example.pptx
LCD_Example.pptx
 
IMPLEMENTING A DIGITAL MULTIMETER
IMPLEMENTING A DIGITAL MULTIMETERIMPLEMENTING A DIGITAL MULTIMETER
IMPLEMENTING A DIGITAL MULTIMETER
 
Analog To Digital Conversion (ADC) Programming in LPC2148
Analog To Digital Conversion (ADC) Programming in LPC2148Analog To Digital Conversion (ADC) Programming in LPC2148
Analog To Digital Conversion (ADC) Programming in LPC2148
 
Analog to Digital Converter
Analog to Digital ConverterAnalog to Digital Converter
Analog to Digital Converter
 
Embedded system (Chapter 3) io_port_programming
Embedded system (Chapter 3) io_port_programmingEmbedded system (Chapter 3) io_port_programming
Embedded system (Chapter 3) io_port_programming
 
PROGRAMMABLE PERIPHERAL INTERFACE (PPI) -8255
PROGRAMMABLE PERIPHERAL  INTERFACE (PPI) -8255PROGRAMMABLE PERIPHERAL  INTERFACE (PPI) -8255
PROGRAMMABLE PERIPHERAL INTERFACE (PPI) -8255
 
What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdf
 
74LS47 / DM74LS47 Datasheet PDF
74LS47 / DM74LS47 Datasheet PDF74LS47 / DM74LS47 Datasheet PDF
74LS47 / DM74LS47 Datasheet PDF
 
Raspberry Pi I/O控制與感測器讀取
Raspberry Pi I/O控制與感測器讀取Raspberry Pi I/O控制與感測器讀取
Raspberry Pi I/O控制與感測器讀取
 
Switch Control and Time Delay - Keypad
Switch Control and Time Delay - KeypadSwitch Control and Time Delay - Keypad
Switch Control and Time Delay - Keypad
 
PANEL LCD lc320w01
PANEL LCD  lc320w01PANEL LCD  lc320w01
PANEL LCD lc320w01
 
Em s7 plc
Em s7 plcEm s7 plc
Em s7 plc
 
8251
82518251
8251
 
8085_MicroelectronicAndMicroprocess.pdf
8085_MicroelectronicAndMicroprocess.pdf8085_MicroelectronicAndMicroprocess.pdf
8085_MicroelectronicAndMicroprocess.pdf
 
1.pdf
1.pdf1.pdf
1.pdf
 
Lcd interfacing
Lcd interfacingLcd interfacing
Lcd interfacing
 

Recently uploaded

1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
chumtiyababu
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 

Recently uploaded (20)

1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 

Exam 2 solutions

  • 1. EE 134 / EE 101 Spring, 2002 Lecture 19 Exam 2 Solutions
  • 2. Problem 1. Figure 9.16 in text: Input Handshake Timing Diagrams Peter Spasov Microcontroller Technology: The 68HC11, Fourth Edition Copyright ©2002 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved. We are using Interlocked mode. STRB active low. We are not using pulsed mode here.
  • 3. Another view of Problem 1: FIGURE 9-19 Centronics Parallel Interface Timing Diagram Peter Spasov Microcontroller Technology: The 68HC11, Fourth Edition Copyright ©2002 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved. 68HC11 PORTC STRA STRB PORTCL is read Data is latched into PORTCL The Centronics standard is a good example of input handshaking, where the MCU is inside the printer. In this problem we do not have an ACK signal.
  • 4. * EE101/EE134 Exam 2 (The following is just a sample Main program) Main LDX #REGBAS ;set IX for indexed addressing of ports BSR Init_PortC New_Data BSR Input_Data BSR Display_Bit BRA New_Data ********************************************************* *Subroutine: Initialize Port C *The MCU receives parallel data from the peripheral *using interlocked handshaking. * HNDS = 1, all other bits = 0 *Calling register: IX = REGBAS *Return regiester: none, but ACCA changed Init_PortC BCLR DDRC,X $FF ; all inputs (It was OK to not include this) LDAA #$10 STAA PIOC,X RTS ********************************************************* *Subroutine: Wait for data in PORTCL *Calling register: IX = REGBAS *Return register: ACCA contains input data Input_Data BRCLR PIOC,X $80 Input_Data ; wait for STAF=1 LDAA PORTCL,X ; ACCA = data RTS
  • 5. Problem 3: FIGURE 9-3 Seven-Segment LED Display Connections Peter Spasov Microcontroller Technology: The 68HC11, Fourth Edition Copyright ©2002 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved. This is the type of LED display specified in the problem. A low (zero) bit turns that segment on.
  • 6. FIGURE 9-4 Seven-Segment Code Examples Peter Spasov Microcontroller Technology: The 68HC11, Fourth Edition Copyright ©2002 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.
  • 7.
  • 8. ********************************************************* *Subroutine: Display 0 if Z set, 1 if Z clear *Uses common-anode 7-segment LED display (0=on, 1=off) *Assume PB0 -> a, PB1 -> b, ..., PB6 -> g, PB7 -> N.C. *Calling registers: IX = REGBAS, Z bit in CCR *Return register: none, but ACCA changed Display_Bit BNE One ; be sure Z isn't changed before test Zero LDAA #$40 ; or $C0 STAA PORTB,X RTS One LDAA #$79 ; or $F9 STAA PORTB,X RTS
  • 9. Problem 4: FIGURE 9-9 3 x 4 Matrix Keyboard (Telephone Format) Peter Spasov Microcontroller Technology: The 68HC11, Fourth Edition Copyright ©2002 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.
  • 10. Problem 4: FIGURE 9-10 Parallel I/O with Keyboard. Also connect PC7 high using a pull-up resistor. Peter Spasov Microcontroller Technology: The 68HC11, Fourth Edition Copyright ©2002 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved. With this layout we need to setup the Port C Data Direction Register, DDRC, with $0F.
  • 11. Problem 5: a. Printers b. Instruments c. One microsecond (two clock cycles) d. IRQ e. 0 f. $D6 g. $1007 h. 0 (or no change) i. Read, receive, or load j. Data bus