From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI Scripting VISA Write / Read

Solved!
Go to solution

Hi,

 

I'm trying to use VI Scripting to change the context-menu setting for a node GPIB Write or GPIB Read - Synchronous I/O Mode. I obtain the reference to the GPIB Write node, but when I try to use ToMoreSpecificClass function with the target class GPIBReadWrite, the function ToMoreSpecificClass returns an error 1057: LabVIEW:  Type mismatch: Object cannot be cast to the specified type.

I tried the similar thing with Write to Text File function. It also has a context-menu setting for Convert EOL. Trying to cast its reference with  ToMoreSpecificClass function with target class ReadWriteFile causes the same error: 1057 Type Mismatch.

 

What I am missing?

0 Kudos
Message 1 of 12
(4,974 Views)

I'm not really sure what is supposed to be in the GPIBReadWrite class but it doesn't look like any of the GPIB functions are. I dumped every single GPIB function from the pallettes to a VI and tested it against too more specific class and didn't get anything to return without an error.

 

GPIB.png

 

If I changed the class to function it returns every GPIB call.

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 12
(4,949 Views)

You're right, the Function class works, but it's too generic, for accessing the SyncI/O? property you have to cast to GPIBRW:SyncIO property

 

 

0 Kudos
Message 3 of 12
(4,942 Views)

Sorry I wasn't very clear in my first post. I know function doesn't give the properties required but it was more of an observation that no GPIB functions seem to be of the GPIBRW class when I would assume at least some of them should be.

Matt J | National Instruments | CLA
0 Kudos
Message 4 of 12
(4,925 Views)

So, is there a way to programmaticaly change the set the Synchronous I/O Mode of the GPIB read/write functions? Actually I want to set them all to synchronous, which is unfortunaly a non-default settings. That means even using Replace method on this function will cause the new function to have this property set to async mode 😞

 

Can someone from NI comment on this please?

 

Thanks

0 Kudos
Message 5 of 12
(4,897 Views)

Hi,

 

FYI: the scripting functionality is not officially supported by NI.

 

Source: http://sine.ni.com/nips/cds/view/p/lang/en/nid/209110

Technical Support
Because this is an NI Labs product, NI does not support LabVIEW VI Scripting. All technical issues should be posted on the API Community:
http://decibel.ni.com/content/groups/labview-apis

 

I couldnt get the scripting functionality running. There are only two outdated function that accept the GPIBReadWrite Class, but they dont seem GPIB related to me.

 

For the only workaround I could imagin you could replace the GPIB read/write VIs with a wrapped version of your GPIB read/write. In this wrapper VI you can make settings that would apply to all GPIB read/write VIs. (demo is attached)

 

Best regards

Christoph

Staff Applications Engineer
National Instruments
Certified LabVIEW Developer (CLD), Certified LabVIEW Embedded Systems Developer (CLED)


Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved
0 Kudos
Message 6 of 12
(4,886 Views)

Hi Christoph,

 

thanks for the response, I was also thinking about the wrapper, now I see it as inevitable 🙂

The similar issue I saw with the VI Write to Text File and not being able to cast it to the class ReadWriteFile. Is this the same issue? What are the members of the  ReadWriteFile class?

 

0 Kudos
Message 7 of 12
(4,877 Views)
Solution
Accepted by topic author MM_RohdeSchwarz

Hi,

 

the members I found were "Read from binary file" and "Write to binary file". I attached an easy script how to find all possible functions of a certain class.

Just for clarification: Since VI scripting is not an official part of LabVIEW it is not an "issue" strictly speaking. VI scripting provides helper function which can be used if present.

 

Best regards,

Christoph

Staff Applications Engineer
National Instruments
Certified LabVIEW Developer (CLD), Certified LabVIEW Embedded Systems Developer (CLED)


Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved
Message 8 of 12
(4,873 Views)

Hi Christoph,

 

thanks a lot for help

0 Kudos
Message 9 of 12
(4,865 Views)

you are welcome!

Staff Applications Engineer
National Instruments
Certified LabVIEW Developer (CLD), Certified LabVIEW Embedded Systems Developer (CLED)


Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved
0 Kudos
Message 10 of 12
(4,861 Views)