Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can you please derive the code for options 2 and 3, in the above indicated program, with the following code as a starting point: #include
Can you please derive the code for options 2 and 3, in the above indicated program, with the following code as a starting point:
#include
int main() { int sel; char word[1024]; unsigned char reg = 0; while(1) { printf("1)\tAuthor info 2)\tcheck status 3)\tclear status 4)\tsave status 5)\tload status 6)\tset LED color 7)\tSet user value 8)\ttoggle reset 9)\tturn on 10)\tturn off 11)\tShift 12)\tSet value 0)\tExit ");
}
return(0); }
Present a menu to the user with the following options: \begin{tabular}{ll} 1) & Author info \\ 2) & check status \\ 3) & clear status \\ 4) & save status \\ 5) & load status \\ 6) & set LED color \\ 7) & Set user value \\ 8) & toggle reset \\ 9) & turn on \\ 10) & turn off \\ 11) & Shift \\ 12) & Set value \\ 0) & Exit \\ \hline \end{tabular} When the user selects option 2: display the current settings with the following format: Value of stored value (probably reg) if bit 0 (the POWER bit) is 0 display "OFF" otherwise: Color: -color_ reset pin: power pin: user value: for _color_display the color (english word) listed in the section for setting color for reset pin put High if the bit is 1 and low if 0 for power pin: say "ON" if the bit is 1 , otherwise say "OFF" (although this should always be "ON" since if it is off you won't be displaying this menu) for user value, display the value in decimal 3: set a 11 bits to 0 bit numbers: 76543210 RCCUUxxP Bits 1 and 2 are unused, but can be set via the bit shift operation. P - Power bit x - unused U - User value C= color R= reset so a value of 0C1 (or 11000001 would have the power and reset bits set to 1 , and color would be green)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