07-30-2014 09:24 AM
Hello everybody,
I´ve made a state machine with different orders:
- Move Y0position
- Move X0position
- Measurement
- Move NextX (if ActualX < Final X, then runs Measurement again; if not, go to Move Next Y)
- Move NextY (if Actual Y< Final Y, then go to Move X0position; if not, Finish)
- Finish
The problem comes with Move NextY. I´ve put a selector to choose the next step but insted of coming back to X0position and follow the Measurements, it does other thing and doesn´t follow my instructions (just goes Move NextY).
Could someone take a look at my program (attached) and help me with this??
Thank you very much!!!
07-30-2014 10:20 AM
Replace the Boolean control in your Finish state with a Boolean constant with a value of TRUE. Right now, your Finish state is sending a FALSE to the loop stop condition (the "Boolean" control is hidden on the front panel, and its value is always FALSE). Since you don't have a state enum wired in the Finish state, the default value of the enum is used, which appears to be "Move Y0position".
Also, I recommend using a type definition for your state enum. That way, when you add/modify/remove a state, all instances of the enum will be updated.
07-30-2014 10:42 AM
Hi Darren,
I´ve just made your suggested modifications, but something wrong happens since the program doesn´t come back to Move X0position. I´ll try to put some variables outside case structure and see what happens (I don´t know if this will mean something).
Thanks
07-30-2014 10:55 AM
You shouldn't have two references going to the same thing. You should be able to just use 1 reference for each motor. Move the controls to outside of your case structure. That could be causing issues when you do your measurement. Is your Actual Y position less than Final Y position?
07-31-2014 06:00 AM
Hi crossrulz,
I did what you said, put the motor references outside case stucture. I also did the same with some variables, but the program still doesn´t work properly.
In the last step "Move NextY", it should decide between go to "Move X0position" and "Finish". None of these things happen. In fact, it carries on running "Move NextX" and "Move NextY", and when FinalY is reached, then the program stops.
About your question, yes, ActualY is less than FinalY position, that´s why I don´t understand what is happening here.
07-31-2014 06:02 AM - edited 07-31-2014 06:03 AM
Thanks Darren.
I´m working with Labview 9 in an old xp computer. I´ve tried to use a type definition for the state enum but I´m not able to find it (however I can do it in Labview 2013, but for some reason I can not save for previous versions of Labview, so...).
07-31-2014 06:40 AM
@lacorgui wrote:
Thanks Darren.
I´m working with Labview 9 in an old xp computer. I´ve tried to use a type definition for the state enum but I´m not able to find it (however I can do it in Labview 2013, but for some reason I can not save for previous versions of Labview, so...).
In LabVIEW 2009, you have to right-click on the enum and go to Advanced->Customize. That will open up the control editor. Change the type to a Type Def (the default was Control, which is useless in this situation).
And you can save for previous in 2013. File->Save For Previous Version.
07-31-2014 10:39 AM
I would like to make this type def but the problem is that the "Advanced" buttom is disabled (no idea why). And when working in Labview 2013, I try to save for previous versions but it tells me that some errors occur
I´ve been trying to add new cases to the case structure but I´m not able to do that, is because of this type def problem?
Thanks
07-31-2014 10:48 AM
You can only add cases that your enum defines. This is why we told you to make the enum a type def. Because now you will need to go through all of those enums and update them. Here, this control file should work for you in 2009.
07-31-2014 10:48 AM
@lacorgui wrote:
I would like to make this type def but the problem is that the "Advanced" buttom is disabled (no idea why). And when working in Labview 2013, I try to save for previous versions but it tells me that some errors occur
I´ve been trying to add new cases to the case structure but I´m not able to do that, is because of this type def problem?
Thanks
If you are trying to typedef a constant, you'll have to temporarily change it to a control first, then change it back after you're done. I can't recall exactly when the right-click typdef thing was implemented, but this is the same time it enabled you to vreate a typdef from a constant.