LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to update the payload of CAN frame during transmission?

I am using NI-XNET and I have a frame (Signal A, B,C) set as cyclic data. I would like to transmit it and sometimes I need to update the value of signal A in that frame. After a while, I would like to update value of signal B and update it to the current frame which included value of signal A.
How can I do that?

Thank you for your supports in advance.

0 Kudos
Message 1 of 14
(3,584 Views)

If you used a .dbc or .xml to organise your CAN frames? If so, use XNET Write.vi in Signal Single-point mode to transmit your signals. You just do that only once, the CAN signals can be transmitted as you want. If you want to refresh signals, then just use XNET Write.vi again.   

0 Kudos
Message 2 of 14
(3,519 Views)

I tried your solution but I see at the reading node, I read 2 data of frame. one with the original frame and one with the new signal value. I think the reason because I create 2 different sessions. How do you create session with your suggestion, one for frame, one for signal?

0 Kudos
Message 3 of 14
(3,510 Views)

You can transmit your original frame under a while loop, and  transmit your signals as I said. It‘s OK to run two XNET write.vi in different modes at the same time.

0 Kudos
Message 4 of 14
(3,503 Views)

My data is the Cyclic data, I just create Frame Out Single-point and start session. In while loop I did not write for original frame. I add an event structure inside while loop to write the data for signal. But when I read that frame at the receiving node, I see two data of frame. One is original frame, one is the new frame with signal data. It repeats continuously.

0 Kudos
Message 5 of 14
(3,497 Views)

Now I want to see your VI.

0 Kudos
Message 6 of 14
(3,495 Views)

Please check it

0 Kudos
Message 7 of 14
(3,468 Views)

Adding XNET write.vi into your "signal data: value Change" event can solve your problem. 

0 Kudos
Message 8 of 14
(3,464 Views)

Sorry I don't understand your idea. Can you help me to make it and upload the snippet here? Thank you so much

0 Kudos
Message 9 of 14
(3,462 Views)

test.PNG

See the picture, and then you can understand.

 

0 Kudos
Message 10 of 14
(3,458 Views)