acquire data from solartron LVDT


Recommended Posts

I am using daqfactory to read a signal from a load cell through a labjack(U3-HV). This was simple to set up, no problems. I am also reading a displacement measurement from a Solartron LVDT, which has to be connected through solatron's Orbit Network card(pci card).

Up until now I have been using the solartron drivers and an excel macro to record the LVDT and daq factory to record the load cell and using a simultaneous stimulus to syncronize the data. Is there anyway to configure daqfactory to see the pci card as a device so that I can use daqfactory to acquire both signals.

P.S. I will warn you, I am still very new to all this.

Link to comment
Share on other sites

If the solartron has a DLL library for communicating with their cards, which is very likely, then you can use the extern() function to use that library. However, you would need one of the non-free versions of DAQFactory, i.e. anything other than Express.

If you find the DLL, look for the corresponding .h file and post it here and we can give you a little guidance on the prototype.

Link to comment
Share on other sites

I have upgraded to the daqfactory starter edition I believe (cheapest one so that I can add other devices). i have attached the two h files that were included as dll support for the solartron card.

As I mentioned earlier I am a bit lost in all this. I know that the card has two ports which it sees as two separate orbit networks (networks 0 and 1). I'm on network 1. The sensor I'm reading has a module identity: 302A115P01

These are the settings I use to communicate with the probe currently.

orb_glob.txt

OrbTypes.txt

Link to comment
Share on other sites

OK, well the function prototypes are in the orbtypes file. There are a lot of functions there and I don't know which you need. It looks like they only use one structure, and my guess is that you probably don't need it, and no callbacks, so it should be relatively straight forward. Read up on in DAQFactory help file on the extern() function. Its chapter 15. Give it a try, starting with the ConnectToOrbitNetworks function. Its either going to work and give you a value, probably 0 for success, or its going to fail miserably and crash DAQFactory. So, save often and try on a blank document first. Once you figure out the first one, the rest should be easy, but unfortunately there is some details that are missing in these files that you might just have to use trial and error to determine:

1) what the actual function names are. My guess is that the function name is actually ConnectToOrbitNetworks not tConnectToOrbitNetworks.

2) whether its stdcall or cdecl. My guess is stdcall. I never remember which WINAPI * is, but an internet search will probably tell you...

3) figuring out which functions you actually need and what the parameters do. Hopefully you have some documentation.

Link to comment
Share on other sites

Ok so I've tried to play around a little bit with creating the extern calls you mentioned. I've tried with the function prototypes tConnectToOrbitNetworks and tOrbitRead1. With both I initially got c1000 errors saying the function did not exist.

Now however I dont get any errors but the sequence never seems to run. Should the sequence run if I dont use the functions in daqfactory? As of right now I'm just seeing if the extern functions crashed like you hinted that they might.

Link to comment
Share on other sites

The extern function just brings the function into DAQFactory and makes it like any other DAQFactory function. You then have to call it using the name you specified as one of the parameters in extern(). It is at that point that you are likely to crash the program if you got something wrong.

Link to comment
Share on other sites

ok, still not having any luck with this, this is the extern function i'm trying to use

extern("OrbitCom.dll","long tConnectToOrbitNetworks(long)","orbitconnect","stdcall")

global numberofnetworks = 1

global answer = orbitconnect(numberofnetworks)

i get a c1000 error on the last line stating that the channel or function isn't found so i'm assuming my extern function isn't right and the orbitconnect function isn't created properly

Link to comment
Share on other sites

Yeah, the extern() is probably failing because of one of two reasons:

1) it can't find orbitcom.dll. You might want to fully specify the path to this file

2) it can't find tConnectToOrbitNetworks. I still think the exposed function is actually without the "t", but I could be wrong. You might want to download "depends" which is a free dependency walker that will also show you a list of all the exposed functions in a DLL.

Link to comment
Share on other sites

ok so here is how the battle has progressed

I found out it was a different dll which contains the functions listed in .h file. Thanks to the program you suggested I found it. Now I dont get an error regarding my daqfactory functions. I created a v channel to which i assigned the output of the orbitread1 function. I get no errors.On a page i have the variable displayed. When I hit begin on the sequence it will update the variable but it never runs. The sequence just always says stopped. I've multiplied the variable by various factors and it will update when I hit begin but then that's it, is only logs one data point in the table for that v channel. Here is my code

extern("C:\WINDOWS\system32\Orbit_if.dll","long ConnectToOrbitNetworks(long)","orbitconnect","stdcall")

extern("C:\WINDOWS\system32\Orbit_if.dll","long OrbitPreset(long, long, long)","orbitpreset","stdcall")

extern("C:\WINDOWS\system32\Orbit_if.dll","long OrbitRead1(long, long, long)","orbitread","stdcall")

global reading2

reading2=(orbitread(1,1,0))

I get errors when I try to use one of the other functions, but I'm not sure if i need to connect or zero out the sensor so I might not need them.

My question boils down to, do you think the sequence is not running because the sensor needs some other function?(like connect to orbits networks) ran first, or is it on the daqfactory side like something wrong with my code in the sequence?

Link to comment
Share on other sites

First, put all your extern() statements in their own sequence that's marked "Auto-Start" so it runs on load. There is no reason to do extern() more than once per function. Extern() brings the function into DAQFactory. Once its in DAQFactory you don't need to bring it in again. You can just call it. You can

Next, the sequence is actually running. Its why you get one value. But, it is then stopping because it ran out of things to do. It runs so fast that you never see the icon in the workspace change. You need a loop. Something like this:

global reading2
while(1)
   reading2 = orbitread(1,1,0)
   delay(1)
endwhile

This will cause the reading2 variable to update every second

Link to comment
Share on other sites

Ok, yeah, very newbie mistake there on my part, the function is working fine now. I seem to only be getting a static value from my sensor now. I'm betting either my input parameters are wrong, or I need to use the ConnectToOrbitNetwork or some other function first before I read from the sensor. I'm emailing the LVDT manufacturer to see if they can provide me a little more guidance into their dll level commands. The manual is pretty empty in that area.

Thanks a lot for all the help!

Link to comment
Share on other sites

Ok, so I'm still having problems. I've learned that before I read from the probe I do have to set it's local address. When I use this function one of the input parameters is a 10 character string value. I'm getting an error from the dll function saying that this input has a bad string length. Is this because I'm not specifying the length with a pointer?

Link to comment
Share on other sites

  • 1 month later...

Ok, back to working on this project again...

here are the externs i'm working with

extern("C:\WINDOWS\system32\Orbit_if.dll","short ConnectToOrbitNetworks(short)","connect2orbit","stdcall")

extern("C:\WINDOWS\system32\Orbit_if.dll","short OrbitSetaddr(short, short, string, short)","setadd", "stdcall")

extern("C:\WINDOWS\system32\Orbit_if.dll","long OrbitRead1(short,short,long)","orbitread","stdcall")

I have the following sequence

global reading2

global addressStatus

global connectedStatus

connectedStatus=connect2orbit(1)

addressStatus=setadd(1,1,302A115P01,0)

while(1)

reading2=(orbitread(1,1,0))

delay(.5)

endwhile

now connectedStatus outputs as a 0, which according to the manual means that it connects correctly

addressStatus and reading2 both output 11, the error codes from the manual say that 0x0011 is an incorrect string length error and that when passed through a dll it should drop the 0x00, which i take to mean that by returning values of 11 means thats the errors I'm getting.

I've tried inputing the device id(302A115P01) as shown and defining it as string variable and inputing the variable in it's place with the same result. Also I've noticed that everynow and then when I run the sequence it gets an error and fails to run, but then I can try again and it runs and returns the values I mentioned.

i attached the pages of the software manual for this device which cover the dll commands being used here. Any guidance would be greatly appreciated.

orbitsetaddr.pdf

orbitread1.pdf

Link to comment
Share on other sites

The C prototype is:

(int, int, char *, int*)

"string" in your extern is for const char *, not char*. You need string[10]. You also have short, which would be the same as int, not int*. You need short[1] to pass a pointer. You are lucky this didn't crash DAQFactory. So it should be:

extern("C:\WINDOWS\system32\Orbit_if.dll","short OrbitSetaddr(short, short, string[10], short[1])","setadd", "stdcall")

Link to comment
Share on other sites

on another note, I have created variables for the two parameters which required pointers, and now have those variables listed in the function with an @ sign before them as shown below

addressStatus=setadd(1,1,@devid,@option)

now I get a c1000 error saying the function is not found

Link to comment
Share on other sites

Pointer expected: reading Line 9 - Uncaught error in sequence reading

This is refering to the line containing the following

addressStatus=setadd(1,1,devid,option)

It gives me this error whether i make these parameters variables as shown, or if i simply put the values in as follows

addressStatus=setadd(1,1,"302A115P01",0)

Link to comment
Share on other sites

typedef int (WINAPI* tOrbitSetaddr)(int NetworkNumber,

int ModuleAddress,

char* Id,

int* Option)

that's straight from the h file. from dependencywalker and the help files i posted before though the function is actually OrbitSetaddr withtout the t

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.