C++ programing

profileCR777
hw-06a_nxc-oven-control.pdf

ECE-206 HW-06A Page 1 of 1

HW-06A: NXC Oven Control

An oven has two touch sensors and one temperature sensor. Touch sensor 1 has dual functions: it

is first used to show incremental time in minutes on the display. The time is incremented by five

minutes every 0.5 sec as long as touch sensor 1 is pressed. After the time is accepted, it is then

used to show the incremental temperature in Fahrenheit. The temperature is incremented by ten

degree Fahrenheit every 0.5 sec as long as touch sensor 1 is pressed. Touch sensor 2 is used to

accept the time or temperature displayed when it is pressed. After the time and the temperature

have been set and accepted, the gas will be turned on when the temperature is below the selected

temperature and turned off when the temperature is above the selected temperature. OUT_A is

used to turn the gas on or off. Within the selected time, the display will continuously display the

remaining time. When the time expires, the gas will be turned off and the cooking cycle will be

repeated.

Draw a structured flowchart to control the oven in the manner described above and translate the

flowchart into NXC codes.

Sensors Assignments:

Sensors Type Mode Value Usage

-------------------------------------------------------------------------------------------------------------------- SENSOR1 TOUCH BOOL 1= pressed; 0 = not pressed Choose time or temperature

SENSOR2 TOUCH BOOL 1= pressed; 0 = not pressed Accept time or temperature

SENSOR3 Temperature FAHRENHEIT Cooking temperature

Outputs assignments:

Outputs Value Usage

-------------------------------------------------------------------------------------------------------

OUT_A On = Gas on; Off = Gas off turn gas on or off

Program Requirement:

1. Must include all sensor configurations.

2. Must have a one-to-one mapping with the structured flowchart.

3. Must include a comment header for the description of the program.

4. Must include plenty of comment statements to explain the flow of instructions

5. Must include proper indentation.

Work to do and document to submit:

1. A copy of the structured flowchart.

2. A fully documented NXC program that passed the compilation with no syntax errors.