Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I use multiple messages with CAN CREATE MESSAGE?

I'm an old hand at DAQ, but new to CAN.

I need to configure the CAN interface without using MAX or a DBC file directly (because i want the user to configure EVERYTHING in one place, and MAX doesn't handle my other channels).

I can provide the message IDs, channel start bits, etc., etc., by importing a DBC file myself.

So I'm looking at the CAN CREATE MESSAGE vi. I can make it work, using a single message, and a few channels on that message.

But how do I add another message to that task? Or do I create another task to handle a different message?


What's the difference between CAN CREATE MESSAGE and CAN CREATE MESSAGEex? I can't find any in the help docs.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 1 of 7
(4,586 Views)
 

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

 
0 Kudos
Message 2 of 7
(4,576 Views)
you can’t programmatically add messages/channels to an already existing task


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?

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 7
(4,569 Views)
 

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

 
0 Kudos
Message 4 of 7
(4,565 Views)
OK, so I'm stuck with multiple READ operations at DAQ time. Rats.

I am already planning on having the CAN card in the system, alongside the RT card, although it crossed my mind that maybe I could unload a card if teh RT would handle the siganl interface. No such luck, I guess.

Do you have any pointers on articles about using the RT as the "boss" of the CAN card? Basically, if I could have the RT control the CAN card too, it would offload the work of all the CAN READING from the host CPU (where I don't have any spare time) to the RT (where I do).
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 5 of 7
(4,559 Views)
 

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

 
0 Kudos
Message 6 of 7
(4,554 Views)
Yes, my client has the PCI 7041 with 6040E daughter board. (I have a loaner on my system as well).
Since my client and I refer to that as the "RT" board, I was confused by your statement:
Both, the PCI as well as the PXI CAN cards from National Instruments are supported on a LabVIEW RT system.




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...

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 7 of 7
(4,547 Views)