diegotheslinger
Newbie level 3
Hello! Was wondering if anyone could help give an overall idea of how to implement a tach with a 16F628 in asm.
As of now, I have four 7-segments hooked up and multiplexed with a TMR2 interupt to update each digit at about 6ms. (just reduced it down till it didn't flicker) I have a halleffect sensor i would like to hook up to RA4 to count with TMR0. (right?) This is my first time using this chip and trying to do counting so I don't know exactly how to start.
I cleared T0CS in option_reg to set it to counter mode and selected count on low-to-high edge. I also assigned the prescaler to TMR0. (looks like the lowest setting halves the count 1:2) Also RA4 is set as an input with trisa.
So my question is how do I want to go about counting pulses? Should I let TMR0 count up, have an interupt (say every 100ms), pull out the value, multiply by 10 (to get rotations per second), then multiply by 60 (rotations per minute). Then with this number break it down to 1000's, 100's, 10's, and 1's and display it on the four 7-segments?
Am I kinda on the right track?
-thanks
*edit* Oh yeah there is a bit more info on what I am doing at <... Vicetronics ....>.
As of now, I have four 7-segments hooked up and multiplexed with a TMR2 interupt to update each digit at about 6ms. (just reduced it down till it didn't flicker) I have a halleffect sensor i would like to hook up to RA4 to count with TMR0. (right?) This is my first time using this chip and trying to do counting so I don't know exactly how to start.
I cleared T0CS in option_reg to set it to counter mode and selected count on low-to-high edge. I also assigned the prescaler to TMR0. (looks like the lowest setting halves the count 1:2) Also RA4 is set as an input with trisa.
So my question is how do I want to go about counting pulses? Should I let TMR0 count up, have an interupt (say every 100ms), pull out the value, multiply by 10 (to get rotations per second), then multiply by 60 (rotations per minute). Then with this number break it down to 1000's, 100's, 10's, and 1's and display it on the four 7-segments?
Am I kinda on the right track?
-thanks
*edit* Oh yeah there is a bit more info on what I am doing at <... Vicetronics ....>.
Last edited: