Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I read and write on the same CAN Port

I have a PXI chassis with a NI PXI 8464 CAN card.  I am learning to use this device.  I am trying to send messages back and forth between the two ports on the card.  I have four simple VIs:ReadWas; WriteWas;ReadSteering; and WriteSteering.  I have been starting the read VIs first then starting the write VIs.  When I start the write VIs I get an error from CAN init saying I am trying to change an object that is running. 
 
Is it possible to send and receive on the same port of the CAN card without stopping then reinitializing the card?
 
 I have attached ReadWas, ReadSteering and WriteSteering to this post.  ReadWas and WriteSteering share a CAN port.
 
Any help is greatly appreciated,
 
Thanks,
 
Phillip
Download All
0 Kudos
Message 1 of 2
(3,345 Views)

have you looked at this example, (CAN Send & Receieve using NI-CAN Frames) it is in the example code section 

http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=E993D9B56C3D2BABE0340003BA230ECF&p_...

http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=E993D9B56C3D2BABE0340003BA230ECF&p_...

Basically, you are getting the error because the second time you call CANconfig it realizes it is already open. Try consolidating the 2 pieces of code into 1 CAN VI.

0 Kudos
Message 2 of 2
(3,336 Views)