LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Has anyone used the NC_ATTR_WRITE_ENTRIES_FREE attribute with ncGetAttribute?

Has anyone used the NC_ATTR_WRITE_ENTRIES_FREE attribute with ncGetAttribute?

I am using a NI-PCICAN / Series 2 card. I have developed a program for my application using Visual Studio C++. I configure the CAN card following:

//code snippet
AttrIdList[0] = NC_ATTR_BAUD_RATE;     AttrValueList[0] = NC_BAUD_500K;
AttrIdList[1] = NC_ATTR_START_ON_OPEN; AttrValueList[1] = NC_TRUE;
AttrIdList[2] = NC_ATTR_READ_Q_LEN;    AttrValueList[2] = 20;
AttrIdList[3] = NC_ATTR_WRITE_Q_LEN;   AttrValueList[3] = 20;
AttrIdList[4] = NC_ATTR_CAN_COMP_STD;  AttrValueList[4] = 0;
AttrIdList[5] = NC_ATTR_CAN_MASK_STD;  AttrValueList[5] = NC_CAN_MASK_STD_DONTCARE;
AttrIdList[6] = NC_ATTR_CAN_COMP_XTD;  AttrValueList[6] = 0;
AttrIdList[7] = NC_ATTR_CAN_MASK_XTD;  AttrValueList[7] = NC_CAN_MASK_XTD_DONTCARE;
AttrIdList[11] = NC_ATTR_WRITE_ENTRIES_FREE;    AttrValueList[11] = NULL;
const uint32 NumAttrs = 9;

Status = ncConfig(Settings.CANCard, NumAttrs, AttrIdList, AttrValueList);
//end snippet

So the internal buffer size is 20. I am getting a buffer overflow error later on in the code when I write data frames to my application using ncWrite. I would like to use the NC_ATTR_WRITE_ENTRIES_FREE attribute with ncGetAttribute to determine how many entries are free in the buffer, thereby avoiding overflow. The manual does not list this attribute ID in the commonly used attribute IDs for ncConfig using the CAN Network Interface Object. The manual states in ncGetAttribute that, "You can get any value of AttrId mentioned in ncConfig using ncGetAttribute. The following list describes other AttrId you can get using ncGetAttribute." However, when I used this method, I receive an error from ncGetAttribute about invalid Attribute Id.

Any suggestions?
0 Kudos
Message 1 of 1
(2,383 Views)