I try to model a device that already works over here. It is a (simple) embedded microcontroller written in C.
Basically what it does is to convert a input voltage to an output loop current (4~20mA).
Usually once, the user want to config the device for a particular sensor.
For example if the user want to have at 1v input a 4mA output instead of 2v input an 4mA output.
[Use case scenario for example]
The user puts the external sensor in the 1v position. (external)
Then the user has to enter the config mode by pressing key 3 for long time(5 sec).
After that the user presses key 1 for a long time again to have the input 1v equals to 4mA output.
If all goes well the user gets a short flashing green led (5 times).
Then the user has the ability to save the new configuration by pressing key3 a long time again.
If the new value is saved the device will reboot itself and starts all over with the new saved values.
Im new to modelling like state-charts and UML. Usually i create a overview flowchart and then start "zooming in" in the design. But this is really a lot of work and also creates what I read "spagetthi" code. So I
m looking for a better method(s) and tried a state-chart (see below).
I dont think i use the guards right. But i really have no idea how to best draw a state-diagram (i dont even know if this is the best thing to do in my case).
In this picture the
KEYx -L stands for key X is long pressed
KEYx -S stands for key X is short pressed
http://img39.imageshack.us/img39/3355/pr100statediag.jpg