thanks Steve,
So this would require a pause of 1 second if the reading is zero? I can't afford that kind of delay. Is there another way?
Mark
thanks Steve,
So this would require a pause of 1 second if the reading is zero? I can't afford that kind of delay. Is there another way?
Mark
Yes, you could start an endless timer interrupt (let's say few milliseconds) in which you check your value, then start the HPWM and keep track of the required delay.
OR, enable the timer interrupt in your code, and assign a duration or flags for the HPWM.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
The way I would do it is to implement a soft PWM. I think it's been covered on this site already. Let a timer run in the background every mS. Give it a value for on time of the buzzer (0-1000mS) Every time the timer ticks, you can verify if the buzzer needs to be on or off. Now, all you have to do is give it a value from your mainline code.
jerson,
why soft and not HPWM? Honestly I'm not fully getting this...
Mark
MUC
Franklysimply because I'm so used to it by now, I've never had to do the HPWM. I do a lot of temperature controllers with cycle times in the range of 1 to 30 seconds. So, ..... It's more a matter of personal taste.
Jerson
Bookmarks