キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

While loop delay

Hi,
 
Can any one tell why the delay is comming when i use a while loop inside two while loops.
Please see the code in the attachment for clarity.
 
Presently i am using NI-PXI 6229 DAQ
0 件の賞賛
メッセージ1/18
4,977件の閲覧回数
Sorry but you are going to have to be a bit more clear on what the exact problem is. What delay are you talking about? When, how much, etc.
0 件の賞賛
メッセージ2/18
4,949件の閲覧回数
You also have a few architectural problems:
  • You are not using event structures properly. An event structure is not designed to get stuck inside of a lengthy process. As you have it when you press the Start button you get stuck inside the data acquisition loop and cannot get out until you're done. In fact, the great big "Stop" button won't be read until you've finished the loops.
  • Your loop inside a loop inside a loop (I feel like I'm on a bad RollerCoaster 3 ride) is bound to cause problems.
  • You have a small case structure sitting below the big case structure that looks as if you're trying to update some indicators while the loop is running. This will not work. That case structure must wait until the main loop is done before the Boolean wire has a value. This is a fundamental dataflow paradigm.
  • Your use of the "Value" property node for the Table control is completely unnecessary. Use a wire to connect to the table control's terminal.
  • You are using a while loop and indexing out the rows of the table. Use a for-loop instead and auto-index.
To learn more about LabVIEW it is recommended that you go through the tutorial(s) and look over the material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.
0 件の賞賛
メッセージ3/18
4,925件の閲覧回数

Hi,

In the front panel i am using a table control. Table consists of maximum 100 rows each row is having duration, frequency, duty cycle values as shown below.

Duration (msec)   Frequency (hz)  Duty cycle (%)

400                        5000                   10

500                        4000                 

0 件の賞賛
メッセージ4/18
4,855件の閲覧回数

Hi,

In the front panel i am using a table control. Table consists of maximum 100 rows each row is having duration, frequency, duty cycle values as shown below.

Duration (msec)   Frequency (hz)  Duty cycle (%)

400                        5000                   10

500                        4000                  

0 件の賞賛
メッセージ5/18
4,855件の閲覧回数

Hi,

In the front panel i am using a table control. Table consists of maximum 100 rows each row is having duration, frequency, duty cycle values as shown below.

Duration (msec)   Frequency (hz)  Duty cycle (%)

400                        5000                   10

500                        4000                   10

............................................. upto 100 rows.

While running my code i am observing a delay between 1st row and 2nd row.

I am checking my code with NI PXI-6229 Multi function DAQ and from the counter output pin i am connecting the positive and negative terminals to the buzzer circuitry.

I want to solve that delay when the control is switching form 1st row to the 2nd

 

0 件の賞賛
メッセージ6/18
4,853件の閲覧回数

Hi,

For more clarity see the attached Query.vi

0 件の賞賛
メッセージ7/18
4,852件の閲覧回数

The reason for the lockup is due to your code.  You have not fully grasped the use of an Event Structure.  To learn more about LabVIEW, I suggest you try looking at some of these tutorials.

There are ways of having a single loop that contains the Event Structure, but that would require a very lenghty discussion.  You should change your architecture to a Producer Consumer loops where the Event Structure is your Producer loop and feeds a state machine which is your consumer / communication loop.  The basic reason for that is that you have nested loops within an Event Case.  That's a big "no... no"..  Because as you try & try to stop the operation, unless all the triggers align, it will start a new iteration and reset the triggers, over & over again, which will lock up your PC.  I do realize that you are ORing all those booleans..  But your Event Case wants to process the stop event which will start the whole process again...  You could try removing it from your event case..

Also, you do not need a Case Statement wrapping your code. 

R

0 件の賞賛
メッセージ8/18
4,823件の閲覧回数

see image...



Message Edited by JoeLabView on 07-24-2008 09:44 AM
0 件の賞賛
メッセージ9/18
4,822件の閲覧回数
Hi Joe,
 
I have purposefully placed two buttons in single event i.e start, stop.
I have clearly ensured that the delay is not with these two buttons in the event structure.
I think it is beacuse of DAQmx Clear Task.
Since it is in the while loop pointed in the figure the delay is happening.
To reduce delay i have to reframe the start event structure and trying for the same.
 
 
0 件の賞賛
メッセージ10/18
4,793件の閲覧回数