LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read back CAN session Arbitration ID from NI PCI-8513 XNET database

I am using NI CAN controller PCI-8513 with XNET database. Database setup can be seen in the picture below

I am able to read CAN  session name by using the following code in LabWindows CVI. 

 

When returned, PropList = "PID_Write_ECU1". Now I want to get the arbitration ID (0x712). How can it be done? Help please

 

uint32_t propertySize;
uint8_t PropList[100];
uint8_t DatabaseName[100];
nxDatabaseRef_t DatabaseRef;
uint32_t ArbID;
nxStatus_t nx_status;

char CAN_DB_FilePath[100] = "C:\\temp\\XNET_Database.xml";
nx_status = nxCreateSession (CAN_DB_FilePath, "CANA", "PID_Write_ECU1","CAN1", nxMode_FrameOutSinglePoint, &PID_Write_ECU1); // 0x712

nxGetPropertySize (PID_Write_ECU1, nxPropSession_List, &propertySize); 
nxGetProperty(PID_Write_ECU1, nxPropSession_List, propertySize, PropList);

 

nx_status = nxClear (PID_Write_ECU1); 

 

 

XNET Database.png

0 Kudos
Message 1 of 5
(2,877 Views)

After looking at the documentation it seems to me that that value cannot be retrieved from the session but it must be read from the database you are using instead,  by means of the function

 

nxdbGetProperty (DbObjectRef, nxPropFrm_ID, 0, &PropertyValue);

Look at these help pages: nxdbGetProperty  and nxPropFrm_ID

 



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 5
(2,856 Views)

I've tried the function of nxdbGetProperty before, but failed.

 

nxdbOpenDatabase (CAN_DB_FilePath, &DatabaseRef);    

nxdbGetProperty(DatabaseRef, nxPropFrm_ID, 4, &ArbID); 

 

error.png

0 Kudos
Message 3 of 5
(2,834 Views)

Hi Charlie,

 

Since you are using the nxdbOpenDatabase function to immediately store the database reference in DatabaseRef, I have to assume one of the other references in nxdbGetProperty are causing this error to be thrown. Are you sure nxPropFrm_ID is a valid u32? I would just double check all the parameters you're passing to it with this help document on the function: http://zone.ni.com/reference/en-XX/help/372841T-01/nixnet/nxdbgetproperty/

Applications Engineering
National Instruments
0 Kudos
Message 4 of 5
(2,824 Views)

Disclaimer: I never tried to get this property so I may be wrong

 

In my opinion the idea to focus on is to use the correct object reference: since you are looking for a frame attribute, you should pass a frame object reference, which I suppose you can obtain by calling

nxdbFindObject (ParentObjectRef, nxClass_Frame, "", &DbObjectRef);

with the appropriate parameters (e.g. the frame name). As far as I can understand, the parent object reference should be the database reference you have already gotten.

 



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 5
(2,817 Views)