Question: What does keypad_oku() do in the program below? What is the logic? And please put comments in the code to make it readable(Put comments like

What does "keypad_oku()" do in the program below? What is the logic? And please put comments in the code to make it readable(Put comments like for a person who don't know anything).

# include < 16 f877.h > # fuses XT, NOWDT, NOPROTECT, NOBROWNOUT, NOLVP, NOPUT, NOWRT, NODEBUG, NOCPD #use delay(clock = 4000000) #use fast_io(b)

char keypad_oku() { char tus = 0; output_b(0 x00); output_high(pin_b3); if (input(pin_b0)) { delay_ms(20); tus = 1; } else if (input(pin_b1)) { delay_ms(20); tus = 2; } else if (input(pin_b2)) { delay_ms(20); tus = 3; } output_low(pin_b3); output_high(pin_b4); if (input(pin_b0)) { delay_ms(20); tus = 4; } else if (input(pin_b1)) { delay_ms(20); tus = 5; } else if (input(pin_b2)) { delay_ms(20); tus = 6; } output_low(pin_b4); output_high(pin_b5); if (input(pin_b0)) { delay_ms(20); tus = 7; } else if (input(pin_b1)) { delay_ms(20); tus = 8; } else if (input(pin_b2)) { delay_ms(20); tus = 9; } output_low(pin_b5); return tus; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!