Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Maximum sample rate CAN?

Hello,

I have not much experience with CAN. But right now I have a program which writes with 20 Hz to a device on the CAN Bus and reads with 100 Hz. To do that, I am using two completely independent loops each using CAN Tasks/Channels. I hope that this is basically ok - is it?

The program works - at least it reads reasonable data. 

 

Now, my question is:

What would be the highest possible sample rate I can use for reading?

I have a PXI-8461/2 and I am using Labview 7.1. In the data sheet it just says high speed and up to 1 Mbyte/s. But what does this mean in my case?

Each read procedure reads 8 Bytes. Does this mean I can read at a maximum speed of 1.000.000 Bytes / 8 Bytes = 125 kHz ?

And does the parallel CAN - Write influence this max sample rate somehow ?  

Message Edited by Andband on 02-25-2010 10:19 AM
0 Kudos
Message 1 of 6
(5,190 Views)

Normally dtarates for CAN are specified in bitrates.

And also please use just one speed for reading and writing. Why should you make that difference?

greetings from the Netherlands
0 Kudos
Message 2 of 6
(5,182 Views)

Albert Geven wrote:

Normally dtarates for CAN are specified in bitrates.

And also please use just one speed for reading and writing. Why should you make that difference?


No, the only thing I can choose with the CAN Read Task is a sample rate. 
And why I don't read and write at the same speed? To not cause more traffic on the bus than necessary to get the best performance for reading. 
 
 

 

0 Kudos
Message 3 of 6
(5,178 Views)

Hello Andband,

 

With CAN protocol you want to always write and read at the same rate to ensure that your data is always framed properly.  If you communicate at different rates the driver will not know how to interpret the data on the lines.  What are you communicating to on your CAN bus?  Normally the devices you are communicating to communicate via a specific baud rate and CAN port settings.  You can set these same settings both with code, or in Measurement and Automation Explorer (MAX).  

 

What API are you working with as well.  In LabVIEW there are a number of examples on how to communicate with CAN devices.  Please post back and perhaps we can offer more specific suggestions.   

ColeR
Field Engineer
0 Kudos
Message 4 of 6
(5,156 Views)

Thanks for your reply ColeR,

As I've described,I am using Labview 7.1

I am using too loops there. One for CAN Task read. One for CAN Task write. I am not using the CAN Frame moduls. In the end everything comes back to a frame, of course.

 

The write command is just a value for a sensor, to stay activated (It expects at least 2 signals a second to do that)

The read command reads the output-data from that sensor. 

I haven't set a baud rate, but it still works... 

0 Kudos
Message 5 of 6
(5,145 Views)

Hello Andband,

 

Perhaps you can offer us a few specifics on how to help you out here. Somewhere, the baud rate has been set for your CAN port and it would seem that it has probably been set in Measurement and Automation Explorer (MAX) and it just so happens that your device is set for the same baud rate.  

 

1. Will you post a picture of the code you are using for the write functions?
2. Will you take a screen shot of how you have these ports configured in MAX?

3. What sensor are you trying to communicate to?

ColeR
Field Engineer
0 Kudos
Message 6 of 6
(5,115 Views)