03-13-2020 06:20 AM
Hi 99,
@labview99 wrote:
The problem is that when I have to push one button of the phisical machine because the cylinder has been stopped in the middle of the way I need to change the "dta receive" of the first subVI, without sending again the subVI
The motors I use send response messages containing actual positions and error flags. I can react on those values in a statemachine.
Your device also sends responses containing actual position - atleast you are waiting until setpoint and response are equal. Why can't you react on those values in your statemachine in a determined way?
03-13-2020 06:28 AM
@labview99 wrote:
The problem is that when I have to push one button of the phisical machine because the cylinder has been stopped in the middle of the way I need to change the "dta receive" of the first subVI, without sending again the subVI
Best regards
If you need to do this then you need to break up your first subVI to be able to do this. You have lots of states buried in that subvi. Bring those states to the top level and then you have more control. This may mean making more subvis (please do make icons that describe the subvi instead of using the generic icon - it will make your life a lot easier).
03-13-2020 06:36 AM
I don´t know what you are saying to do
Sorry...
03-13-2020 06:47 AM
Your recibir datos.vi has a flat sequence structure. The code in each of those frames of the flat sequence structure represents a state of your state machine. If you divide those up then you can make decisions at each state, change values, etc. You may not even need to use a subvi - just do it all in the state at the top level.
03-13-2020 07:01 AM
I think I have got it.
One qyuestion how can I convert hexadecimal to binary?
Thank you
03-13-2020 07:36 AM
Hi 99,
@labview99 wrote:
One qyuestion how can I convert hexadecimal to binary?
Why do you need this? You can AND/OR with U16 to test bits, too…
(There's a ToBooleanArray function.)
03-13-2020 11:15 AM
@labview99 wrote:
I think I have got it.
One qyuestion how can I convert hexadecimal to binary?
I hope you realize that hex, bin, and decimal are all the same numbers...
03-16-2020 10:37 AM
Hi GerdW,
Sorry about all my questions... I still don´t know how you tell me to do the errors in the state machine. I use one VI to send the cylinder to one position.I send a command and it receives the data that I sent and the cylinder moves. But the problem comes when I provoke or I caused the cylinder to stop. If that situation occurs, I have to program to for the cylinder to resume its movement. To program that I have to make the next thing: I have to put the flag to 0 and then again put it to 1. But I can´t send a knew data, I have to make this change in the data I send befour,because I want the cylinder to resume its movement and finish going to the position commanded at the beginning. So, if the cylinder stop befour arriving to the indicated position, I send to an error state in the machine but how can I do in this state the change of the flag of the data I have sent at the beginning?
Best regards
03-16-2020 11:53 AM
Can you share what you have tried? Have you brought the states from your subvi to your top level vi? One of your states would be to check to see if the cylinder has stopped moving. If it has stopped moving then you have a state which determines if it has completed its movement (it has gone to the right location) or it needs to continue. You then take the appropriate action. This is how a state machine works. It sounds to me, though, like you're still trying to use that terrible subvi that you were using earlier. With that approach you're not going to be able to achieve what you want to achieve.
03-17-2020 07:33 AM - edited 03-17-2020 07:47 AM
Hi,
Thank you for helping me
I start doing what you say and I have done the VI to see if the cylinder is moving. Now, when the cylinder stops I want to see if it has arrived to the correct position. I start doing a new VI but I need to take the datas of the data received of the Vi that I have done "detectar movimiento cilindro". How can I use this data in another VI?
Appart from using global variable is there another way to do it?
I attach the first VI
Best regards