From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

xNet wait for message

Hello,

 

I am working on an complex application, that is very hw demanding and I am trying to make the code as smooth as possible. I would like to read CAN data, only when there is data available. From what I read, this is not possible using XNET, only via polling, is this correct (I use XNET 1.4)?

 

If so, is it better to code the CAN part using the CAN api, I have noticed that there are wait functions available.

 

The CAN driver should read every frame with HW timestamp to determine skipped frames and further is timestamped with central PC time to connect with remaining gathered data.

 

Thank you, any response is welcomed.

0 Kudos
Message 1 of 4
(6,152 Views)


Hi Bublina,

As I understand, you want to read CAN data using minimal resources only. Could you tell me some further details about this application, so that I can see the problem more clearly? What kind system are you using? What is the expected rate of CAN data received?

With XNET, working sessions put received CAN frames into a buffer and you can read multiple timestamped frames at once with one call of XNET Read (Frame CAN).vi so if your data flows in at a fairly reliable rate, I would recommend using such a method. The wait functionality of the CAN API is also available in XNET, with the XNET Wait polymorphic VI. You can find further info about these items at
http://www.ni.com/pdf/manuals/372840b.pdf , Chapter 4 Pages 18 and 434, respectively.

Kind regards:

Andrew Valko
Applications Engineer
National Instruments

Andrew Valko
National Instruments Hungary
0 Kudos
Message 2 of 4
(6,125 Views)

Thanks for answer,

 

I handled the problem on my own, it was caused by my not knowing that functions that read the whole frames (frame input queued) do wait for the frames, compared to the frame input single point mode that does not wait for incoming data.

0 Kudos
Message 3 of 4
(6,121 Views)

Dear Bublina,

 

I'm glad you were able to resolve this issue. If you have any other trouble or question regarding you application, feel free to contact us.

 

Kind regards:

 

Andrew Valko

National Instruments

Andrew Valko
National Instruments Hungary
0 Kudos
Message 4 of 4
(6,110 Views)