Hardware Reference
In-Depth Information
L7.3 Keypad input. Use the circuit shown in Figure 7.7 to perform keypad input practice. The
procedure is as follows:
Step 1
Configure the upper four pins of Port P3 for output and the lower four pins of P3 for input.
Step 2
Initialize the LCD properly.
Step 3
Output the message “Enter an integer:” on the first row of the LCD. After seeing this
message, you enter a number on the keypad. Use the F key (or other key) to terminate
the number. Your program reads in the number, converts it into a binary, and saves it in a
buffer.
Step 4
Output the message “Enter another integer:” on the first row of the LCD. After seeing this
message, you enter a number on the keypad. Use the F key to terminate the number. Your
program reads in the number, converts it into a binary, and saves it in a buffer.
Step 5
Compute the gcd of these two numbers and display it on the LCD screen as follows:
The gcd of xxxx and
yyyy is zzzz.
where xxxx and yyyy are the numbers that you entered from the keypad and zzzz
is the gcd of these two numbers.
 
Search WWH ::




Custom Search