How to calculate the frequency of a pulse

chizom3

New Member
Hi guys, i have a circuit which generates pulses and i need to calculate the frequency of the pulse. So far i have been able to count the number of pulses but i dont know how to convert it to frequency PLEASE HELP.
Below is the code to count the pulses

init: pause 500 ; wait for display to initialise
main:
count C.1, 1000, w1 ; count pulses in 1secs (at 4MHz)
serout B.6,N2400,(254,128) ; move to start of first line
serout B.6,N2400,(#w1,13,10, "rpm")

goto main ; loop back to start
 

srnet

Senior Member
The frequency is the number of pulses counted in one second.

Although how you get from the number of pulses counted in one second (in w1) to assuming that number is the "rpm", I dont know.
 

premelec

Senior Member
RPM = RPS * 60 :) if one pulse per revolution [or minor insurrection...] . If you have more than one count per rev then divide by that #
 

chizom3

New Member
please i tried using RPM = RPS * 60
however the picaxe 18m2 only outputs numbers between 0 to 255. How do i make it display decimal numbers like 60*60 = 3600
below is my code

count C.1, 5000, w1 ; count pulses in 5secs (at 4MHz)
serout B.6,N2400,(254,1)
serout B.6,N2400,(254,128) ; move to start of first line
let B1 =w1*60
serout B.6,N2400,(#B1, " RPM")
goto main ; loop back to start

Please help
 

hippy

Ex-Staff (retired)
let B1 =w1*60
serout B.6,N2400,(#B1, " RPM")

Change the B1 to W2 which can hold numbers greater than 255.
 
Top