FOUNDATION Fieldbus

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get OD Directory Object using NI API

If I know the starting index of the Static Object Dictionary (S-OD), can I use nifReadObject() function with NIFB_BLOCK_INDEX macro to read the OD Directory object?
0 Kudos
Message 1 of 4
(7,676 Views)

Hi,

You can use ReadObject() with index marco to read S-OD directory object. The read operation is performed on FBAP VFD instead of blocks, so NIFB_BLOCK_INDEX is not needed.

The procedures are:

1. Open session/Open link/Open physical device.

2. On the device, open FBAP VFD with ordinal number 0. 

nifOpenVfd(devDesc, NIFB_ORDINAL(0), &vfdDesc);

3. Read OD directory object by index. In the following code, the start index of S-OD is 301.

nifReadObject(vfdDesc, NIFB_INDEX(301), (void *)readBuffer, &readLength);

The content is stored in readBuffer.

 

 

 



Message Edited by Vince Shen on 06-11-2008 04:35 AM
Feilian (Vince) Shen
0 Kudos
Message 2 of 4
(7,669 Views)

Thank you for your fast responding.

According to the "Using Interface Macros" section of NI-FBUS Function Reference (Section 6 of NI-FBUS Hardware and Software User Manual, April, 2007), I should use NIFB_BLOCK_INDEX macro if I do not have a block descriptor, and use NIFB_INDEX macro if I have a block descriptor. Should the NIFB_BLOCK_INDEX macro be used since you have a VFD descriptor in your procedure 3? 

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

NIFB_BLOCK_INDEX is for the operations on Block. But in this OD access application, the operations are performed on VFD, which is in higher level than Block. So there is no need to use block descriptor. The index you use in NIFB_INDEX is relative index within VFD.

There are two methods to access a block, by block descriptor or block tag. NIFB_BLOCK_INDEX is used for block data access by block tag. The prototype of this marco is:

NIFB_BLOCK_INDEX(char *blocktag, uint32 idx)

The index is relative index within Block. Using NIFB_BLOCK_INDEX, the data is located by the combination of block tag and index.

Feilian (Vince) Shen
0 Kudos
Message 4 of 4
(7,653 Views)