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
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