Given the following code and keypad layout, what will the
function GetKey() return when it is run while keys
2, 3, 7, B, E, and F are
pressed?
DDRH = 0x0F;
RDRH = 0x00;
PERH = 0x00;
PIEH = 0x00;
PTH = 0x0F;
unsigned char GetKey(void)
{ unsigned char KeyMask[16] =
{ 0xEE, 0xDE, 0xBE, 0x7E,
0XED, 0xDD, 0xBD, 0x7D,
0xEB, 0xDB, 0xBB, 0x7B,
0xE7, 0xD7, 0xB7, 0x77
};
int i;
char Key;
for (Key=0, i=0; i<16; i++)
{ PTH = KeyMask[i];
if (PTH == KeyMask[i])
{ if (i<10) Key = ‘0’ + i;
else Key = ‘A’+ i - 10;
}
}
PTH = 0x0F;
return (Key);
}
I just saw a code ...and it used common.h header and used the
function getKey() ..to get the keys pressed ....
For up he used a macro like UPKEY , DOWNKEY etc...
The code isnt compiling on my system i guess common.h is not ansi
...I want to implement the same thing ..In my maze game these are
the keys used for the direction
W--up,s -- down,a ---left,d--right.
I want to use the cursor keys for that ....any ANSI fucntion that
can help me with it ....The function GetKey()
return when it is run while keys 2, 3, 7, B, E,
and F are pressed ,it returns the value of
getKey() function from the above circuit diagram when 2 is pressed
it returns o+2,when 3 is pressed it returns 0+3, when 7 is pressed
it returns o+7,when B is pressed it returns A+55,when E is pressed
it returns A+59, when F is pressed it returns A+70. As in the above
code in for loop the given condition of if statements says that
value of i should be i<10 so we implement the above conditions
on given values of 2,3,7 for alphabates we concerders their ASSCCi
then the conditon is in else statement so it follows A+i-10 in this
answer can be finded out. Thank you Hope the above imformation is
enough to understand the concept and finding the getKey() function
returns value.
Given the following code and keypad layout, what will the function GetKey() return when it is...
This is for Java. Create ONE method/function that will return an array containing the row and column of the largest integer i the 2D array. If the largest number is located on row 2, column 1, the method needs to return row 2 and column one. Do not use more than one method. Use the code below as the main. Please comment any changes. in java Given the main, create a method that RETURNS the largest number found in the...
Hello I am having trouble with a connectFour java program. this issue is in my findLocalWinner method, it declares a winner for horizontal wins, but not for vertical. if anyone can see what im doing wrong. public class ConnectFour { /** Number of columns on the board. */ public static final int COLUMNS = 7; /** Number of rows on the board. */ public static final int ROWS = 6; /** Character for computer player's pieces */ public static final...
Can I get help with adding the following to this code please? 1. When buying multiple tickets, if one of the seats selected is already taken, give a message like "Sorry, one or more of the seats selected is already taken." and prompt the user to select the seats all over. (Or if possible to make it suggest a location where the seats are together that the user can select instead) 2. Print the total cost after all of the...
Hi I need help with a java program that I need to create a Airline Reservation System I already finish it but it doesnt work can someone please help me I would be delighted it doesnt show the available seats when running the program and I need it to run until someone says no for booking a seat and if they want to cancel a seat it should ask the user to cancel a seat or continue booking also it...
This code should be Runnable on MARS (MIPS Assembler and Runtime Simulator) IDE Convert the following c code into mips #include <stdio.h> #include <string.h> char cipherText[200] = "anything"; int countNumberOfCharInCipher(char*); int countNumberOfCharInCipher(char* cText) { return strlen(cText); } int countSpaces(int numberOfChar, char input[]) { int spaceCounter =0; for(int i=0; i < numberOfChar; i++) { if(input[i] == 32) spaceCounter++; } return spaceCounter; } void decrypt(int numberOfChar, int key, char * cipherText, char * plainText) { int j = 0; int i =0;...
Edit, compile, and run the following programs on the UNIX shell: Write a program that takes in six commandline arguments and has four functions (described below) that use bitwise operators. The user should enter six space-separated commandline arguments: four characters (any ASCII character) followed by two integers. Anything else should print an error message telling the user what the correct input is and end the program. Convert the commandline input into "unsigned char" and "unsigned int" datatypes. Be careful with...
Question 1: Pointers You are given the following C code and memory diagram. The “contents” column of the memory diagram shows the value of the variable. Update the “contents” column of the memory diagram for each assignment in main(). long *pt; long data; long buffer[4]; void main(void){ pt = &buffer[1]; *pt = 1234; data = *pt; } address contents variable 0x20000000 0x00000000 pt 0x20000004 0x00000000 data 0x20000008 0x00000000 buffer[0] 0x2000000C 0x00000000 buffer[1] 0x20000010 0x00000000 buffer[2] 0x20000014 0x00000000 buffer[3]...
This program is in C++ which reserves flight seats. It uses a file imported to get the seat chart called "chartIn.txt" which looks like this 1 A B C D E F 2 A B C D E F It continues until row 10. Sorry unable to provide the chartIn.txt file. I am having issues with function displaySeats, it displays then but when it comes to 10 the row looks like this 1 0 A B C D E ,...
The following program simulates shuffling a deck of cards. (The line numbers are not ) part of the code). Without changing its functionality, rewrite the program by replacing the 2D array card [52] [2] with a double pointer char **card and replacing the code between line 12 and line 26 with a function. The function prototype could be void shuffleCards (char **, char [, char [) 1 7/Shuffling cards 2 4 using namespace std; 6 main() #include #include <cstdlib> <iostream>...
I need help modifying this program. How would I make sure that the methods is being called and checked in my main method? Here is what the program needs to run as: GDVEGTA GVCEKST The LCS has length 4 The LCS is GVET This is the error that I'm getting: The LCS has length 4 // I got this right The LCS is //the backtrace is not being called for some reason c++ code: the cpp class: /** * calculate...