SUB-20 and older versions of LabVIEW

All about Sub-20 Multi Interface USB Adapter USB to I2C, SPI, GPIO, RS232, RS485, Ir, LCD

Moderator: serg

Post Reply
jon@ktizo.co.uk
Posts: 11
Joined: Wed Sep 28, 2011 4:25 pm

SUB-20 and older versions of LabVIEW

Post by jon@ktizo.co.uk »

Our LabVIEW drivers (viewtopic.php?f=2&t=506) are written for LabVIEW 8.5 and above. These drivers rely on using the ".NET object to Variant" VIs which are not available in earlier versions of LabVIEW. If you are using LabVIEW 8.2, 8.0, 7.1, 7 or earier, a new method is required.

There are workarounds, but it's a little bit more involved. An example of I2C communication is attached (in v8.0), showing how to use invoke nodes to do the same job.

Comments welcome.

Jon.

PS. We stock most SUB-20 modules and can deliver next-day to UK. Airmail to most European countries.
http://ktizo.co.uk/SUB-20.php
Attachments
SUB-20 v0.3 (LV8.0).zip
(155.08 KiB) Downloaded 1488 times

jon@ktizo.co.uk
Posts: 11
Joined: Wed Sep 28, 2011 4:25 pm

Re: SUB-20 and older versions of LabVIEW

Post by jon@ktizo.co.uk »

Here's an example of accessing the MDIO interface, written in LabVIEW 7.1. (See attachment)

There a few important things to consider.

1) LabVIEW 7.1 is very first version that supports Microsoft .NET interface 2. It doesn't handle .NET calls very well. NI released a patch which you may need to install if you have problems making it work: http://www.ni.com/download/labview-deve ... .1/674/en/

2) In LabVIEW 7.1, you need to locate the dll (sub20dnc.dll) in the vi's directory or it must be installed into the GAC(Global Assembly Cache ) by using the following command

gacutil.exe -I sub20dnc.dll

3) In order to edit the vi you should add the reference to the sub20dnc.dll in the Tools->Advanced->.NET Assembly references.
For unknown reasons LabVIEW doesn't always remember this setting.

4) LV 7.1 doesn't have .NET->Variant converter. This makes communicating with the dll a bit more tricky.

In the attached vi we use the GetValue method of the INPUT SystemInt32Array class to retrieve the data(index 3) when "READ" operation is used. It works because this method puts read data into the same array. With this sample and some LabVIEW knowledge you will be able easily add array processing mechanisms to have full-functional MDIO driver for your project.

5) This is a very basic example. It doesn't do any error checking (For example, it doesn't check the output of the SUB-20 "Open" call to quit if there is no SUB-20 connected)

5) We would encourage you to upgrade to a more recent version of LabVIEW if possible. But if that is not possible, this example shows that SUB-20 can definitely work even with this old version!

Jon.
mdio-sub20.zip
(49.03 KiB) Downloaded 1446 times

Post Reply