LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create fixed-point number using LabVIEW VI scripting

Solved!
Go to solution

I don't know how to make use of these VIs. The way I use them returns an error (attached photo). 

What is the right way of using them?

0 Kudos
Message 21 of 39
(1,165 Views)

After you create the contol, you need to change the representation to fixed point using a property node. Then use the VI. The default representation is a double, and these properties do not exist for doubles.

0 Kudos
Message 22 of 39
(1,145 Views)

Thank you!  You found a solution to my problem. 

Now everything works fine.

 

0 Kudos
Message 23 of 39
(1,126 Views)

 You should mark DFGrays post on 04-18-2014 10:54 AM as the solution so that others can quickly find the solution, as well. Cat Happy

Tim A.
0 Kudos
Message 24 of 39
(1,122 Views)

Hi!

I am still working with fixed-point numbers. I don't know how to set scripted math functions (for example divide function in FPGA environment) fixed-point number's precision (word length and intiger word length)?

Can anybody help me with this problem?

0 Kudos
Message 25 of 39
(1,101 Views)

Are you referring to a regular Divide function, or a High Throughput Math Divide function?

 

div.png

0 Kudos
Message 26 of 39
(1,099 Views)

I am referring to the High Throughput Math Divide function. Is it also possible to set the fixed-point number precision to the regular Divide function?

0 Kudos
Message 27 of 39
(1,087 Views)

Unfortunately, the high throughput divide is very difficult to script, and the result is very high maintenance - it may change at every version of LabVIEW. You can work around this issue in a fairly straightforward manner by using the following trick. Create a VI containing two fixed point inputs and one fixed point output. In this VI create a case structure containing the versions of the high throughput divide you are interested in (I realize there are 1024 of them for just the 32 bit version, but you should be able to narrow that down considerably in practice). Connect the inputs and outputs to the high throughput divides in the case structure. This is probably easiest to do by creating one in a single case, connecting everything, then duplicating the case. To "script" it, do the following:

 

  1. Open your template VI
  2. Get a reference to the case structure which contains the multiple high throughput divide functions (it is easier if you uniquely name the structure)
  3. Select which frame is visible in the case structure (this is an U32 which corresponds to the frame number of the frame, NOT what you may have called the frame)
  4. Execute a Remove Structure method on the case structure, leaving only the one implementation behind
  5. Select everything in your template
  6. Do a Move to put it in your target VI
  7. If you want to script again, to a Revert method on the VI and start at step 2

Good luck!

Message 28 of 39
(1,068 Views)

There is a scripting API for the High-Throughput Math Nodes, but it is not officially supported by NI. If you want to dig around in the VIs to figure out how to use it, they are located here:

 

vi.lib\rvi\ClientSDK\Core\Script\FXPMathLib

 

Here is a screenshot of some code I have that is setting the overflow mode, execution mode, and output type of a High-Throughput Divide function:

 

div.png

 

I list the paths of the VIs that are called within the screenshot.

 

Good luck! And remember, this API is not officially supported.

 

 

0 Kudos
Message 29 of 39
(1,056 Views)

Hello again!

 

You helped me a lot in the previous problem. Thank's for that.

 

When generating a VI using VI scripting I want to generate an array with constant values defined in VI script. 

For now I have generated an array with the same constant value for all array elements, but I need an array as shown in attachment.

 

Can somebody help me with this problem?

0 Kudos
Message 30 of 39
(1,017 Views)