Data aquisition in Loop: sleep messing things up?

Hi I am having some trouble with a piece of code here.
Essentially I am trying to get data out of various entries in different waves (which are constantly updated) into another (2d) wave.
I have created global variables with the correct dependencies and these refresh perfectly. I created a manual-entry-button and that works just fine: i get values y1 and y2 into the next row of my wave.
now the problem:
if i create a loop to get the data, wait a second and then get the data again, for some reason i get identical entries in every row of my wave....

here is my approach right now (code for a checkbox)

if (checked == 1)
print "on"

nvar measurements=root:vacuum:measurements
nvar druck=root:vacuum:druck
nvar qvalue=root:vacuum:qvalue
wave vaquum
do
vaquum[measurements][%pressure]=Druck
vaquum[measurements][%qvalue]=qvalue
measurements=measurements+1
sleep/C=-1 /t 60
print measurements
print druck
if(measurements>1023)
break
endif
while (checked==1)


else
print "off"
endif


All I want this to do is to act as if I am pressing the button mentioned above every second.

Any Idea where I am going wrong??? Some hints would be greatly appreciated!
Thanks for your time,
Jonathan
sorry, forgot to highlight the code:

if (checked == 1)
                print "on"
               
                nvar measurements=root:vacuum:measurements
                nvar druck=root:vacuum:druck
                nvar qvalue=root:vacuum:qvalue
                wave vaquum
                do
                    vaquum[measurements][%pressure]=Druck
                    vaquum[measurements][%qvalue]=qvalue
                    measurements=measurements+1
                    sleep/C=-1 /t 60
                    print measurements
                    print druck
                    if(measurements>1023)
                    break
                    endif
                while (checked==1)
               
               
else
        print "off"
endif
Try adding a call to DoUpdate after the Sleep command. I think you need to call DoUpdate when in a user function to update dependencies.
aclight wrote:
Try adding a call to DoUpdate after the Sleep command. I think you need to call DoUpdate when in a user function to update dependencies.

Thanks for your reply, sadly I had already tried that. The GUI pretty much freezes when I check the box "on". The only way to stop the loop at that point is abort...
Try adding DoXOPIdle to the code. If you're using NIDAQ Tools MX, the XOP that provides the engine for data acquisition needs time to run in order to transfer data from the NI driver's buffer into your acquisition waves.

With a one-second period, I would program this as a background task. To learn more, execute this command on Igor's command line:

DisplayHelpTopic "Background Tasks"

Be sure to use a named background task.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
johnweeks wrote:
Try adding DoXOPIdle to the code. If you're using NIDAQ Tools MX, the XOP that provides the engine for data acquisition needs time to run in order to transfer data from the NI driver's buffer into your acquisition waves.

With a one-second period, I would program this as a background task. To learn more, execute this command on Igor's command line:

DisplayHelpTopic "Background Tasks"

Be sure to use a named background task.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com

the DoXOPIdle command did not do the trick but changing it to a background task sure did!!! Thank you so much for your rapid and extremely helpful reply. It works like a charm now. I had been suffering over this for days...