LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error messages

I told you previously that you only increment inside the state machine (that means inside the case structure) in the state where you check to see if the position was reached. If the position was reached then increment, otherwise do not increment. You also need to have logic to check for the last element in the array when incrementing.

0 Kudos
Message 81 of 143
(1,888 Views)

So here's a simple example.

It doesn't do exactly what you need, but it should be close enough to get you moving along again (I hope).

 

It's saved for 2014. The snippet is for 2019.

simpleStateMachine_BD.png

simpleStateMachine_BD.png

 

 

Note that you have to click stop between button clicks in this VI, so the wait is important if you want to be able to exit reasonably easily.

It's just a simplified example.


GCentral
Message 82 of 143
(1,885 Views)

Hi,

 

Thank you so much for the example and all your explanations, it has been very helpful for me.

 

I think I have understood how to increase if the cylinder has reached the position, I think  it is ok now. But if the position is not correct, should I substract between the position the cylinder should have reached and the position it is in. To know the position it is in, I do it using the pink wire?

 

Best regards

 

0 Kudos
Message 83 of 143
(1,865 Views)

Hi 99,

 


@labview99 wrote:

But if the position is not correct, should I substract between the position the cylinder should have reached and the position it is in.


This question is answered in the manual of your "cylinder" device: read the communication specs and the explanations how to control the cylinder…

 


@labview99 wrote:

To know the position it is in, I do it using the pink wire?


I guess with "pink wire" you are talking about string data (as you should have learned from all those Training resources offered very often in this thread): as has been said before you DON'T NEED string wires to handle numeric values!

You are a very slow learner

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 84 of 143
(1,862 Views)

Hi GerdW,

 

And how do I get the position the cylinder is in?

The position in which the cylinder is, it is indicated by the pink output of the VI. HOW DID I TAKE THAT DATA TO THE STATE "ERROR"??

 

0 Kudos
Message 85 of 143
(1,858 Views)

In the cylinder manual what it tells me is that I have to modify one number of the  array of numbers "data to set" that I send at the beginning  of the VI, and then I have to send again to the position that I want. But I see that impossible to do in this state machine. Because of that I have thought to make a substract between the positions

0 Kudos
Message 86 of 143
(1,853 Views)

Hi 99,

 


@labview99 wrote:

And how do I get the position the cylinder is in?

The position in which the cylinder is, it is indicated by the pink output of the VI.


It is a string wire because YOU made it a string wire!

When you need to handle numeric data you should use numeric datatypes…

 


@labview99 wrote:

HOW DID I TAKE THAT DATA TO THE STATE "ERROR"??


To forward data to the next state you should use a shift register - basic LabVIEW knowledge!

 


@labview99 wrote:

But I see that impossible to do in this state machine.


It's only you having problems to understand the concept of state machines. All other people in the forum know it's possible…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 87 of 143
(1,839 Views)

Hi,

 

If I don´t do it like this, is there any way to do it the other way I have explained? I mean, modifying one value of the "data to set" that I write at the beginning of the subvi?

 

Thank you

0 Kudos
Message 88 of 143
(1,836 Views)

Hi 99,

 


@labview99 wrote:

If I don´t do it like this, is there any way to do it the other way I have explained?

I mean, modifying one value of the "data to set" that I write at the beginning of the subvi?


Surely you can modify elements of an array.

You already know how to do this: use ReplaceArraySubset!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 89 of 143
(1,828 Views)

I know that I can modify one element of the array using replaceArraysubset, but how do I access to this array if it is one control that I have used in the subVI

0 Kudos
Message 90 of 143
(1,822 Views)