I am building a optical tachometer for a gas turbine. I would like to try my hand at PIC programing. I have programed AVRs in the past and feel its time to try microchip's line (mainly because I got some samples from them ;-) I already designed my board layout and intend to use a back lit LCD display. My RPM limit will be about 150,000RPM with 1 pulse input per rotation of the turbine shaft. Any pointers on the what my code should look like? The accuracy of this device does not have to be that good, really. + or - 100 rpm is quite fine. Look forward to hearing some suggestions. William |
|
PIC16F628 Tachometer
Started by ●August 20, 2004
Reply by ●August 30, 20042004-08-30
Generically it'll look like this: 1) Wait for pulse. 2) Start timer. 3) Use next pulse to stop timer. Elapsed time is the period. Invert to get frequency, then multiply by 60 to get RPMs. Or, you could have a sample window and count the pulses: 1) Start timer. 2) Count pulses until timer stops. Frequency is pulses divided by timer interval. Lots of code out there for frequency counters. This one is even for the 16F628: <http://www.qsl.net/dl4yhf/freq_counter/freq_counter.html> Then all you have to do is multiply by 60 for RPM. Mike --- In , "William Nachefski" <slaphappysamy@y...> wrote: > I am building a optical tachometer for a gas turbine. I would like > to try my hand at PIC programing. I have programed AVRs in the past > and feel its time to try microchip's line (mainly because I got some > samples from them ;-) I already designed my board layout and intend > to use a back lit LCD display. My RPM limit will be about 150,000RPM > with 1 pulse input per rotation of the turbine shaft. Any pointers > on the what my code should look like? The accuracy of this device > does not have to be that good, really. + or - 100 rpm is quite fine. > Look forward to hearing some suggestions. > William |