[email protected]
[Top] [All Lists]

Re: [Qt-interest] Delay of code execution

Subject: Re: [Qt-interest] Delay of code execution
From: Jason H
Date: Tue, 13 Apr 2010 11:14:44 -0700 PDT
How do you know you've achieved the proper position?
Is there an ACK message that is received or interrupt that is raised?
Ideally, you'd use signal slots, and possibly a state machine. 

Let me give you and example. The elevator in my building is highly reliable and 
regular. But once in a while it does a double-bounce when you get to your floor 
(cable issue) and it doesn't open until the motion has stopped. You're guessing 
that a command completed ok with quickly lead to catastrophe if you assume it 
succeeded in the allotted time. 

However if I were confident, i would set a 200ms timer and have it read a 
command queue and just consume a command (channel, position) every 200ms. Then 
you just have to stuff 3 commands at once. 

Its been a while since I worked with GPIB, but I thought there was an OK 

----- Original Message ----
From: Matthias Pospiech <[email protected]>
To: Qt-interest <[email protected]>
Sent: Tue, April 13, 2010 11:52:31 AM
Subject: Re: [Qt-interest] Delay of code execution

Andre Somers schrieb:
> Perhaps you should talk about the issue you want to resolve by using a 
> delay, instead of the question on how to create a delay. 
I use delay in many cases:

Here a few examples:




The delay time may be exaggerated, but is there to ensure that the 
which is connected via serial bus has finished the last command.

Here I measure the power in different positions. The RotationStage is 
connected via USB (fast),
and the AgilentPowerSensor which requires arbitrary delay times 
typically in the order of  100 ms.
Additionaly I have to wait for the Sensor to finish the last measurement.

    for (int i=0; i < iArraySize; i++)
        if(stopped) {
        RotationStage->move(Array[i].position / 
        RotationStage->WaitForPositionReached(Array[i].position / 
        Array[i].power = AgilentPowerSensor->Power();      

(3) Here a part of the GPIB communction, which is based on C-code:
The delay is required because the device requires a few 10 ms up to 
several 100 ms
time to recieve, generate and send the answer.

long GPIB_Device::GPIB_GetReply(char *command, char *response)
    if(ibcntl < 0) return 0;
    delay (m_GPIB_AnswerDelay);
    GPIB_In((unsigned char *)response,500);
    return ibcntl;

I all this cases I am talking to external devices and work with external 
libraries or communication over Serial Bus.

Hope this gives a better idea for what I require a delay.


EDIT: Yes maybe the QxtSignalWaiter could be a solution. But 
nevertheless I would like to be sure that
all other trivial examples are not solving the problem.

Qt-interest mailing list
[email protected]


Qt-interest mailing list
[email protected]

<Prev in Thread] Current Thread [Next in Thread>