Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

how to write and read simultanously using crio 9237 can

Hai All,
 
Am using a crio9004 controller and 9853 CAN Module.  how do i use the can virtual buses to read and write at the same time or is there a way to read and write to can ports at the same time. Thanks for all help
With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
0 Kudos
Message 1 of 6
(8,669 Views)

Hi JK1,

It is possible to read and write on the same port in one program. Because there is only one set of wires (CAN_H and CAN_L) that is used for both transmiting and receiving, you will not be writing at the exact same time as data is coming in, but the CAN protocol will handle the collisions to write your data when no message is currently on the bus. Attached is a simple example using the 9853 CAN module that will write and read on the same port. You will need to modify the project to correspond to your FPGA system. I hope this helps!

Regards,

Missy S.
Project Engineer
RoviSys
0 Kudos
Message 2 of 6
(8,646 Views)
hai missyD,
 
                    Thanks for your reply.  But the requirement is in the RT coding.  Am trying to write to CAN0 port and read from CAN1 port.  The FPGA code for this is created. We use the can 256 and can 257 interfaces to write and read from any of the ports in RT. ie for eg. if i write in can 0 port then the two virtua interfaces are configured for this operation. if there is a read to perform from can 1 port how this can be accompolished coz the two virtual interfaces are already configured for write operation. Pleas help me in this.
 
 
Thanks and regards,
JK
With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
0 Kudos
Message 3 of 6
(8,484 Views)
Hi JK,
This is correct if you are using the channel API and converting both what you transmit and receive into the channel API. Since you only have two virtual ports, you can only do one of these conversions (either the frames you want to transmit or the frames you have received). However, there is an example that reads from CAN0, and writes from CAN1. To change the port that is being used, right-click on the FPGA I/O and click Select FPGA I/O»CAN»NI 9853, then the CAN port you would like to use. The example is called CAN Basic.lvproj and can be found in the Example Finder. Notice it's not necessary to do either conversion and still use the cRIO CAN card. Let me know if you have any specific questions about this example that I can answer!
 
Regards,
Missy S.
Project Engineer
RoviSys
0 Kudos
Message 4 of 6
(8,160 Views)

Hai MissyD,

Thanks for the response.  I got the example vi during my search that exactly solved my problem. the example vi was at the path

http://zone.ni.com/devzone/cda/epd/p/id/5233

With regards,

JK

 

With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
0 Kudos
Message 5 of 6
(7,633 Views)
Hi JK,
I'm glad you found what you are looking for! Thank you for posting that link. Happy programming!
 
Regards,
Missy S.
Project Engineer
RoviSys
0 Kudos
Message 6 of 6
(7,046 Views)