03-23-2020 06:33 AM
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.
03-23-2020 06:55 AM - edited 03-23-2020 06:57 AM
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.
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.
03-23-2020 11:21 AM
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
03-23-2020 11:26 AM - edited 03-23-2020 11:29 AM
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…
03-23-2020 11:33 AM
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"??
03-23-2020 11:39 AM
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
03-23-2020 12:09 PM - edited 03-23-2020 12:12 PM
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…
03-23-2020 12:15 PM
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
03-23-2020 12:30 PM
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!
03-23-2020 01:13 PM
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