Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your program must run properly on the CSU Linux computers. Use the provided template as your starting point. You may not create any additional variables

Your program must run properly on the CSU Linux computers. Use the provided template as your starting point. You may not create any additional variables (only use the ones in the template) You can not delete or change any of the provided code (changing/deleting newlines is fine, but don't change actual code)

Present a menu to the user with the following options: 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 When the user selects option 1: Print the name and student id of the person who wrote the code 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 all bits to 0 4: specify a file name and save the current register value in binary format to that file (user types the file name) 5: specify a file name and load the register value from that file (user types the file name) 6: set bits 6 and 5 with the following values: 00: OFF 01: Red 10: Green 11: Blue 7: Ask the user to enter two binary bits and set bits 4 and 3 to the entered value (the bit entered first should go to bit 4, and the bit entered second to bit 3) You do not need to worry about the user entering an invalid value. 8: Toggle the 7th bit (reset). If it is currently set to 1, set it to 0, if it is 0 set it to 1. 9: set bit 0 to 1 10: set bit 0 to 0 11: Shift all bits except bit 0 1 to the right (user specifies amount to shift) 12: Set reg to the user specified value (you do not need to consider the user entering a negative value, or a value too large to fit into reg) 0: Exits the program, if any other option is chosen present the menu again after performing the requested task.

bit numbers: 76543210 RCCUUxxP ^ ^ | | MSB LSB

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 0xC1 (or 1100 0001 would have the power and reset bits set to 1, and color would be green)

Template:

#include #include #include #include #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); }

Would you be able to use the existing template, to derive the program, that's required by the instructions?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions

Question

7. Where Do We Begin?

Answered: 1 week ago

Question

a. What is the purpose of the team?

Answered: 1 week ago