hw14SLN - ECE 212 HW Set 14 SOLUTIONS p 1 of 5

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

View Full Document Right Arrow Icon
ECE 212 HW Set 14 SOLUTIONS p 1 of 5 //home/vdimitrov/25473/8328b3d8b32eae50c0edada130f8aab56f29857b.doc ECE 212 Homework Set 14 SOLUTIONS 1. (a) For the data section given below: Write a 6812 program to: Read a value of n from Port A; Use this value to locate an element in the string str1 of ASCII codes; (n = 0 corresponds to the first element in the string). Copy this element into the first location of the buffer Buff that allocates space for sixteen Bytes. You may assume that the value of n will be within the length of the string. (b) How many elements are in the string? What is the maximum value for n? .data v1: .space 1 Tbl1: .byte 0x11,0x22,0x33 v2: .space 1 Tbl2 .word 0x1122,0xabcd v3: .space 1 Buff: .space 16 str1: .ascii "A string of ASCII codes." A Solution: (a) main: ldaa PortA ;Get the value of n. ldx #str1 ;Point to the start of str1. ldab A,X ;Get the element from the string stab Buff ; and put in the first Byte of the buffer. jmp DBug12 (b) The number of elements in the string = the number of characters in the string = 24. The value of n runs from 0 to 23. Another Solution:
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

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

Page1 / 5

hw14SLN - ECE 212 HW Set 14 SOLUTIONS p 1 of 5

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

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