Quantcast
Channel: LabVIEW topics
Viewing all articles
Browse latest Browse all 66691

COM/ActiveX Register Event Callback Problem

$
0
0

Hi Everyone,

 

 

I’m trying to develop a VI to control a programmable USB device (USBPGF-S1 USB Programmable Amplifier and Low-Pass Filter from Alligator Technologies). Alligator provided me with a dll file “USBPxxS1COM.dll” which can manage the USB device with two events (DeviceConnected and DeviceDisconnected) and one command (to control the parameters of the device). This is what I want to do: setting the parameteres of the device with a LabVIEW program.

 

In the attached VI (AlligatorMain.vi), you may see that I tried to communicate with the device using “Reg Event Callback” to handle the ActiveX events. Basically, I need to get a “handle” from the connection, and use it in the Invoke Node to write/read some values from the USB device. I have a few problems, and I was wondering if you could help me with them.

 

1. As I run the VI, nothing happens inside the Callback VI ("AlligatorCallback.vi"). At first, I thought LabVIEW doesn’t register the events from the device, but when I looked at one of NI’s examples, the same situation exists. For instance, when I run “ActiveX Event Callback for Excel VI: labview\examples\comm\axevent.llb”, I can see everything goes as the description, but nothing happens inside the NewWorkbookCallback.vi. I don’t know how to access the data inside the event. How do I extract info about the event and use it in the main VI ((AlligatorMain.vi")?

 

2. The dll that I mentioned before has a command for controlling the parameters of the USB device. This command has four arguments (Handle, CmdID, DataInPtr, DataOutPtr). Handle is an integer that is for the device connection. CmdID is an integer to read/write a variable on the device (e.g. to read the value of LPFc, CmdID=1). DataInPtr and DataOutPtr are pointers to a structure (cluster) of data that contains all the variables of the USB device (e.g. LPF, Gain, etc.). Question: How do I read from pointers in LabVIEW?

This is how this command is defined by Alligator Technologies:

USBPxxS1Command([in] LONG Handle, [in] LONG CmdID, [in] VARIANT* DataInPtr, [in] VARIANT* DataOutPtr);

 

 

Thank you very much,

Rooz

 

Alligator01.png

 

Alligator02.png


Viewing all articles
Browse latest Browse all 66691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>