Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ANOTHER Tachometer Project!!!

Status
Not open for further replies.

Tom81

Member
Yep, another tacho project... Just in the process of building a digital tacho - 4 x 7 segment LED display, 16F88 PIC @4MHz.

Hardware is all fine. I can get it to display numbers etc.

Input pulse period is monitored via Timer1 INT on RB0.

BUT, I'm programming in Assembly. So, I need to capture the timer1 value at interrupt, which will give me the period, in µs, in a binary format (Timer1 is a 16-Bit Timer).

My question is: How do I actually convert this into a usable REVS per Minute value?

These are the steps involved, as far as I can work out:

1. determine cycle period (time between each falling edge). This will be a 16-Bit Binary number on Timer1 interrupt.

2. determine Frequency (in revs per minute). This is tricky.

3. convert binary to decimal - can be done, although complicated.

The main problem is dealing with 16-bit numbers with an 8-bit micro.

Anyone know of a SIMPLE way of doing this? any help or ideas would be mcuh appreciated!

Thanks
-Tom
 
Ok, found a straight-forward method on converting binary to decimal - see Nigel Goodwin's Tutorial website (WinPicProg Page) under tutorial 3 - thanks Nigel!

Still baffled as to how to Convert Period to Frequency (essentially just division)...
 
Didn't I send you a Shift-1 Tacho? ;)

That has open source code on the Shift1-LCD page. It's in C but the basic measurement and conversion techniques should be easy to see. I try to use the simplest C coding possible so it can easily be converted to other languages or to assembler etc.
 
i know little nothing abou programing, but you've simplified it for me. Thank you :) So needless to say, but i can't help with your delema too much, but i'll try as best i can. (this is all i can do); if i remember correctly, the frequency is the inverse of the time constant right? if the period and the time constant are the same in this case, just invert your result.
 
Didn't I send you a Shift-1 Tacho? ;)

That has open source code on the Shift1-LCD page. It's in C but the basic measurement and conversion techniques should be easy to see. I try to use the simplest C coding possible so it can easily be converted to other languages or to assembler etc.

Yeah I saw that. It's easy doing division in C. Not as easy in assembler though! Unless someone has a fast technique?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top