Download presentation
Presentation is loading. Please wait.
Published byAbel Phelps Modified over 9 years ago
1
Homework 1, 2 First version, using arbitrary C environment, -Task 1 due : 6,7,8 September -Task 2 due : 13,14,15 September Final version, using THRSim11 C environment, due at the beginning of your lab section Tuesday, Wednesday, or Thursday, September 20-22, 2005 4 points 2 points
2
Task 1: Specify a menu system for an arbitrarily selected microcontroller application. Your menu system should consists of at least four levels have a form of an unbalanced tree have at least two items in each menu allow going UP by pressing “*”, and going HOME (to the root node) by pressing “#” Each menu should start from the menu number Each item in the menu should start from two digits first digit = menu level second digit = position in a given menu NO CLASSES, structs OK
3
3-1 3-2 7 3-1 3-2 8 3-1 3-2 9 3-1 3-2 10 3-1 3-2 11 2-1 2-2 3 2-1 2-2 4 2-1 2-2 5 2-1 2-2 6 1-1 1-2 2 1-1 1-2 1 0-1 0-2 0 action
4
0-1 Meals 0-2 Beverages Menu 0 Lunch 1-1 Sandwiches 1-2 Salads Menu 2 Meals 1-1 Hot 1-2 Cold Menu 3 Beverages Specify each item of the menu in detail
5
Task 2: Write a general program to display arbitrary menu of this form. General: menu system defined using data structures only; program independent of the exact shape and contents of the menu system source of input and output can be easily changed with the minimum change in the contents of the program input: keyboard, switch button, keypad output: monitor, LED 7-segment display, LCD display program portable among various C environments
6
Suggested Program Structure menu_desc.c menu.h description of the menu system application dependent type definitions, application independent menu_ctrl.c function(s) controlling the operation of the menus io.h independent of input/output devices application contents of the menus low-level input/output functions dependent on input/output devices main.cmain program, application dependent io.c i/o function declarations, i/o dependent
7
Required Reading Kernighan, Ritchie, The C Programming Language Chapter 1. A Tutorial Introduction Chapter 5. Pointers and Arrays Chapter 7. Input and Output Recommended Reading Kernighan, Ritchie, The C Programming Language Chapter 2. Types, Operators, and Expressions Chapter 3. Control Flow Chapter 4. Functions and Program Structures Chapter 6. Structures
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.