Industrial Communications

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-XNET How to disable Tx of a single cyclic frame in a multi-frame session

Hi all,

     I have an application that is configured to cyclically transmit a set of CAN frames using XNET. The Tx session is created as type Frame Output Single-point. I need to be able to disable and enable the transmission of each of these frames at will during runtime. That is, I need to be able to control which of the set of frames is actively transmitting. It could be none, the entire set of frames, or any subset in-between.

 

Is there an easy way to do this?

 

Looking through the XNET documentation, this feature does not appear to be easily/clearly supported by XNET (e.g. with a simple boolean flag like Frame.Enable). I've come up with a couple different implementations to make this work, but neither seem ideal. So I'm curious if there's a feature or property out there that I'm missing.

 

My first approach recreates the Tx session every time the Tx active frame subset changed. To disable or enable a frame, the code closes the existing session and opens a new session with the updated set of Tx frames. This works, but has the disadvantage of slightly shifting the Tx time base every time the session is closed and recreated. Over time, this shift could be problematic.

 

The second method I've implemented utilizes the Frm.SkipNCyclic property within the XNET Session class to effectively disable frames. For any frame that needs to be disabled this property is set to the max U32 value, and for enabled frames this value is set to 0. This implementation seems to be working without issue. It has the benefit of utilizing a single Tx session so that the Tx time base does not shift, but it feels clunky. 

SkipNCyclic.png

 

It strikes me as odd that there's no simple enable/disable flag for cyclic messages. Am I missing something? Is there a better way to implement this feature? Happy to hear any thoughts or suggestions on the matter.

 

Thanks in advance.

 

 

0 Kudos
Message 1 of 2
(2,711 Views)

Hey KWR,

 

I see your post has been here a while with no response. There is a slightly better forum for XNET and CAN bus questions - Automotive and Embedded Networks. I recommend posting this there. This forum is more focused on EtherCAT, PROFIBUS, and similar industrial protocols.

 

Thanks!

Andrew T.
"His job is to shed light, and not to master" - Robert Hunter
0 Kudos
Message 2 of 2
(2,580 Views)