none
Microsecond delay. RRS feed

  • Question

  • Working with an external LED board with a WinCE Compact 7.0 C++ application.

    I need to set the GPIO to high and low to simulate bits going out to the LED board.

    I have the GPIO working.. What method should be use for simulating microsecond delays ?

    I did find this function  NdisMSleep(nDelay);

    however when I include the ndis.h I get "invalid integer constant expression" error.

    Wondering what others are using for this ?

    Wednesday, February 27, 2019 3:11 PM

Answers

  • The best solution might have been a hardware solution - I assume that it is too late for that now.  Your loop is probably the best that you can acheive.

    You will want to set the thread priority fairly high (low number), but if you do so, play nice with the system overall and let other threads run when you can, like between bytes or every few bytes anyway.  The high priority will prevent other threads from taking your quantum, but will also prevent interrupts from being handled and UI from being responsive.


    Bruce Eitman
    Senior Enginer
    Bruce.Eitman AT Synopsys DOT com
    My BLOG http://geekswithblogs.net/bruceeitman
    I work for
    Synopsys

    • Marked as answer by EmbeddedBlue Thursday, February 28, 2019 8:41 AM
    Wednesday, February 27, 2019 7:12 PM
    Moderator

All replies

  • Ill probably just end up using a for loop with a volatile to prevent optimisation
    Wednesday, February 27, 2019 5:25 PM
  • The best solution might have been a hardware solution - I assume that it is too late for that now.  Your loop is probably the best that you can acheive.

    You will want to set the thread priority fairly high (low number), but if you do so, play nice with the system overall and let other threads run when you can, like between bytes or every few bytes anyway.  The high priority will prevent other threads from taking your quantum, but will also prevent interrupts from being handled and UI from being responsive.


    Bruce Eitman
    Senior Enginer
    Bruce.Eitman AT Synopsys DOT com
    My BLOG http://geekswithblogs.net/bruceeitman
    I work for
    Synopsys

    • Marked as answer by EmbeddedBlue Thursday, February 28, 2019 8:41 AM
    Wednesday, February 27, 2019 7:12 PM
    Moderator