I've been working on measuring wind speed. I'm using PIC16F72 (easily available) . My circuit uses a encoder wheel and photo diode to sendout pulses. program uses ccp and timer module to measure the period of the pulses.
I actually need to convert the timer count to rpm. For this I need to do math ( division ) . Can someone let me know if this is possible ?
If you are doing Assembly language, check out PicList for math routines (http://www.piclist.com/techref/piclist/index.htm). I have found most of the material there to be quite reliable. You will presumably need to send the results to a display. Chose a simple serial LCD display. The serial routines on PIcList work well.
A compiler will understand that notation for constants, but I don't think you can handle variables in the assembler like that.
In MPASM code, your statement could be translated into a simple rotate right, i.e., rrf, w or f ,depending where you want it to end up. I think with that chip, you will have to be sure carry doesn't rotate a bit back in at the msb.
no its not a requirement. I have the rpm "x" and i need to convert it into wind speed. For which i need to do some math. And i thought this is the only way out.
How people working on PIC micros generally do such arithmetic ? is there something i'm not aware ?
Thank you, I get it now. we need to do some binary arithmetic in order to get the desired result !
no its not a requirement. I have the rpm "x" and i need to convert it into wind speed. For which i need to do some math. And i thought this is the only way out.
How people working on PIC micros generally do such arithmetic ? is there something i'm not aware ?
Probably the simplest way to convert your encoder reading is via a 'lookup table' though it depends on how many entries you need.
See example 1.9 here for an simple examplehttp://www.winpicprog.co.uk/pic_tutorial1.htm
As mentioned earlier the Piclist site is a good place for maths routine.
Perhaps if you show us your input value range and what formula you intend to convert it to wind speed, and what it is to be displayed on 7SEG/LCD/PC we can help more
Some time to avoid use of float aritmetics wich use a lot of ram and time calculation
we can use long int and astuces to multiply by a known number..
example to mutiply an integer value by 6.5
multyply it by 260 and divide by 40