Lec16 - ECE 212 Digital Circuits II Monday, 31 March 2008...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1 ECE 212 Digital Circuits II Monday, 31 March 2008 HW Set 16 : Problem 1 No presenter. Problem 2 Laura P. Problem 3 No presenter. Problem 4 Rob S. Problem 5 No presenter. Problem 6 Sheena S. Second Exam Take-home assembly language problems. On the web site: Wednesday, 9 April. Due: Monday, 14 April.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Lecture 16 Goals To introduce subroutines from the top down: To understand subroutine parameters. To understand how to call a subroutine. To understand how to write a subroutine. Problem Design a digital system: Input: Sixteen Bytes (one at a time) from a data source. Output: Sixteen Bytes to a data destination. Each Byte represents a signed integer using Ones' Complement Notation. Operation: Read all sixteen input Bytes. Replace any occurrence of – 0 with +0. Send the sixteen Bytes. Data Source The System Data Destination Ones' Complement Notation: –0 1 1 1 1 1 1 1 1 + 0 0 0 0 0 0 0 0 0
Background image of page 2
3 Solution: Hardware Data Source Data Destination 6812 Port A Port B Solution: Software v. 1.0 .equ PortA, 0x0000 .equ PortB, 0x0001 .equ DBug12, 0xf000 .data ;Sixteen-Byte Buffer. Buff: .space 16 .text main: ;Read all sixteen input Bytes. ;Replace –0 with +0. ;Send the sixteen Bytes. jmp DBug12 bsr GetBytes bsr Replace bsr SendBytes Why use subroutines? bsr (label) Branch to subroutine. Program organization. Program management. Write it once, use it often. Where do we find them? In DBug12. We write them. The solution outline.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
'Read16' Subroutine Specification A bit restrictive. Option I: Read 16 Bytes from Port A; put them into the buffer that begins at the location denoted by B. void GetBytes(void); Option II: Read N Bytes from Port A; put them into the buffer that begins at the location denoted by B. void GetBytes(int N); N is a parameter (a pre-condition) of the subroutine. How do we send the value of N to the subroutine? (How do we pass the parameter to the subroutine?) Before calling the subroutine, put the value of N into D. .equ PortA, 0x0000 .equ PortB, 0x0001 .equ DBug12, 0xf000 .data ;Sixteen-Byte Buffer. Buff: .space 16 .text main: Software v. 2.0 ;Set up the parameter: ; D = 16 Bytes to read; ;Read sixteen input Bytes. ;Replace –0 with +0.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/17/2008 for the course ECE 212 taught by Professor Greco during the Spring '08 term at Lafayette.

Page1 / 14

Lec16 - ECE 212 Digital Circuits II Monday, 31 March 2008...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online