Do you need to employ TMR0? This can be easily done by incrementing registers
eg,
Code:
Repeat
Until PORT.Pin = 0
Repeat
Until PORT.Pin = 1
Repeat
Inc(Result)
Until PORT.Pin = 0
and of course from there you can add a timeout with something like
Code:
Result = 0
Repeat
Inc(Result)
Until PORT.Pin = 0 or Result = 0
Result = 0
Repeat
Inc(Result)
Until PORT.Pin = 0 or Result = 1
Result = 0
Repeat
Inc(Result)
Until PORT.Pin = 0 or Result = 0
From there you can figure out what the modifier required would be from the code overhead by simulating and scale the Result up to uS or mS as required to find the frequency of the signal
Ya 100 to 250 of course ok & when the pulse increase you need to do some multiplication routine (8bit mul) will be fine.Aaaah you are displaying it on 8 LEDs.
I use TMR0 as counter & feeding pulse to RA4 something like that & reads the TMR0 value on certain period of time & do all other calculations.
But for example if the frequency is 300Hz how do you show them from 8 LED's?
Thanks for your reply. I would appreciate if you could give-me the source code (in MikroC or CCS C) for a pulse counter with the TIMER0, counting frequencies from, say, 10Hz up to 200Hz, with ranges of 10Hz (10,20,30,.....200) with bynary outputs in 8 leds.
Best regards and thanks for cortesy.
EDSON
Thanks for your reply. I would appreciate if you could give-me the source code (in MikroC or CCS C) for a pulse counter with the TIMER0, counting frequencies from, say, 10Hz up to 200Hz, with ranges of 10Hz (10,20,30,.....200) with bynary outputs in 8 leds.
Best regards and thanks for cortesy.
EDSON
Thanks for your reply. I would appreciate if you could give-me the source code (in MikroC or CCS C) for a pulse counter with the TIMER0, counting frequencies from, say, 10Hz up to 200Hz, with ranges of 10Hz (10,20,30,.....200) with bynary outputs in 8 leds.
Best regards and thanks for cortesy.
EDSON