06-10-2008 08:04 AM
06-11-2008 04:33 AM - edited 06-11-2008 04:35 AM
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.
06-11-2008 09:14 AM
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?
06-11-2008 10:24 PM
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.