PDA

View Full Version : measure pulse width 0-150Hz



kewetman
- 15th November 2007, 20:06
Hi All

i'am new in picbasic pro.

can somebody help me with some code, to measure 0-150Hz with 1Hz steps.

i'am using and pic18f452 10Mhz

i think that the program should use interupt, because the mcu has other jobs to do.

if anyone have an example or good idea. please let me now.

best regards
From Denmark

Darrel Taylor
- 15th November 2007, 21:38
Not sure if you want to measure Pulse Width or Frquency, but here's a start.

If you need acurracy, you should use the Capture Mode of a CCP module.
First one has an Instant Interrupt example too. ;)
http://www.picbasic.co.uk/forum/showthread.php?p=23401 (Bruce)
http://www.picbasic.co.uk/forum/showthread.php?p=41621 (Bruce)

Or, you can get pretty good results with a Timer and interrupts ...
http://www.picbasic.co.uk/forum/showthread.php?t=1044 (mister_e)
http://www.picbasic.co.uk/forum/showthread.php?p=16636 (mister_e)
<br>