12-02-2014 06:53 AM
Hi,
I had a question wrt state machine. Is it possible to make a statemachine with for loop as an array numerical input for max and min operation? How to create the same operation with array input in case of while loop?
12-02-2014 08:18 AM - edited 12-02-2014 08:21 AM
You should specify more the details, what is your goal with this?
What about min/max operations? There is a min/max function for arrays, you do not need to index it out...
edit: and why you mention state machine? State machine is one thing, array manipulation is another thing...
edit: or your qestion is about that, you want to make a state machine using a FOR loop instead of a WHILE loop? Why?
12-02-2014 08:25 AM
12-02-2014 08:32 AM
Hi,
I have analog in signal from a daq device, these are array of signals. I have a limit for each signal, so i have to make sure that that signal doesn't go above limit or below limit. I have to check atleast 5 times the values of each signal before making a warning or alarm. So i have array of signal inputs, for this type of mechanism i have to create a state machine. so how to go ahead with while loop or for loop?
12-02-2014 08:38 AM
That doesn't sound like a state machine. That just sounds like a processing loop. FOR loops are perfectly fine for that.
12-02-2014 08:45 AM
Hi,
Is it possible to do in these kind of operation in a state machine (Input array). if so how?
12-02-2014 08:45 AM
Hi,
Is it possible to do in these kind of operation in a state machine (Input array). if so how?
12-02-2014 09:02 AM
12-02-2014 09:08 AM - edited 12-02-2014 09:09 AM
Hi,
Readings are not states here i wanted to ask, increment in incase limit is higher or lower decrementing in case like that other functions in the program for warning and alarming the user. For that puepose i asked state machine wrt For loop or while loop.
12-02-2014 09:20 AM
Before you use the words "state machine" again, please go read this: http://en.wikipedia.org/wiki/Finite-state_machine
Nothing you're talking about has anything to do with a state machine. But, let's answer your original question. It's silly to make a state machine with a For Loop. If a For Loop makes sense for the application, a state machine doesn't. It's a trivial task to add a Shutdown state to a state machine to stop the While Loop. If that doesn't make sense for what you're trying to do, then you don't want a state machine. When you're aware enough to know you don't know a lot about the topic, it's generally a bad to marry yourself to the idea of a state machine even though those you seek for help are telling you that's not the answer.