
We also design a fault-tolerant mechanism called track routing to tackle location errors for ensuring reliable and on-time data delivery. To reduce the control overhead, a lightweight sink location calibration method is devised, which cooperates with the rough estimation based on the mobility pattern to determine the sink location. We characterize the object of DERM as realizing the energy-optimal anycast to time-varying destination regions, and introduce a location-based forwarding technique tailored for this problem. This paper proposes a delay-aware energy-efficient routing algorithm for WSNs with a path-fixed mobile sink, named DERM, which can strike a desirable balance between the delivery latency and energy conservation. However, when the sink (i.e., data collector) path is fixed and the movement is uncontrollable, existing schemes fail to guarantee delay requirements while achieving high energy efficiency. Exploiting mobility present in WSNs for data collection can effectively improve the network performance. If current consumption is an issue and the MCU supports sleep/wake-up, you can usually configure the MCU to go into sleep mode until the timer has elapsed.Wireless sensor networks (WSNs) involve more mobile elements with their widespread development in industries. If blocking the CPU is not an issue, that is if your program has nothing useful to do while waiting, then you should setup a hardware timer and poll that timer flag as in your second example.įor harder real-time requirements, you will have to use timer interrupts. You might need various clever tricks to prevent this from happening.
#Static z software simple delay code
#Static z software simple delay software
If you care only about ease of use: Software If you care about anything other than ease of use: Hardware Timer It's a bit more complicated to setup, and if multiple tasks require delays, you may run out of hardware timers and then have to resort to a more complicated system of managing time and delays.

While you wait you can either go to sleep or perform another task. If you care about power, time, or efficiency, then a hardware timer is the way to go.

It's easier to implement, and you can scale it as high as you want with great ease. If you don't care about power, time, or anything, then go with a software-driven delay. Now for a microcontroller or any embedded system, the same is true.

That is maximizing your time so you can do other tasks. Who cares.īut on a busy day, where you have other things to do, like catching a movie, or studying or whatever task, the efficient thing to do is you load the first part of the laundry, then go to the bank, then load the second part of the laundry.

On a lazy day, you could just do the laundry and then go to the bank. How would you go about performing these tasks? Going to laundry requires you to wait for the washer to finish, and then wait for the the dryer to finish. You need to go to the bank (which is just around the corner) and do your laundry.
