From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Agilent N6841A SAL Libraries in Labview

Hello there,

 

Anyone with experience connecting Labview to Agilent's RF Sensor N6841A?

 

The sensor includes an API called SAL. It is formed by the files agSal.dll, agSal.h and agSal.lib. If I use the dll wrapper tool most of the functions are not mapped because what appears data types not recognized. I can get the code to work in CVI but I have to use the agSal.lib file in the project tree. I would like to be able to use the sensor in labview though.

 

Any ideas around this?

0 Kudos
Message 1 of 7
(3,364 Views)

You could write a dll wrapper in CVI to convert it to data type that LabVIEW could recognize. Then, you could compile it to LabVIEW compatible dll.

0 Kudos
Message 2 of 7
(3,345 Views)

Hi Kate,

 

Thanks for the suggestion. I will try that and see how it works. Never done it before though. Any tips?

0 Kudos
Message 3 of 7
(3,341 Views)

I made LabView VI-s to call SAL functions. That works good in many applications: DVB-T receiver, route registration, RDS decoder and others. You can use the LabView DLL importing wizard, but not all function will work. You must manually correct cluster data, some case by inserting dummy datas to adjust correct size of original C data structure.

0 Kudos
Message 4 of 7
(3,284 Views)

Hi,

 

Could you post your code here to see how is done?

 

Thanks

0 Kudos
Message 5 of 7
(3,093 Views)

The original typedef in agsal.h c header is:

typedef struct _salGPS{
salUInt32 version; /**< GPS descriptor version */
salUInt32 reserved1; /**< Reserved for future use */
salUInt32 reserved2; /**< Reserved for future use */

salValidGpsMask valid; /**< bitmap indicates which GPS values are valid (see ::salGPS_INDICATOR for bit values) */
salChangeGpsMask changeIndicator; /**< bitmap indicates which GPS values have changed (see ::salGPS_INDICATOR for bit values) */

salFloat64 latitude; /**< Sensor latitude in degrees; -90 (South) to +90 (North) */
salFloat64 longitude; /**< Sensor longitude in degrees; -180 (West) to +180 (East) */
salFloat64 altitude; /**< Sensor altitude in meters */
salFloat64 speed; /**< Sensor speed in meters/second over ground */
salFloat64 heading; /**< Sensor orientation with respect to true North in decimal degrees; 0 (North) to ~359.999999 degrees */
salFloat64 trackAngle; /**< Sensor direction of travel with respect to true North in decimal degrees; 0 (North) to ~359.999999 degrees */
salFloat64 magneticVariation; /**< Magnetic North variation from true North in decimal degrees (-180 (West) to +180 (East)) */
} salGPS;

 

In LabView you interpret this like a cluster, as you see in attached picture. There is a new cluster element after the salChangeGpsMask (dummy1) with Unsigned Long type. Why?

In LabView the cluster element is mapped by 8 byte. In this case the length of:

version (U32) + reserved1 (U32) = 8 byte

reserved2 (U32) + valid (U32) = 8 byte

changeIndicator (U32) + dummy1 (U32) = 8 byte

latitude (DBL) = 8 byte, and so on.

If you don't put the dummy1 (U32) after the changeIndicator (U32) the LabView maps 4 byte from latitude, and after the changeIndicator all elements has invalid values.

 

When you imported the AgSal.dll the LabView do these added elements, but in most case you must manually check it.

0 Kudos
Message 6 of 7
(3,016 Views)

Hi krbg, 

 

I would recommend reposting your questions in a new forum discussion. Because this discussion was created over a year ago, reposting in a new forum will increase the visiblity of your post. 

 

Could also please clarify the question you need answered? 

 

Thanks. 

 

 

Will M.
Applications Engineer
National Instruments
0 Kudos
Message 7 of 7
(2,991 Views)