Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

What 's the meaning of "sample rate =-1" when to use the CAN init.vi?

ALL,

      I saw a kind of use to CAN init.vi where The mode = "output recent" and the sample rate = -1. I check the NI  CAN help document, it seems that  the sample rate must be large than 0 when the mode = output recent. So,here,why the sample rate can be -1? What does it mean?

 

Thanks!

 

Lai

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

-1 is not a valid value for the sample rate and doeesn't serve any purpose. It could be that it was possible in older driver versions to use the -1 to disable sampling. Now you can do that by entering the zero (0) for sample rate.

 

DirkW

Message 2 of 4
(7,200 Views)
I found that it is different whether to use "-1" or ''0" to sample rate. In CAN init.vi, there is an input parameter filepath which is used to load the ncd file or dbc file. The ncd file can't set the sample rate of  CAN message, but dbc file can. When I use sample rate = -1 and dbc file , the period(=1/sample rate) of CAN transmission equals  the Sample time defined in dbc file and is not determined by loop time in LabVIEW programm. But when I use sample rate = 0, the period of CAN transmission equals the loop time in LabVIEW programm. So I guess the period of CAN transmission is determined by the Sample time defined in dbc file when use sample rate = -1. Is that true?
0 Kudos
Message 3 of 4
(7,177 Views)

If you use -1 for the sample rate, you should get an error indicating a wrong value for this parameter. There is no such feature to read the dbc file sample rate for your channel.

If you use a sample rate of zero it doesn't sample at all. Instead it reads and writes whenever the function becomes executed within your loop.

 

DirkW

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