Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

VB6 and PXI7358 Countoured Move

I am trying to use contoured moves with the PXI-7358 motion control card and VB6. I have started from the example code and encounterd a problem with the function flex_configure_buffer which returns error code -70078. The code is attached as a zip file.
 
I am using the following:
 
WinXP Pro
VB6
NI Motion V7
 
FlexMotion32.dll is dated 17/05/2005
 
The error code indicates that there is a parameter error in the function call. I have checked each parameter to be of the correct type according to the function prototype and to be in range. I have experimented with several values for each parameter without success.
 
Can you advise what I am doing wrong?
0 Kudos
Message 1 of 6
(4,077 Views)
Hi,
 
It seems as though the board isn't initialised correctly, try adding the function "flex_initialize_controller(u8 boardID, [i8] settingsName)" to the start point of your code.
 
This will set the controller to a known state based on the configuration settings you have created in MAX.
 
It may be that the setup you have in your code is conflicting with the controllers current state.
 
Try this and let me know how you get on
 
Regards
Hannah
NIUK & Ireland 
0 Kudos
Message 2 of 6
(4,049 Views)

Thanks for the response. After some trial and error I reached the same conclusion.

I have a motion application that I am extending by adding code for contoured moves. This code does initialise the 7358 and all existing fuctions worked as expected. The additional flex_configure_buffer returned the error code -70078 which indicates a parameter error. I then ran the example code attached in my original message and received the same error message.

After posting the message I carried further investigation using MAX and after making subtle changes and initialising the board from MAX, the example code did run. I usually find the error reporting from the API to be quite good, but in this case I found it confusing as it did not seem to be related to an initialisation error.

The range for the parameter ReqInterval appears to be 10ms to 45ms. Do you know if this is correct? The documentation does not indicate the valid range for this parameter.

 

0 Kudos
Message 3 of 6
(4,047 Views)

Hi,

The minimum time interval for a contour move is 10ms. However, this minimum is dependent upon the PID rate for the controller.

In the event that the requested interval cannot be achieved, the actual interval is determined by the following equation:

a = (p/1000) * ceiling[(r*1000)/p]

For this equation, a represents the actual interval, p is the PID rate and r is the requested interval. Ceiling means that the results of the calculation in brackets will always be rounded up.

If you have a look at the NI-Motion function help for the flex_configure_buffer call, there's a lot of information on how the reqinterval acutally works.

The minimum time interval for a contour move is 10ms. However, this minimum is dependent upon the PID rate for the controller.

For buffer types of

NIMC_GENERAL_PURPOSE_INPUT
NIMC_GENERAL_PURPOSE_OUTPUT

the requestedInterval parameter is ignored. In early versions of the driver, you had to set this to 10, however now it is full ignored.

requestedInterval specifies the requested time in milliseconds between contouring data points. interval is valid for only a bufferType of NIMC_POSITION_DATA, NIMC_BREAKPOINT_DATA, or NIMC_HIGH-SPEED_CAPTURE_READBACK.

The controller uses the closest legal value that is greater than or equal to the requested value for interval. Legal values for interval must be even multiples of the PID rate. See actualInterval for more information.

When used with NIMC_BREAKPOINT_DATA or NIMC_HIGH-SPEED_CAPTURE_READBACK, requestedInterval indicates how often, in milliseconds, the onboard data is updated from the hardware, and the value is a whole number.

actualInterval is the interval of time in milliseconds that the controller uses between successive points in the buffer. actualInterval may or may not be the same as the requestedInterval. For example, if the requestedInterval is physically impossible, then a different value is used. This value is represented as actualInterval.

For NIMC_BREAKPOINT_DATA or NIMC_HIGH-SPEED_CAPTURE_READBACK,

 

// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 4 of 6
(4,038 Views)

NIMC_POSITION_DATA

  • For NIMC_POSITION_DATA, use the following equation to calculate the actual interval, rounded to the next microsecond:

    where r = requestedInterval in milliseconds (ms)
    a = actual interval in milliseconds (ms)
    p = PID rate in microseconds (µs)

    For example, given a PID rate of 250 ms, a time interval of 11.2 ms between points is physically impossible, but a requestedInterval of 11.25 ms can be accomplished. So a call to Configure Buffer with interval set to 11.2 configures the buffer for 11.25 ms, because that is the shortest possible interval that is greater than or equal to the requested interval. The actual value being used, 11.25 in this case, is returned as an output parameter. The following table shows the minimum and maximum intervals for all valid PID rates.

    PID rate Minimum Interval Maximum Interval
    62.5 ms 10.0 ms 11.3125 ms
    125 ms 10.0 ms 22.625 ms
    187.5 ms 10.125 ms 33.9375 ms
    250 ms 10.0 ms 45.25 ms
    312.5 ms 10.0 ms 56.5625 ms
    375 ms 10.125 ms 67.875 ms
    437.5 ms 10.0625 ms 79.1875 ms
    500 ms 10.0 ms 90.5 ms
  • You can change the PID rate in MAX or with the Enable Axis function.
  •  
    Hope that helps
    Sacha Emery
    National Instruments (UK)
    // it takes almost no time to rate an answer Smiley Wink
    0 Kudos
    Message 5 of 6
    (4,037 Views)

    Ooops - missed the formulas as inserted images there ...

    For NIMC_BREAKPOINT_DATA or NIMC_HIGH-SPEED_CAPTURE_READBACK,

    For NIMC_POSITION_DATA, use the following equation to calculate the actual interval, rounded to the next microsecond:

    Thanks

    Sacha Emery
    National Instruments (UK)

    Message Edited by SachaE on 12-22-2005 04:19 PM

    // it takes almost no time to rate an answer Smiley Wink
    0 Kudos
    Message 6 of 6
    (4,034 Views)