LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shift Register or Feedback or Other...need to read in new value per loop

Solved!
Go to solution

I am having difficulty with my "Relative Postion" values. In the beginning of my program, the system resets itself to position (0,0) based on the relative position values read from the controller. This is working correctly. The program then moves on into the while loop which runs so long as the connection to the controller is maintained. This while loop has an event structure in it with various buttons as triggers. It needs to read in the relative position to compare it to the entered desired position and send the difference to the controller and execute the movement. The input is working, as are the position commands and execution. However, for some reason, the read in relative position value does not ever change from 0. This is not a problem with the controller. If I send an inquiry to the controller in a separate program, it returns the correct values for the relative positions. I have no idea why this is happening. I have reviewed shift registers and feedback and tried both but either I did not wire them correctly or they do not work.
Any suggestions?

 

 

ProjectSnippet.png

0 Kudos
Message 1 of 9
(3,169 Views)

Your While loop will actually run forever since it is getting the value from the tunnel.  You need to check the connection status with each iteration.

 

As far as the relative position, you need  to store it in a shift register.  You will need to update the shift register with each loop iteration.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 9
(3,153 Views)

I tried to do that and I couldn't get it to work. I tried moving the command call inside the event so that it would request the value from the controller each time an event was triggered (I know that is redundant but it seemed like a halfway decent workaround) but that's not working either. That would seem to imply that the request for the value is not working.

0 Kudos
Message 3 of 9
(3,138 Views)

Maybe it's different for different controllers, but from my experience with Galil controllers, XQ is only for executing labels or line numbers. XQ by itself isn't going to do anything. You set a relative position to move (PR) but you also want a speed to set usually with JG or SP, then BGA is the command to begin motion on axis A. To get the position send the TPA command which gives the counts of the motor. (MG _PRA may give relative counts, I'm not sure)

 

Message 4 of 9
(3,078 Views)

Hello again, you seem to be the most help in answering my questions 🙂

The XQ command will cause the controller to execute the program currently in its memory with the parameters given. RPA and RPB give the relative position of the axis in counts.
My speed and other initializations, as well as BGA and BGB are all in my DMC program. I also have it set to only run one axis at a time. This is preferred. Everything with the controller is working correctly. I can move the motors just fine.
My trouble is that I need to check the desired position (PR) against the current position (RP). However, it would seem that the program is not getting new values for RP.

0 Kudos
Message 5 of 9
(3,022 Views)

Ahh, sorry I didn't realize XQ worked like that.

 

I would start by verifying that you are getting the correct values from Galil. Can you just connect with Galiltools or Galilsuite and MG _RPx? I'm not sure how you are sending the command to Galil, but the command node with "MG PRx" should return reference position.

0 Kudos
Message 6 of 9
(3,000 Views)

All good 🙂

In the GalilTools I am able to get the correct relative position values every time. That's how I know it isn't a controller issue.

At the very beginning of my LabVIEW program you can see that I query the controller for these values and send the reverse values as desired positions. This is so that the system will be reset to 0,0 every time. This process works perfectly. I then pass into the user portion of the program which runs in a while loop. This portion allows the user to enter angle values (in degrees) which are then related to counts and sent to the controller. All of this is working except that once I pass into the while loop, the values of RPA and RPB never change from zero (they should change every time). This means that I can't relate my desired position to the current position to calculate how far the system needs to move.

0 Kudos
Message 7 of 9
(2,988 Views)

Try "MG RPA" for the command. This is getting somewhat off topic of LabVIEW, you can e-mail me at stevederr@gmail.com if you still have some questions.

0 Kudos
Message 8 of 9
(2,980 Views)
Solution
Accepted by topic author GypsyEngineer

Got it! For anyone who is curious this particular issue actually had nothing to do with LabVIEW. It was the query I entered. If you notice in the snippet I send "RPA=" or "RPB=". This is not proper query notation for the Galil controller. The proper notation is "RPA" and "RPB" (remove the "=" sign). Now the program runs properly 🙂

Thanks everyone!

0 Kudos
Message 9 of 9
(2,943 Views)