Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

why dont i see motion complete?

I am programming a 7344 motion control board using Visual Basic. My process requires multiple motions in order. However, recently, after the first move, I am not seeing the motion complete bit getting set. The motor stops moving, but no error is flagged and the motion complete bit is not getting set. The code being used is below:


' start motion
fresult = flex_load_target_pos(NIboard, YMotor.axis, 190050, &HFF)
If fresult <> 0 Then
Call MsgBox(fresult)
motionerror = True
Exit Sub
End If
fresult = flex_start(NIboard, YMotor.axis, 0)
If fresult <> 0 Then
Call MsgBox(fresult)
motionerror = True
Exit Sub
End If

' wait for movement complete
Do While True
DoEvents
fresult = flex_read_mcs_rtn(NIboard, Status)
fresult = flex_read_csr_rtn(NIboard, status2)
If Status And &H10 Then Exit Do
Call cbGetStatus(ADboard, Status, numtaken, currindex)
If stopRun Then
Call cbStopBackground(ADboard)
Call cbWinBufFree(bufHandle)
WaitForMeas = True
Exit Function
End If
Loop

Nothing has been changed in the code recently so what could cause this change in behavior?

Chuck Cottle
Advanced Inspection and Measurement
0 Kudos
Message 1 of 8
(4,091 Views)
Hello Chuck,

Did your motion code once work and now it doesn't? Did you upgrade the version of NI-Motion or modify the hardware in any way? Have all of your software versions remained the same? What versions of Visual Basic and NI-Motion are you using? Have you tried moving the axis in Measurement and Automation Explorer? Does the Move Complete LED in the 1-D Interactive window ever light?

Have you tried using the flex_wait_for_move_complete function? This function will hold execution of your code until the move completes and then your code will resume. Try using this and let me know if the problem with your system continues.

Regards,
Scott R.
Applications Engineer
National Instruments
Scott Romine
Course Development Engineer
National Instruments
0 Kudos
Message 2 of 8
(4,082 Views)
This code is on a machine at a remote location that has been running without problem since late October of last year. No changes have been made to software or hardware in that time. The axis moves fine and seems to get to its target location (monitored by flex_read_pos_rtn). Moving the axis in MAX did not flag any errors but I need to recheck on the status of the Move Complete LED.

I previously used flex_wait_for_move_complete but as I need other processing to happen during the move, I had to change to checking the register for move complete instead.
0 Kudos
Message 3 of 8
(4,077 Views)
My customer has informed me that the motion complete does get flagged when running in MAX. Is it possible that its a problem with reading the register?
0 Kudos
Message 4 of 8
(4,074 Views)
Hello,

What axis are you trying to check to determine if the motion is complete? By using &H10, it looks like you are checking the fifth bit of the mcs register. That bit corresponds to the move complete status of axis 5 for a PCI 7358. This register will exist in an indeterminate state (probably 0) for the PCI 7344. If you are trying to read axis 1, try using &H01.

Please let me know if you have any additional questions on this issue.

Regards,
Scott R.
Applications Engineer
National Instruments
Scott Romine
Course Development Engineer
National Instruments
0 Kudos
Message 5 of 8
(4,061 Views)
I am trying to read axis 4. According to the software reference for FlexMotion 5.1.1 (which is the version I have), bits 2-5 are the motion status registers for axes 1-4 respectively. That is the way my system has been running since last October.
0 Kudos
Message 6 of 8
(4,048 Views)
Hi Chuck,

I see what you are saying about axis 2-5 and Hex 10. The 4th axis corresponds to bit 5, and Hex 10 is 00010000. That part looks fine.

If I were worried about a particular status register, I would set up a test in which you repeatedly output the check move status. Tell the board to make some move, and then repeatedly output the move complete status. See if the status ever goes high.

Let us know how it goes - I hope this helps,

Robert
Applications Engineering
National Instruments
0 Kudos
Message 7 of 8
(4,024 Views)
Well the solution ended up being unrelated to the status register. I finally went out to the customer site last thursday and friday and after a lot of searching, I found out that one of the techs had unplugged a cable and not plugged it back in properly. Thanks anyway for the help


Chuck Cottle
Advanced Inspection and Measurement
0 Kudos
Message 8 of 8
(4,015 Views)