Question
this function will scan the keypad and return the currently pressed key or 1 if no key is currently pressed. The mapping of the PORTA
this function will "scan" the keypad and return the currently pressed key or 1 if no key is currently pressed. The mapping of the PORTA pins to the keypad is given with the comments on the starter code. The upper four bits of PORTA are connected to the keypad rows. They are shown as outputs, but you will actually "scan" the rows, making them outputs one at a time (and simultaneously making that line a logic 1). When one row pin is an output, the other rows and all columns should be inputs and their associated PORT pin should be zero (so the internal pullup for each is disabled). As each row is activated (made an output) you will check the lower 4 bits of PORTA (the column bits) to see if any are logic 1, and if they are, the pressed key is given by 4*row + col.
Write a function getkey() that takes no arguments and returns a signed character that corresponds to the key pressed or -1 if no key is pressed. Further details are given with the lab writeup for next week's lab. Assume that PORTA, DDRA, and PINA are already defined.
so I need help writing this is anyone can help me.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started