07-22-2005 10:36 AM
Blog for (mostly LabVIEW) programmers: Tips And Tricks
07-22-2005
11:25 AM
- last edited on
02-13-2025
08:56 AM
by
Content Cleaner
Hi CoastalMaineBird!
Unfortunately, you can’t programmatically add messages/channels to an already existing task, whether that task was generated by the 'CAN Init(Start)' VI or the ‘CAN Create Message(Ex)’ VI.
Regarding the difference between the ‘CAN Create Message’ and ‘CAN Create Message Ex’ VIs:
The ‘CAN Create Message Ex.vi’ allows to create a so called mode-dependent message, so there is a certain bit field that defines how the rest of the CAN data has to be interpreted.
For more information on mode-dependent messages, see page 6-12 in the NI-CAN Hardware and Software Manual for NI-CAN 2.2 (or page 6-23 when you have NI-CAN 2.3).
-B2k
07-22-2005 11:39 AM
So I can't create a task with more than one message, and I can't add a message to an existing task.
That sounds like I have to have a separate task for each message I want. That means separate READ operations at DAQ time. I hope the overhead doesn't cost too much (I'm doing a thousand other things at DAQ time).
I have an RT card in the system I'm designing. It's only using about 5% of the CPU time (PID controlling an engine). Will NI-CAN stuff work on the RT? How do I physically connect it? Is CAN just RS-232 at fast baud rates, or are there more electrical differences?
Blog for (mostly LabVIEW) programmers: Tips And Tricks
07-22-2005
12:57 PM
- last edited on
02-13-2025
08:57 AM
by
Content Cleaner
Hi CoastalMaineBird!
Correct, when you use the ‘CAN Create Message(Ex)’ VIs, you’ll end up having a task per message (CAN arbitration ID).
The CAN protocol uses distinct physical layers (high-speed, single-wire, etc.), so it is electrically not compatible with other serial protocols (e.g RS-232, 485, etc.). In order to have your RT system communicate with a CAN network, you’ll need a CAN bus interface card. Both, the PCI as well as the PXI CAN cards from National Instruments are supported on a LabVIEW RT system.
-B2k
07-25-2005 11:31 AM
Blog for (mostly LabVIEW) programmers: Tips And Tricks
07-25-2005
11:51 AM
- last edited on
02-13-2025
08:57 AM
by
Content Cleaner
Hi CoastalMaineBird!
Just to make sure. When you say ‘RT Card’ you mean the Real-Time Multifunction Data Acquisition Board? Those boards cannot ‘see’ any other interface cards on the PCI bus. So, you can only use those interfaces on RT that are provided by that card.
In order to control individual interface cards (e.g. NI-CAN cards) using LabVIEW Real-Time, you would need to have a PC-based Real-Time system or a PXI-based one.
If neither is an option, you could go with a 3rd party RS-232<->CAN interface, but their throughput/performance is usually (very) limited.
-B2k
07-25-2005 11:59 AM
Given that we're too late in the game to use the dedicated (whole-computer) RT system, I think I'm stuck with plan A, which is to read all the CAN messages at DAQ time (along with 90 SCXI channels, 50 Ethernet channels from other devices, 24 digital inputs, and a few relays just for audio/visual effects).
Oh, well, that's what computers are for...
Blog for (mostly LabVIEW) programmers: Tips And Tricks