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...
-
A coaxial line 5.6 m long has distributed parameters R = 6.5 /m, L = 3.4H/m, G = 8.4mS/m, and C = 21.5pF/m. If the line operates at 2 MHz, calculate the characteristic impedance and the end-to-end...
-
Assume you are in Cupertino's position and know you have to do something about the improper accounting in the Southern sales division. Consider the following in crafting a plan how best to voice your...
-
How is risk measured in a market economy?
-
On January 1, 2010 Cale Corp. paid $1,020,000 to acquire Kaltop Co. Kaltop maintained separate incorporation. Cale used the equity method to account for the investment. The following information is...
-
Assume a population of 1, 3, and 8. Assume that samples of size n = 2 are randomly selected with replacement from the population. Listed below are the nine different samples. Complete d below. 1,1...
-
a. How (conceptually) is the discount rate for capital budgeting purposes defined and calculated? Is this number appropriate for analyzing the asset-replacement decision at hand? Why or why not? What...
-
2-year $100 Treasuries paying an annual coupon of $5 are trading at a rate of 5% per year (so priced at par). 2-year Zero-coupon bonds are trading at 5.1% per year. What rate would a one year zero...
-
Budgeted sales for the second quarter for Max&Co Ltd are as follows: Budgeted Sales (units) April60,000 May 120,000 June 140,000 Max&Co started the quarter with an inventory of 30,000 units. The...
-
The headquarters of a national restaurant chain is trying to better understand the profitability of the Savannah location. Savannah's total assets are $3,150,000, consisting of $900,000 land,...
-
A meat packer is investigating the marked mass shown on Vienna sausages. A pilot study showed a mean of 11.8kg per pack and a standard deviation of 0.7kg. How many packs should be sampled in order to...
-
Mr. Jones has two children. The older child is a girl. What is the probability that both children are girls? Mr. Smith has two children. At least one of them is a boy. What is the probability that...
-
Cullumber provides shuttle service between 4 hotels near a medical center and an international airport. Cullumber uses two 10- passenger vans to offer 12 round trips per day. A recent month's...
-
Thank you ???????? Exercise 3-13 Missing data in supplies expense calculations LO4, 5 Determine the missing amounts in each of these four independent situations: is asislea loafsheng a b C d Supplies...
-
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.
-
What risks are involved in an LBO?
-
Explain why an LBO is a type of capital reduction.
-
Can an LBO be carried out on a startup company?
Study smarter with the SolutionInn App