gavinthacker
- 7th March 2016, 17:38
I have built a frequency generator with a 16F88 to fake a speed source when working on farm equipment.
Originally I was manually calculating the period using 1000*1000, then DIV32 by my desired frequency to get my period in us and manually outputting the signal, but it takes too long at higher frequencies. I have since changed it to use my old output below 250Hz and HPWM above that. This works great when starting below 250Hz and transitioning up, but after it switches to HPWM and I come back down below 250Hz I can't control the pin manually anymore. I was stopping the output with HPWM 1,0,0 but the pin is stuck at 0 after that.
The only work around I have come up with so far is allowing the controller to reset itself at this transition point so that it starts fresh without HPWM active; however, I don't like this method.
Is there a way to completely stop the HPWM command, or am I going about this the wrong way?
Regards,
Gavin
Originally I was manually calculating the period using 1000*1000, then DIV32 by my desired frequency to get my period in us and manually outputting the signal, but it takes too long at higher frequencies. I have since changed it to use my old output below 250Hz and HPWM above that. This works great when starting below 250Hz and transitioning up, but after it switches to HPWM and I come back down below 250Hz I can't control the pin manually anymore. I was stopping the output with HPWM 1,0,0 but the pin is stuck at 0 after that.
The only work around I have come up with so far is allowing the controller to reset itself at this transition point so that it starts fresh without HPWM active; however, I don't like this method.
Is there a way to completely stop the HPWM command, or am I going about this the wrong way?
Regards,
Gavin