1 Reply Latest reply on Jun 24, 2014 2:20 AM by SpiderKenny

    Why does it take 3ms to run a instruction "digitalWrite()"?


      When I use windows Arduino IDE for Galileo to program on a Galileo board, I find it use 3ms to run a "digitalWrite()".


      Compile and run this code as follows(without delay):

      void loop( void )





      Then I can get a square wave which has a period time of more than 6ms.


      But when I use the same code on an ordinary Arduino UNO board using Arduino official IDE, it only takes 4us to run that instruction.

      I know that 4us is still not the optimal cost, since code like "PORTB=0XFF" is more efficient in AVR. But how can the Galileo use thousands of bus cycles to execute this simple instruction?

      I have tried this on two Galileo boards and get the same result. So maybe the only way out is to find the address of all of the registers in Quark. But it sames rather difficult for I don't know how to find data like this.