LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a "ViSession* " data input in a function panel

Hello, I have a problem when creating in a function panel for the following function - ViStatus hp34401a_init (ViRsrc resourceName, ViBoolean IDQuery, ViBoolean resetDevice, ViPSession instrumentHandle). The problem is that ViPSession is not a VISA standard datatype, only ViSession is. The question is how to create this ViSession* InstrumentHandle data input, or how I can define ViPSession as a new datatype ?
Any information on this matter would be appreciated !
Regards.
0 Kudos
Message 1 of 6
(7,376 Views)
Usually pointers are used for returning values to the caller: your initialization function returns a ViSession parameters in a variable received as a pointer. To define this variable you need to define an output control of type ViSession: this will be automatically defined as a ViSession * parameter in the function.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 6
(7,372 Views)
Roberto, using the data as output was the solution for my problem - I was somehow stuck to the ideea that the parameters to the function panel must be declared as Input.
But is there a way of using in function panels windows, custom data types other that the predefined ones ? Maybe by generating the "fp" from a "h" file, which I understand it's a feature of CVI7.x ? By the way I'm using CVI6.0.
Anyway, many thanks for info !
0 Kudos
Message 3 of 6
(7,370 Views)

In the FP Editor, open any function panel for edit. Go to Options->Data Types... You can add your own data types here and they will be available in the function panel editing features. If the data type has an instrinsic type you can specify it so the FP editor can make assumptions about control types.

Remember, after you generate the FP, you will need to go to the header and add the typedef statements for the data types you used.


Bilal Durrani
NI
0 Kudos
Message 4 of 6
(7,364 Views)

Bilal,

I've seen the Data Type menu, but the intrinsec types are not very many !

I ask this becasue I will use this function panel - let's say DMM.FP to generate the code for a DLL that  contain functions called from a Testand sequence - in order to generate the DLL, and to have the function parameters visible in Testand - I have to use the same DMM.FP as a Type Library.

For example I might need to define parameters in a function panel using complex types as e.g. - "ViReal64 **x". Is this possible ?

Many thanks for info, Regards

0 Kudos
Message 5 of 6
(7,350 Views)

Yes, you can define your own custom types if needed. You do not have to use the instrinsic types. If you add your own type, just make sure you add a typedef for that type in the header file associated with the panel.

For example, you could add a type called "MyUncleBob" in the data type list. And then go back and add the typedef

in Myfunctionpanel.h

typedef int** MyUncleBob;


I hope this helps
Bilal Durrani
NI
0 Kudos
Message 6 of 6
(7,327 Views)