Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN message transmit for particular time interval

Hai
     I am using PCMCIA CAN card
In my program i am transmiting CAN data every five second,
When i click "TesterPresent" check box the data assigned is transmitted for every 5 sec till i select "Single Frame" button. when i select "SingleFrame" button the loop will end
 
the other option i have in the program is to transmit the data by enter the data in the "TxMSG" control & by click on "Test 1" button the respective data is transmitted for every 5 seconds till i select "Single Frame" button.
 
but when i select the "SingleFrame" button it takes some time to stop the loop.
 
I attached my program, please help me to solve this.
I am using LabVIEW 7.1
 
thanks
SK
 
0 Kudos
Message 1 of 2
(2,982 Views)

but when i select the "SingleFrame" button it takes some time to stop the loop.

 

This is expected. The Wait (ms) can't be interrupted. So in your case, depending on when the button is pressed and read by the program, the time to stop the loop can go from about 0ms to >5000ms.

I would strongly suggest to use a state machine instead of all multiple sequences. This would give you much more flexibility and would decrease the usage of local variables. But this was not your question...

An easy way, with only very small changes to your code, to achieve a faster response of the button is to replace the Wait (ms) by the attached VI. Sorry for the french documentation of the VI. See attached picture and follow above description :

1) Replace Wait (ms) in sequence 0[0..3] in case 0 with the attached VI

2) Wire Time (ms) to its Attente [ms] input. This sets the time to wait.

3) Create a constant for the Tcycle [ms] input. 100ms for example. This sets the period of the while loop inside the VI. The state of the button (passed by reference) will be read at this rate and the VI will stop "immediately" if the button is pressed. In the normal case, the loop will stop when the delay is over.

4) Create a reference for the SingleFrame boolean. Right click on the Control >> Create >> Reference

5) Wire this reference to the Réf Stop input of the VI

6) Repeat for every instance of the Wait (ms)

Download All
0 Kudos
Message 2 of 2
(2,970 Views)