wait() function weirdness

01 Apr 2010

When I use wait() in my code it seems to always be one second regardless of what I set it to.

 do
    {
        result = (MCPAPRead(ph, &resp)) && //expecting FAULT_WARNING_CMD_ID
        (resp.cmdID == FAULT_WARNING_CMD_ID) &&
        //Verify POR IRQ0# is active 
        (match(resp.data, brownOut, sizeof(brownOut)));//fault code 15612
        counter++;
        pc->printf("count %d\r\n", counter);
        wait(0.005);
    }while (result || counter < 20);
when I time the printf to a terminal here, its always 20 seconds. Yet if I do a simple new program with the blinking led it works fine. Have I broken my wait() somehow?

09 Apr 2010

Hi Rob,

Did you get to the bottom of this? My guess is the delay is actually nothing to do with the wait(), and if you remove it entirely you'll see the same behaviour. i.e. that delay is coming from some other aspect of your code. But i'd like to confirm it is something like that to know we don't have any issues.

Simon

15 Apr 2010 . Edited: 15 Apr 2010

Yeah I think your right, I think I am receiving asynchronous messages on the serial port during this portion of code.