Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

loading/reading onboad variables

When using any of the flex_load... functions with onboard variables, is the data parameter ignored since the data is directed to an onboard variable? I have been passing 0 as the data for all of my onboard var loads and this seemed to work fine, however I noticed that when loading an rpm or rpss from an onboard variable, my axis was essentially disabled(zero velocity?) Is it possible that 0 was used as the data instead of the onboard variable provided?( I verified the variable before the call and it was the correct value).

The documentation does not say how the data is treated when given an onboard variable. Are there any known side effects?
0 Kudos
Message 1 of 2
(3,063 Views)
Hello,

Thank you for contacting National Instruments.

The data input of any flex_load_* function is ignored when an inputVector other than 0xFF (255) is specified. For instance, if you use the flex_load_velocity function, the "velocity" input is ignored and the data is pulled from the location in onboard memory specified by the inputVector parameter.

For the flex_load_velocity function, four variables are required for the data. This is because the data is stored and passed to the function as a 64-bit floating point value. The data is formatted into four 16-bit words, stored in four adjacent memory locations. For more information on this function and the other functions, please refer to the "Onboard Variable, Input, and Return Vectors" entry in the
"General Information" category of the NI-Motion Function Help.

I experimented with this function and used variables 1, 2, 3, and 4 with the values 0x4000, 0x407F, 0x0, and 0x0 respectively. This specifies a velocity of 500 RPM, calculated by IEEE conversion methods. Also note that the order of the words is swapped (in other words, the actual 64-bit value for 500 is 0x407F 4000 0000 0000, and the corresponding variable order is 2, 1, 4, 3).

This website was very helpful when converting between decimal and hexadecimal IEEE 64-bit floating-point numbers.

Hope this helps to clarify the situation.

Best Regards,

Jesse D.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(3,063 Views)