LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB interface pressure sensors

 Hello all!

 

I've recently acquired a DigiTacts pressure array sensor like those depicted in the following link:

http://www.pressureprofile.com/products-digitacts

 

Has anyone already worked with these sensors using LabView?

 The interface is USB.  Will it be possible through LabView to communicate and acquire information from these sensors?

They come with an API...

 

Thanks in advance!

 

Best regards!

0 Kudos
Message 1 of 3
(2,365 Views)

I forgot to say but the API was built with C++ and comes with a DLL file.

 

An example code could be as follows:

 

#include "d500_include.h"
#include <windows.h>
#include <vector>
#include <iostream>
#include <fstream>
namespace
{
byte const averageLength = 0x03;
byte const scanCount = 0x30;
int const nFramesToRead = 50;
char const * outputFileName = "data.txt";
}
int main(int argc, char* argv[])

 {
std::cout << "Configuring sensor...\n";
configureD500 ( averageLength, 0x01, scanCount);
Sleep( 2000 ); // wait for configuration to complete
setDAQEnabled( true );
// The following section automatically finds the attached sensors and
// allocates memory accordingly. This can be done manually if preferred.
Sleep( 500 ); // wait for sensor data to start arriving.
std::vector<int> config(17);
int numDevices;
getConfig( &config[0], numDevices );
//Calculate the packet length
int packetLength = 0;
for( int x = 0; x < 16 ; ++x)
{
packetLength += config[x];
}
int nSensors = packetLength;
++packetLength; //Add an element for the time stamp.
std::cout << nSensors << " sensors are connected.\n";
// End of optional automatic setup routine.
std::vector<float> dataArray(packetLength, 0);
std::vector< std::vector<float> > buffer;
int framesReceived(0);
//Main loop
std::cout << "Reading " << nFramesToRead << " frames of data:\n";
for (int ii = 0; ii < nFramesToRead; ++ii)
{
getData( &dataArray[0], framesReceived, 1); //Request 1 frame
if( 0 != framesReceived) // We have new data
{
std::cout << (ii < (nFramesToRead - 1) ? "." : ".\n");
buffer.push_back(dataArray);
}
Sleep(50); // Pause so we can see the loop run
}
// Write data to file
std::cout << "Writing data to " << outputFileName << "\n";
std::ofstream out(outputFileName);
out << "Time\tSensor Data\n";
for (int i = 0, n = buffer.size(); i < n; ++i)
for (int j = 0, m = buffer[i].size(); j < m; ++j)
out << buffer[i][j] << ((j == m-1) ? '\n' : '\t');
stopScanning( SEN_I2C_BROADCAST ); //Stop the sensors
return 0;

}

 

How could I do something similar using LabView?

 

How could I use the DLL file in order to do this?

 

Any help would be greatly appreciated.

 

 Thanks in advance.

 

Best regards.

0 Kudos
Message 2 of 3
(2,356 Views)

You could use the Call Library Function Node in LabVIEW to communciate with the DLL.

 

Refer to the Call DLL VI in the labview\examples\dll\data passing\Call Native Code.llb for an example of using the Call Library Function Node function.

Message Edited by Adnan Z on 03-12-2009 09:01 PM
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 3 of 3
(2,345 Views)