2

I'm working on a basic embedded systems application. Where I have a sonar (ultrasonic) sensor to measure the distance between the sensor and X object. Ultasonic sensor has one job to do, calculate distance and return it. I would like to produce a state chart diagram for this but I cannot break it down into different states. This is one of those situations where you can't get your head around a simple task. Anyone have any idea?

PRCube
  • 566
  • 2
  • 6
  • 19
  • 1
    You may be having trouble breaking it into states because there is only one state... How many events can it respond to? – Jim L. Apr 26 '16 at 13:08
  • 1
    It depends on what you need to show. I guess your states are "Ping sent" and "Idle" and you have a trigger "Ping received" from which you need to detect whether it's noise or an echo. – qwerty_so Apr 26 '16 at 14:27

1 Answers1

1

It's not a strict law, but I've come identify a state of an object by a set of operations that may be performed on it. So if, under different conditions, different sets of operations can be performed, you have different states. This view is supported by most state diagram conventions, including UML, where, on each state, you may model operations that lead to the same or other states.

So the key question is: Are there conditions under which your ultrasonic sensor may perform only subsets of its functionality? Each such subset will define one state.

TAM
  • 1,731
  • 13
  • 18