FOUNDATION Fieldbus

cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid typecode recieved when using nifGetObjectType

Hello
 
I am developing an application in visual basic 6 using the NI-FBUS package.
 
When using nifGetObjectType I have no trouble finding out the object dictionary datatype (eg array, simplevar, record, varlist etc). But when using the suggested code for aquiring the Object Dictionary Simple Type (float, boolean, etc) I always get a 0 back, which isn't a valid simple type description.
 
Here is some code from the example program provided in the NI-FBUS package.
Ret (nifGetObjectType(BlockDesc, ListParameter, ObjectType))
   
    Select Case ObjectType.objectCode
           Case Is = ODT_SIMPLEVAR
                 typeStr = GetODTypeString(ObjectType.allElems(0))
           Case Is = ODT_RECORD
                 typeStr = "Record"
                 ' You can call "nifReadObject" to get more information of the record members
           Case Is = ODT_ARRAY
                 typeStr = "Array of " + GetODTypeString(ObjectType.allElems(0))
           Case Is = ODT_VARLIST
                 typeStr = "Variable List"
    End Select
ObjectType.allElems(0) is always 0.
 
I have also tried using nifGetObjectAttributes and I get the same result there (I get the datatype, but not the simple type).
 
For the record I am using a Saab Rosemount 5400 device with a correct Device Description file.
 
Thank you in advance
0 Kudos
Message 1 of 11
(12,215 Views)

This should be a bug of standard NI-FBUS Client DLL "nifbstd.dll". Can you please try to use the attached new DLL to replace the existing DLL in the "$WINDOWS\SYSTEM32" directory and try again?

Please let me know you test result, thanks!

 

0 Kudos
Message 2 of 11
(12,207 Views)

Thank you for your quick response.

With the new nifbstd.dll everything works exactly as it supposed to be.

0 Kudos
Message 3 of 11
(12,196 Views)

Good to know it works! And we will ship the new DLL with NI-FBUS 3.2 version this year.

Please send e-mail to us at fieldbus.support@ni.com if you have any other questions.

Thanks!

-- Sean Gao

0 Kudos
Message 4 of 11
(12,192 Views)
how to read the first object of Object Dictionary? when i use nifReadObject(....) with index 0, i am not able to read OD. I think OD first index is 0, but when i read i get E_OTHER error code. i want to read all the objects from OD. please help me out.
0 Kudos
Message 5 of 11
(11,918 Views)

You can not get OD start entry by calling nifReadObject. The index 0 of VFD (FBAP or MIB) is not the first index of OD. You should get to know the index of OD start entry first before you read OD objects by calling nifReadObject.

Different devices have different OD index, an example is that OD of some device start from 256. But you need to find out this value for your device. And the standard NI-FBUS software doesn't provide such information.

0 Kudos
Message 6 of 11
(11,910 Views)

thank you for the response...

but i am not convinced coz as per Foundation Fieldbus specification (FF890F16 Section 5.4) it states

"...The directory object will be defined as the first index in the static object dictionary (S-OD). The starting point of the Static Object
Dictionary is defined by the OD object description which always resides at index 0..." So every FF device will/should have index starting from 0.

I need to read the first index (0) coz it gives me the starting index for S-OD, View Object and Program Invokation. Infact I need to go to S-OD index identified from data read from index 0 then to Link Object. I cannot use .cff files (it has link objects index value), i need to get through Object Dictionary only.

Hope you understood my requirements. Please help me out if possible.

Thanks & Regards,

Shankar.

0 Kudos
Message 7 of 11
(11,904 Views)

You are right that the OD directory object is the first index of S-OD, and you could get index to Action Object, Link Object, Trend Object, Alarm Object through this directory object. However, when you tried to call ReadObject with index 0 input in Dialog Utility, you were trying to read the first (0) object of VFD instead of S-OD.

FF defines a standard FMS service "GetOD" to get the index of the first required object description (StartIndex) of OD, which is the correct way to get the StartIndex of S-OD. In fact, NI-FBUS software calls GetOD service internally to get this StartIndex to interpret the entire OD; thus the clients just need to access the high-level parameters in an easy way.

However, the standard NI-FBUS CM doesn't provide "GetOD", such low-level API. You must find out the start index of S-OD for each device you are using. But for many FF devices, the StartIndex is 256. You can try on it.

When you read the first OD directory object, you will have the following structures:

1) Directory ID (Reserved)
2) Directory Revision Number
3) Number of Directory Objects
4) Total Number of Directory Entries
5) Directory Index of first Composite List Reference
6) Number of Composite List Reference.

7) OD Index for starting Action Object
😎 Number of Action Objects
9) OD index of the starting link object in the VFD.
10) Number of link objects in the VFD.
11) OD index of the starting alert object in the VFD.
12) Number of alert notification objects in the VFD.
13) OD index of the starting trend object in the VFD.
14) Number of trend objects in the VFD.
15) OD index of the starting domain object in the VFD.
16) Total number of domain objects allowed in the VFD.

17*) OD index of the starting MVC object in the VFD.
18*) Number of MVC objects and associated MVC Revision Number objects in the VFD
19*) OD index of the starting MVC variable list object in the VFD
20*) Number of MVC variable list objects

...

Then you can get the index to Link Object and the objects of whole S-OD.

Hope it helps.

 

Message 8 of 11
(11,893 Views)

thank you very much for your answer. I will try to get the starting index of Link Object other than from NI-FBus, as NI-FBus does not support GetOD(...) kind of requests.

Regards

Shankar.

0 Kudos
Message 9 of 11
(11,890 Views)
I noticed that there is a method silGetOD but it requires the sil.dll. Where can I get a copy of it?

When I look at the binary of nifb.exe I see the string
"silGetOD"  so it looks like the CM has access to the "silGetOD" I just dont seem to have visibility.
Could someone help me to access this method so I can get the
the first index in the static object dictionary.  By the way my device does not use 256.

0 Kudos
Message 10 of 11
(10,366 Views)