Question: Consider a light system that is controlled by an 8-bit register, which carries a command to the light system. We call this register Light System

Consider a light system that is controlled by an 8-bit register, which carries a command to the light system. We call this register Light System Command or LSC. Here are the specifications of this register: Bit 0-1 control the light intensity: 00 off, 01 low, 10 medium, 11 high Bit 2-4 control the color: blue 000, green 001, red 010, yellow 011, white 100 Bit 5-7 control the lamps. There are total of 8 lamps numbered from 0 to 7. Example: If we assign OxC3 to LSC, the light system will interpret it as "lt should turn on lamp number # 6 with highest intensity in blue color." A. how the hex value of an LSC that programs light #0 with green color and high intensity. 3 points B. Translate what it means if the value of the LSC is OxAD. 3 points C. Define the masks for three different parts of LSC. Use the following template: 6 oints define INTENSITY MASK #de fine COLOR MASK #de fine LAMP MASK D. Use typedef and enum keywords to define two new types called INTENSITY and COLOR.They will enumerate different color/intensity possibilities. 10 points E. Writes a function that receives an integer representing an LSC and returns the color associated with that command. 10 points // Example: extract (oxC3) returns BLUE COLOR extractcalor (int LSC); F. Write the function that receives three integers representing lamp number, color and intensity and returns the LSC value that sends a command with such characteristics to the light system. 12 points // Example:makeS (6, BLUE, HIGH_INTENSITY) returns 0xC3 Consider a light system that is controlled by an 8-bit register, which carries a command to the light system. We call this register Light System Command or LSC. Here are the specifications of this register: Bit 0-1 control the light intensity: 00 off, 01 low, 10 medium, 11 high Bit 2-4 control the color: blue 000, green 001, red 010, yellow 011, white 100 Bit 5-7 control the lamps. There are total of 8 lamps numbered from 0 to 7. Example: If we assign OxC3 to LSC, the light system will interpret it as "lt should turn on lamp number # 6 with highest intensity in blue color." A. how the hex value of an LSC that programs light #0 with green color and high intensity. 3 points B. Translate what it means if the value of the LSC is OxAD. 3 points C. Define the masks for three different parts of LSC. Use the following template: 6 oints define INTENSITY MASK #de fine COLOR MASK #de fine LAMP MASK D. Use typedef and enum keywords to define two new types called INTENSITY and COLOR.They will enumerate different color/intensity possibilities. 10 points E. Writes a function that receives an integer representing an LSC and returns the color associated with that command. 10 points // Example: extract (oxC3) returns BLUE COLOR extractcalor (int LSC); F. Write the function that receives three integers representing lamp number, color and intensity and returns the LSC value that sends a command with such characteristics to the light system. 12 points // Example:makeS (6, BLUE, HIGH_INTENSITY) returns 0xC3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
