While scanning a 4X4 keyboard, the key code read from the port is a byte with...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
While scanning a 4X4 keyboard, the key code read from the port is a byte with the upper nibble holding a '0' in the row position of the pressed key and the lower nibble holding a 0 in the column position of the key. All other bits are '1'. We want to convert this code to a key number, where: key number = 4 * row number + column number. We propose to do it by a table look up, where we set up a table in code memory of 16 single byte entries. Each entry in this table returns the row/column number when indexed by the row/column nibble in the key code. Entries for illegal combinations of bits in the key code are set to -1. Write a function in 8051 assembly language using this look up table, which will be called with A holding the 8 bit Key code. It should re- turn the key number in A if the code is a valid combination of bits. The return value should be -1 for illegal bit combinations. All registers other than A must be preserved. Your code should be clear and well commented. Code without comments or with poor commenting will incur marks penalty. While scanning a 4X4 keyboard, the key code read from the port is a byte with the upper nibble holding a '0' in the row position of the pressed key and the lower nibble holding a 0 in the column position of the key. All other bits are '1'. We want to convert this code to a key number, where: key number = 4 * row number + column number. We propose to do it by a table look up, where we set up a table in code memory of 16 single byte entries. Each entry in this table returns the row/column number when indexed by the row/column nibble in the key code. Entries for illegal combinations of bits in the key code are set to -1. Write a function in 8051 assembly language using this look up table, which will be called with A holding the 8 bit Key code. It should re- turn the key number in A if the code is a valid combination of bits. The return value should be -1 for illegal bit combinations. All registers other than A must be preserved. Your code should be clear and well commented. Code without comments or with poor commenting will incur marks penalty.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these electrical engineering questions
-
Write a C++ code to read characters from the keyboard until a zero is read. Use a controlled while loop to find the number of nonzero characters read from the keyboard, Display the number found.
-
A byte is a sequence of eight bits and each bit is either 0 or 1. (a) How many different bytes are possible? (b) If the first bit of a byte is a parity check, that is, the first byte is determined...
-
Using Data Set 1 from Appendix B, if we let the predictor variable x represent heights of males and let the response variable y represent weights of males, the sample of 10-4 Prediction Intervals and...
-
Given the following set of slope staking notes: C Sta 51+00 50+00 49+00 L CX 33.4 F 9.1 33.6. F 10.3 35.4 C 5.5 0.0 F 3.5 R C 3.2 X C 4.1 30.2 0.0 20.0 Bases Base for cut=48 ft Base for fill= 40 ft s...
-
Supply the missing income statement amounts for each of the following companies (amounts adapted, in millions): Requirement Prepare the income statement for Baker Company for the year ended December...
-
What AGMA standard should be consulted for data on the allowable stresses for steels used for gears?
-
Danielle Altman, the chief economist at Instawork, wrote an opinion column in the Wall Street Journal in which he described frictional unemployment as joblessness during the job-search process . . ....
-
Afton Co. Purchased $24,000 of 4%, 10-year Davis Country bonds on July 12, 2012, directly from the country at par value. The bonds pay semiannual interest on May 1 and November 1. On December 1,...
-
17. A concave mirror produces a real image 10mm tall, of an object 2.5mm tall placed at 5cm from the mirror. Calculate focal length of the mirror and the position of the image. 18. An object is...
-
You are an Examiner for the Refund Integrity Program in the GST/HST Audit Division of the Canada Revenue Agency (CRA). Using sophisticated analytical tools, you are able to identify GST/HST returns...
-
Case Report Instructions Address your Report to Brett Ricard. Address discussion questions 2 and 3 in your report: how should Promontory target, and how should it manage its sales force?
-
Johnston International, a U.S. firm, signs a contract with Irkut, Ltd., a Russian company, to give Irkut the right to sell Johnstons products in Russia. This is a. a distribution agreement. b. a...
-
The U.S. Fish and Wildlife Service orders Bill to stop using a certain type of fishing net from his boat. Before a court will hear Bills appeal of the order, Bill must a. exhaust all other means of...
-
China, which governs Hong Kong, seizes the property of Mack Enterprises, Inc., a U.S. firm doing business in Hong Kong, without paying the owners just compensation. This is a. a confiscation. b....
-
Since 2000, the value of U.S. imports of mens and boys apparel from China has more than tripled. What prediction does the Heckscher-Ohlin model make about the wages received by labor in China?
-
Price discrimination occurs when a seller forbids a buyer from buying products from the sellers competitors. (True/False)
-
How do viruses mutate and evolve?
-
Complete the following acid-base reactions: (a) HCCH + NaH
-
What is the maximum overhead in byte-stuffing algorithm?
-
Suppose that there are 10 RFID tags around an RFID reader. What is the best value of Q? How likely is it that one tag responds with no collision in a given slot?
-
What is the minimum bandwidth needed to achieve a data rate of B bits/sec if the signal is transmitted using NRZ, MLT-3, and Manchester encoding? Explain your answer.
-
The Boundary Waters Canoe Area Wilderness (BWCA) located in northeastern Minnesota has 1 million acres of wilderness, 1,000 waterways, and 1,500 miles of canoe routes. While some youth, for example...
-
A public recreation area is under planning. The initial cost of the area is \(\$ 1,800,000\), and it will have maintenance costs of \(\$ 200,000 /\) year. It is estimated that 90,000 persons will...
-
Suppose Lincoln Park Zoo decided to charge admission just for the newly renovated area described in Problem 11. Suppose the price is set at the average perceived benefit per visit, reasoning that the...
Study smarter with the SolutionInn App