Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

INTERRUPT METHOD - USING PORTB CHANGE INTERRUPT

By using 4 by 4 matrix keypad connected to PORTA and PORTB. The rows are connected to PORTA-Low (RA1-RA4) and the columns are connected to PORTB-High (RB4-RB7),

which is the PORTB-Change interrupt. The matrix keypad connection operation is explained in the following stages:

1 When the preceding key is released, Zero's will be the output to all rows at once and columns would be read and checked often until the column becomes high. If high, the program waits for a short period of time and then it returns next stage, i.e. waiting for a key to be pressed.
2 To ensure that a key is pressed, the columns are connected to the PORTB-Change interrupt. Hence, if a key pressed, this will cause an interrupt and microcontroller to execute the ISR. The main duty of the ISR is to ensure that the first key press was not erroneous as a result of noise as well as waiting for 20ms to prevent the key press from being interrupted as multiple key presses.
3 Detecting which row the key pressed belongs to, the microcontroller grounds one row at a time and then read the column each time. If all columns are detected HIGH, then the key press cannot belong to that row: hence it grounds the next row and continues until it finds the row the key press belongs.
4 To recognize the key press, the microcontroller rotates the column bits, i.e. a bit at a time, into the carrying flag and check to see if it is set LOW.

SCANNING METHOD

This is done by switching only one ROW at a time to be low. For example, If I set ROW1 low we can then read just the top row of buttons, button 1 will take COL1 low, button2 will take COL2 low, and the same for buttons '3' and 'F' in COL 3 and COL 4.

Hence, the other 12 lower buttons would not have any effect because their respective ROW lines are still high. So to read the other keys we need to take their respective ROW lines low, i.e. taking ROW2 low will allow us to read the second row of buttons (4, 5, 6, and E) again as the other three ROW lines are now high, the other 12 buttons have no effect.

We can then repeat this for the last two Row's using ROW3 and ROW4, so we read four buttons at a time, taking a total of four readings to read the entire keypad. This is a common technique for reading keyboards, and is known as 'Keyboard Scanning'.

However, one obvious problem that may occur is that "What will happens if more than one key is pressed at a time?", there are a number of ways to deal with this, although I might not include this stage in my code, but if time permit me I will try to do so. The methods are as follows:
1) To check for multiple key presses and ignore them,
2) To accept the first key, then find which is pressed. This way is simpler.
Various commercial products deal with this situation in similar ways, some reject multiple key presses, and some just accept the first one.

Firstly, check to see if any of the 12 keys are pressed (by making all the ROW lines low) and waiting until no keys are pressed; this will avoid problems with key presses repeating.

If no keys are pressed or detected, it jumps to the routine Keys which repeatedly scans the keyboard until a key is pressed, and the call for a delay.

Once a key has been pressed the result is returned in the variable e.g. 'key', and then logically AND with 0x0F to be entirely sure it's between 0 and 15. Then the next this value is passed to a look-up table or Key mapped matrix i.e. [COL] [ROW] which translates the key to its required value (in this case the ASCII value of the labels on the keys).

Finally, the ASCII value is stored back in the 'key' variable (just in case you might need it storing) and the routine returns with the ASCII value in the working (W) register.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9523872

Have any Question?


Related Questions in Computer Engineering

Question write a minimum of 100 words for each question

Question: Write a minimum of 100 words for each question. Provide Citation and reference for each question. Provide two responses for each question. 1. Let us suppose we are designing a computer for use for a graphic art ...

Question discuss the advantages and disadvantages of

Question: Discuss the advantages and disadvantages of Incident Response testing. When is each type of testing appropriate? Are there situations that preclude the use of a particular type of testing? Requirement: I recomm ...

Need references for information for the following dealing

Need references for information for the following dealing with CSMS (Consolidated Sales and Marketing System Project) Produce a narrative which describes the added error-handling pathways that includes: an overview of th ...

What is unified threat management utm and the services it

What is Unified Threat Management (UTM) and the services it combines into one device. Does UTM holds true to the principle of defense-in-depth

Some seem to believe that we should be pure maximizers

Some seem to believe that we should be pure maximizers. Others say that we do better as constrained maximizers. Which view does David Schmidtz endorse and why?

Wat are three 3 major categories of cyber terrorism and

What are three (3) major categories of cyber terrorism and / or information warfare. Among the chosen categories, determine the one (1) that should be the top priority for the federal government to address.

Describe an ethical conundrum found in a magazine or

Describe an ethical conundrum found in a magazine or newspaper article, and please give your own thoughts. Give good citations, of course.

A blaster rifle manufacturing facility on naboo has 6500

A blaster rifle manufacturing facility on Naboo has 6,500 employees. The employees were asked whether they preferred a four-day work week (10 hours per day), a five- day work week (8 hours per day), or flexible hours. Yo ...

Suppose users share a 3 mbps link also suppose each user

Suppose users share a 3 Mbps link. Also suppose each user requires 150 kbps when transmitting, but each user transmits only 10 percent of the time. When circuit switching is used, how many users can be supported? For the ...

The contracts manager at a company needs to make a large

The contracts manager at a company needs to make a large legal document available to an overseas customer. However, she has some challenges: The document contains sensitive information; it is too large to send via e-mail ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As