Professional Documents
Culture Documents
Question#1: Write a program that takes 8-bit input data at port P1 when a positive pulse is sensed on P2.3
and find the position of the first ‘1’ in the 8-bit data.
Question#2: Write a program that takes three 4-bit numbers as input on port P2, one by one, and send the
largest number on port P3. User prepares a 4-bit number over the binary switches, and then sets the control
switch to logic 0 and then back to logic 1 (1-0-1). This process is repeated three times to get three input
numbers.
Question#3: We have a list of four 2-digit numbers stored in the ROM in the form of comma-separated
strings. Like list db: “12”, ... , “89”. Write a program that converts the 2-digit number string into binary and
displays the result on port P2 for one second, and then displays the next number for one second, and so on.
Example:
For a 2-digit number “12” the result on port P2 will be 0000 1100
Question#4: Write a program that takes input of one digit from 4x3 keypad. Assign ten decimal value to ‘*’
button and eleven decimal value to ‘#’ button. After getting the input, display the square of the input on 2x16
LCD and get ready to entertain another input.
Example:
If user clicks ‘#’ button on 4x3 keypad, then display on LCD screen will be:
121
Note: For every new input, clear the LCD screen before displaying the corresponding result.