Load Program Time Slice

NI-Motion VI

Load Program Time Slice

Specifies the minimum time an onboard program has to run per watchdog period.

Details

Device Compatibility

DeviceCompatibility
7330
N
7340
Y
7344
Y
7350
Y
7390
N
NI SoftMotion Controller for CANopen—Accelnet
N
NI SoftMotion Controller for CANopen—Xenus
N
Time Slice (ms) is the execution time for the onboard program per watchdog period. Default is 2 ms.
Board ID is a unique number assigned by Measurement & Automation Explorer (MAX) used to send and receive commands and data to or from a specific NI motion controller.
Program is the program number. Valid program numbers are 1 through 255 (0x01 through 0xFF).
Inp Vect indicates the source of the data for this VI. Available input vectors include immediate (0xFF), variable (0x01 through 0x78), or indirect variable (0x81 through 0xF8). Refer to Input and Return Vectors for more detailed information.
error in (no error) describes error conditions that occur before this VI runs. The default input of this cluster is no error. If an error already occurred, this VI returns the value of error in in error out. The VI runs normally only if no incoming error exists. Otherwise, the VI passes the error in value to error out. The error in cluster contains the following parameters:
status is TRUE if an error occurred before this VI was called, or FALSE if not. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code.
code is a number identifying an error or warning. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code. Use the error handler VIs to look up the meaning of this code and display the corresponding error message.
source is a string that indicates the origin of the error, if any. Typically, source is the name of the VI in which the error occurred.
Bd ID Out is provided for flow control. You can string together NI-Motion VIs by wiring the Bd ID Out terminal of one VI to the Board ID terminal of the next VI.
Resource Out is the Axis, Vector Space, ADC, or Encoder you wired into the VI. Use Resource Output to pass the resource to another VI and/or to display information about the device.
error out contains error information. If error in indicates an error, error out contains the same error information. Otherwise, it describes the error status that this VI produces.
status is TRUE if an error occurred, or FALSE if not. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code.
code is a number identifying an error or warning. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code. Use the error handler VIs to look up the meaning of this code and display the corresponding error message.
source is a string that indicates the origin of the error, if any. Typically, source is the name of the VI in which the error occurred.

Using This VI

Load Program Time Slice specifies the minimum time an onboard program has to run per watchdog period.

Note  This VI can only be run as a part of onboard program; the host cannot change the time slice of a program directly.

Some things to remember when changing the time slice of an onboard program:

  • A total of 20 ms is allowed for all running onboard programs.
  • Every onboard program loads with a default 2 ms time slice unless Load Program Time Slice is executed at the beginning of the onboard program. The default value of 2 ms is calculated based on maximum 10 onboard programs running simultaneously with equal time slice.
  • You can assign different time slices for each stored onboard program as long as the total of time slice for the running onboard program does not exceed 20 ms at any given time.

    For example, suppose you have the following onboard programs currently stored:

    1. Onboard program 1, time slice = 10 ms
    2. Onboard program 2, time slice = 10 ms
    3. Onboard program 3, time slice = 5 ms
    4. Onboard program 4, time slice = 4 ms
    5. Onboard program 5, time slice = 1 ms

    You could run programs 1 and 2 simultaneously without error, because the total time slices of the two running programs is 20 ms. If you then start program 3, an NIMC_invalidTimeSlice modal error occurs because the new total time slice is 25 ms. The available time slice for an onboard program also depends on the order in which the programs are run, because a user-defined time slice takes effect only when the onboard program actually runs, and not when it is stored.

  • You can use this VI to configure the performance of the onboard programs. The higher the time slice, the longer the onboard program runs per period, and the more work the program can do. However, as one program uses more processing power, the response times of other running onboard programs decreases. You can adjust the time slices to maintain the performance of other onboard programs by running the motion system under a longer watchdog period.
    Note  Increasing the time slice of every onboard program using an extended watchdog period puts higher constraints on the motion system, because more time must be spent running the onboard programs.