LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I use a dll and C++ code to create a labview driver

I have a dll and some .net code to read temperature from a USB HID device I purchased from the website below. In addition some other people have posted their methods/codes of reading the temperatures. I am trying to convert this into a Labview VI but I am very lost.

 

 

http://www.no-feature.com/2008/01/taking-advantage-of-your-temper-device.html

 

 

It seems I can use the call function to see the functions in the DLL but I cannot use them to actually do anything. I have used serial communcation in labview before but never USB so I feel like I am in a little over my head and would really appreaciate some guidance. 

0 Kudos
Message 1 of 3
(2,898 Views)
This is not quite easy But to find out how try to reverse engineer this code http://pc8-termo.fis.ucm.es/~josechu/mitemper.zip
Before starting on the job I would recommend doing some testing to see if the code work with your device. I can help if you promise to post the tested code here in this forum. It doable in Labview. It just requires some bit manipulation. Also the unit drive must be installed
To establish a communication link with the device, the settings can be extracted from function SetupCommPort in MITEMPer.c, which are:
9600bps, 8 bits, no parity bit and one stop bit with DTR and RTS enabled.

To initialize the device, the function is init in functions.c. The sequence is:
Calling the Start_IIC function, which in turn calls the SetDataLine and SetClockLine passing 1 as parameters for both, and then calling those two functions again with 0 as parameters.
SetDataLine function sets the RTS line if the passed parameter is 1 or clears the RTS if the passed parameter is 0.
Similarly, the SetClockLine function sets the DTR line if the passed parameter is 1 or clears the DTR line if the passed parameter is 0.
 In other words to to initializes the device, we first have to set the RTS, set the DTR, then clear RTS and clear DTR.

So to some part that involves a technique that is often referred to as bit banging. There are 3 groups of 8 bits (one byte) that need to be transferred. Which are, first group 10011110, second group 00000001, third group 01100000.
Then stop the IIC (look in the respective function on what have to be done here).
Start the IIC again.
Transfer another 3 groups of 8 bits.
Stop the IIC.

The sequence of transferring the group can be obtained from the function Transmit in functions.c:
The transmission is done through the DTR and RTS line only. Not through the usual TX data line.
If the data is 1 set the RTS or if the data is 0 clear the RTS.
Then the tick (clock), set the DTR followed by clearing the DTR.
Loop to the next data bit for 8 times.
After 8 bits, set the RTS line and set the DTR line.
Then read the CTS line for acknowledgement (inverted).
Closed by clearing the DTR.

You can follow the C code and find the necessary sequences and data that you need to talk to the device and obtained a reading.


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 2 of 3
(2,886 Views)

I'm confused. Why point the user to C code when they have a .NET assembly? To use the .NET assembly that's provided at the original link you would use the .NET functions in LabVIEW. The example provided would be coded in LabVIEW like this: (without the fancy string formatting)

 

 

Message Edited by smercurio_fc on 02-20-2010 12:38 PM
Message 3 of 3
(2,871 Views)