Velmex    |    BiSlide    |    XSlide
Image Fade Right
 
VXM Driver Documentation - Visual Basic 6 - PortWaitForCharWithMotorPosition
 
Image - VXM

All functions assume you followed directions in the "How To Add To Your Project"

PortWaitForCharWithMotorPosition

The "PortWaitForCharWithMotorPosition" function is a combination of PortWaitForChar and MotorPosition.

      This function is very helpful if needing to read motor position while waiting for a VXM program to end.

Limitations:
      Only motor 1 and motor 2 positions can be read while motor is moving

      Whatever window the position is being read back to, needs the change event
      In the change event, needs to be the command "object.Refresh".

      For example if read back to Text1 then the following code

      Private Sub Text1_Change()
            Me.Text1.Refresh       'Added to get position window to show correct position
      End Sub



Syntax:
      PortWaitForCharWithMotorPosition(ByVal CharToWaitFor As String, ByVal MotorNumber As Long, Optional ByVal ReportToWindowHwnd As Long, Optional ByVal TimeOutTime As Long) As Long



Parameters:
      CharToWaitFor = Character to wait for. (typically the "^")

      MotorNumber = Number of the motor you wish to have driver report position back

      ReportToWindowHwnd = Hwnd of the window you wish the position to appear

      (Optional) TimeOutTime = Time in MilliSeconds to wait

            (if character not found before the timeout then your code will continue.

            (if zero then driver will wait until either the character is found, or loss of communications)



Returns:
      0 if failed
      1 if successfull

Example:
      Dim CallPortWaitForCharMotorPosition As Long
      CallPortWaitForCharMotorPosition = VXM.PortWaitForCharWithMotorPosition("^", 1, Text1.hwnd, 0)

Image Fade Bottom Image Fade Right Bottom