LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-CAN: VI wont stop.

Hello All,

 

I am developing an application where I am sending a continuous non periodic waveform using the CAN bus. I have attatched a skeleton VI below.  The problem is that when i am sending a large amount of data, say a waveform containing about 200000 values at 100 Hz, i cannot stop the data transfer from Labview. 

 

Please advise how I can fix this problem. 

 

Regards,

Shailesh.

0 Kudos
Message 1 of 5
(3,211 Views)

Hi Shailesh,

 

the problem is sending 200000 values and having the stop criteria in the same loop. In one loop the can write.vi first writes all values and thereafter LV evaluates wether stop button is pressed or not.

For solving it you should e.g. write your values in samples, not all at one time or implement event case structure.

 

Hope it helped you

 

Regards,

Sergei Penner

National Insruments

Applications Engineering Department

Message 2 of 5
(3,187 Views)

Hello Sergei,

 

thanks for the reply. I think doing it with samples sounds like the right way to go. I haven't been able to find any examples for that though. Could you guide me in that matter?

 

Regards,

Shailesh.

0 Kudos
Message 3 of 5
(3,181 Views)

Hi Shailesh,

 

one thing I don't get: in comments in block diagram you say that you want to write 100 sample each loop, but in can_write.vi your input is 200000 samples?

 

regards,

Sergei

Message 4 of 5
(3,159 Views)

Hello Sergei,

 

I can explain this occurence as follows. The original intent was always to write at 100 samples a second. This can be configured during the initialisation of the task. However, writing a value of 100 to Can_write.vi only made Labview write the first 100 values repeatedly. Replacing 100 with 20k ensures that the 20k values are written but the VI does not sample the stop signal till all 20000 values are written. I have come up with a way to write the values 100 at a time but I am facing some problems. As of now, I rearrange my array of 20k elements into an array with 200 x 100 elemnts. I then index the 200 rows of this array inside a while loop. The counter of this while loop is incremented everytime can_write has written 100 values. The problem here is that the last of the 100 values is written 4 to 5 times instead of just once before the next set of 100 values is written. I think it has something to do with the timing issues of while loops. If you can think of a solution or an alternative, please let me know.

 

Shailesh 

0 Kudos
Message 5 of 5
(3,146 Views)