LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hello I am making calculator using state machine(easy)

Hello

I am making a calculator using state machine

not an event-driven machine

but I can not run as a calculator

almost I thought that it was finished.

because string that I had clicked didn't go for wait for event to user state 1

I think it would be very easy for people who are accustomed to dealing with problems.

Thank you.

Gracias por su ayuda.

Download All
0 Kudos
Message 1 of 7
(2,834 Views)

Some comments:

  • It looks like you attached the same program three times.  Did you mean to do this?
  • When I look inside, I see "strange text" (Unicode?).  Here's an example, the Label for User State 1: "User State 1 - ÀÌ »óŸ¦ »ç¿ëÀÚÀÇ ¾îÇø®ÄÉÀ̼ǿ¡ ¸Â´Â ±â´ÉÀ¸·Î ´ëüÇϽʽÿÀ. "  Most of your Controls and Indicators also have labels with similar-appearing names.
  • Have you ever read or studied (or thought about) Parsers?  There's a big literature on this subject, but I can't easily tell from your code (probably because I can't interpret the labels and text) if you are using an Established Algorithm or "Designing your Own" (nothing wrong with that -- I haven't had a course on Compiler Theory, but know how a Parser works, in general, and could easily see myself trying to build a simple 4-function calculator).
  • I'd recommend that you Design first, Code second.  For example, you might have the following algorithm:
    • [Parse State] Parse String into <Operand> <Operator> <Operand>
    • [Operate State] Using Case Statement based on <Operator>, evaluate Calculation
    • [Output State] Show Result and decide what to do next.

You might well have done this in your code-that-I-couldn't-read-clearly, but it looks like you were testing for the Operators and then Operating in one step -- the beauty of a State Machine is you break the problem into States, and "natural" States (in my simple model) are Parse and Operate.

 

Bob Schor

 

0 Kudos
Message 2 of 7
(2,817 Views)

Hello

I want to ask you about the state machine

I was testing a calculator using state machine

Suppose If I click 2+3 

I thought that the result should come out 

But I can not connect from wait for event and state 1

How can I connect from wait to event and state 1 so that I can get the result????

It would be great help if you can find any solutions. 

Thank you so much.

0 Kudos
Message 3 of 7
(2,831 Views)

I don't understand your message.

 

You talk about a "wait for event", but your VI doesn't have any event structures.

 

And the sentence "I cannot connect from wait for event and state 1" just isn't clear what you mean.

0 Kudos
Message 4 of 7
(2,800 Views)

Hi kias3399,

 

I can understand your question. You're asking why the program is not turning to "User State 1" case from the "Wait for Event" case after you click 2+3= button right?

 

Well from the code that you've sent, there are a few broken wires in both cases. In the "Wait for Event", make sure you remove the next state enum indicator and try to rewire the enum to the shift register as below

Capture.PNG

 

And in the "User State 1" case, I recommend you to delete the enum indicator and rewire again as below:

Capture1.PNG

 

There are still so much thing to do by your own to complete this program, but for this forum topic, this I so far that I can help.

 

Thank you.

0 Kudos
Message 5 of 7
(2,739 Views)

@Sogekking091 wrote:

Hi kias3399,

 

Well from the code that you've sent, there are a few broken wires in both cases. In the "Wait for Event", make sure you remove the next state enum indicator and try to rewire the enum to the shift register as below

 


Where did you see broken wires?  I didn't see any.  The VI was broken because the typedef for the enum wasn't attached, but beyond that, no broken wires.

0 Kudos
Message 6 of 7
(2,736 Views)

My bad, almost forgot about that though. You're right! 

0 Kudos
Message 7 of 7
(2,734 Views)