Homework 1 UCR CS122B Winter 2002 Prof. F. Vahid Due Thursday 1/17/02 at beginning of lecture 1. Spend a minimum of 20 minutes searching the web for embedded system topics. Email the most interesting link or two that you find to the TA, in the following format: 5-10 word description List those links in your homework submission and briefly summarize the site's contents and why you found it interesting. 2. Based on your (albeit limited) search above, develop your own categorization of the different aspects of embedded systems. You should probably have at least 3 to 10 main categories, each with maybe 3-10 subcategories (as a rough guide). One main category might for example be hardware, another might be software tools, another might be conferences, and so on. 3. Consider a handheld radio device with 2 buttons "up" and "down" used to select from channels 0 to 99. You are to design a part of a program that responds to these buttons. "up" and "down" are single-bit inputs, and "channel" is an integer output. The program should start at channel 0. You increment the channel (add 1) when the user presses the up button. However, you should distinguish between real button presses, and bouncing or noise. You should detect 1's appearing on the up signal for perhaps 0.2 seconds. Bouncing may occur after the button is released, where the signal has short bursts of 0's and 1's before settling back to 0. Noise might appear as 1's for a very short duration at any time. If the user continues to hold the up button for two seconds, then you should enter a fast increment mode, incrementing through perhaps 5 channels per second. All of the above discussion similarly applies for the user pressing the down button. The device should wraparound from 99 to 0 and from 0 to 99. (a) Start with a flat Program State Machine having the main states of your program. Flat means that you should have one level of state machine, without any groupings into hierarchical states. You may declare one or more subroutines for measuring time. (b) Translate your Program State Machine into C code using the template in ESD Figure 8.5. (c) Define your time-measuring subroutine(s) using a loop, making reasonable assumptions about your program executing on a processor with single-cycle throughput (one assembly instruction per cycle) running on a 50 MHz machine. Such a routine is obviously not precise, but high precision is not necessary for button presses. (d) How would you modify those subroutines if you could use a built-in timer instead? 4. (a) Modify the elevator's UnitControl of ESD Figure 8.3 to support two speeds (upfast, upslow, downfast, downslow). When just starting or almost stopping, say within 2 floors, the elevator should move at the slower speed. Otherwise, it should move at the higher speed. It should never transition to the higher speed unless it will move at least 4 floors at that speed. (b) Show how you can modify the fire extended UnitControl of Figure 8.7(b) to avoid switching from going up at the faster speed to going down. You need not go down at faster speed in FireMode. Hint: you might consider using a variable decared at the UnitControl level.