Hello Mohd_fm,
More ascii art - you will need to revise this to match the method you
are using to represent a state transition diagram. For example, in
ESML, the notation is
event
------
action
is used next to the arc between states. The states should be in
rectangles / circles as appropriate as well. The "+-+" notation is
used here to show a line w/ arrow that goes out of the state and back
into the same state. The numbers refer to the event / action pair
listed at the end.
Also note that I explicitly indicated the initial state. This makes
the explanation of the second part of the question much easier.
a. Odometer state transition diagram
2,3 5
1 +-+ 4 +-+
Initial ---> Distance ---> Speed
^ |
| 11 8 v 6
Time <---- Mileage
+-+ +-+
9,10 7
1 - power on; reset TDM [time, distance, mileage], display distance
2 - 200 ms; accumulate TDM, display distance
3 - B press; reset distance, display distance
4 - A press; display speed
5 - 100 ms; accumulate TDM, display speed
6 - A press; display mileage
7 - 500 ms; accumulate TDM, display mileage
8 - A press; display time
9 - B press; reset time, display time
10 - 1 sec; accumulate TDM, display time
11 - A press; display distance
Just a side comment - perhaps for "extra credit". As a user, I would
argue that the specification has a "bug" in it. Pressing the B (reset
accumulated values) should reset both time and distance. At least that
is how the similar option in my car works.
If you implemented what I describe strictly, you could "lose" a little
distance / time each time the A or B button is pressed. To "fix" this,
you would need to accumulate TDM as part of each of those transitions
as well. You might want to make that note as well.
b. Battery state transition
1
Odometer --> Off
^ | 2
+---------+
1 - Battery out; turn off display and odometer
2 - New battery; turn on odometer and display, start at initial state
(the initial state already takes care of TDM reset, setting the
initial display, etc.)
Note that the "battery out" can occur at any state in the Odometer
(other than the initial state).
If this is unclear, please use a clarification request for further
information.
--Maniac |