Main Site Documentation

Cli() & delayMicroseconds() & nop()


#1

What a weird topic name isn’t it ::slight_smile:

I’m trying to do a quick and dirty port of a timing critical code (guess from which platform ;))

  1. I have critical section I would like to protect from interrupts, any interrupts, any disturbance.
    While the code has a single thread, there is still timer and serial interrupt that could break my code flow.
    So I am looking for an equivalent of cli()

  2. I also need to do fine tuning delays in the microsecond domain (from 10 to 1000), so Thread.Sleep() is not an option.
    If there is no existing function, can I use a timer ?
    Reading timer counter until it reaches a value would work.
    How ?

If you are about to say RLP, cross the street to the other side.
I said quick_and_dirty ;D

Thanks


#2

I would tell you the solution, but you would not be able to hear me from the other side of the street.


#3

It’s nice over here on this side of the street, isn’t it, Mike?


#4

Quick = writing native code in notepad
Dirty = doing so while drinking a martini

How is that not RLP? :wink:

Sometimes in correct answer is not the one you want to hear.


#5

:’(