View previous topic :: View next topic |
Author |
Message |
karthickiw
Joined: 09 Aug 2007 Posts: 82 Location: TN, India
|
how to measure the RPM |
Posted: Wed Apr 21, 2010 9:26 am |
|
|
Hai CCS friends,
i want to measure accurate RMP value using PIC microcontroller. Now i am use timer1 to capture and count the signal from NPN type proximity sensor and Timer0 is calibrate the 1 seconds timer. every 1 second is finished, i multiple 60 into the count to get RPM. i have problem with reference time. In this method every one seconds only get RMP. There is any alternative method to measure the RMP. |
|
|
01011
Joined: 21 Apr 2010 Posts: 6 Location: earth, solar system
|
|
Posted: Wed Apr 21, 2010 10:41 am |
|
|
hi
i'm also reading a motor speed with a pic, but by using this method:
i calculate the period between to revolution of my motor;
Code: |
#INT_TIMER0
void tmr0_isr()
{
// motor period is bigger than max limit
// Fm = period * X * Tc * RTCC_Div
// RPM = F * 60
// -> X is encoder pulse per revolution (48)
// -> Tc is instruction time (0.25µs)
period = 0xFFFF;
tmr0_oveflow = 1;
}
/*#INT_EXT
void ext_isr()
{
int16 t;
t=get_timer0();
if( tmr0_oveflow == 0)
period = t;
tmr0_oveflow = 0;
set_timer0( 0 );
}
|
with this code, period is used to store information about the motor period, and can be translated in the real period
if tmr0_oveflow == 1, motor is too slow (rpm is too small)
is it ok? |
|
|
karthickiw
Joined: 09 Aug 2007 Posts: 82 Location: TN, India
|
thank you |
Posted: Wed Apr 21, 2010 10:03 pm |
|
|
hai,
Thank you for your reply. I already done likewise, in this method every one second we get the RMP value. I need live RPM value without 1 second delay. |
|
|
palomino
Joined: 30 Jul 2008 Posts: 4
|
|
Posted: Wed Apr 21, 2010 10:38 pm |
|
|
Can you see on the example folder, (EX_FREQC.C). I think is a similar application, but just before print the "freq" variable multiply it by 60.
Regards.
Rafael
Mexico |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
Re: thank you |
Posted: Thu Apr 22, 2010 6:24 am |
|
|
karthickiw wrote: | I need live RPM value without 1 second delay. |
If you get 1 countable edge per revolution and you measure once per second your RPM value will have a resolution of 60. If you measure 10 times per second your RPM will have a resolution of 600. Frequent results will cost you resolution. Getting multiple counting events per revolution , either with multiple sensor targets or by measuring period with a fast clock, will help. _________________ The search for better is endless. Instead simply find very good and get the job done.
Last edited by SherpaDoug on Thu Apr 22, 2010 9:22 am; edited 1 time in total |
|
|
01011
Joined: 21 Apr 2010 Posts: 6 Location: earth, solar system
|
Re: thank you |
Posted: Thu Apr 22, 2010 7:09 am |
|
|
karthickiw wrote: | hai,
Thank you for your reply. I already done likewise, in this method every one second we get the RMP value. I need live RPM value without 1 second delay. |
in my code, you can calculate speed after every revolution (because you calculate the time between 2 revolutions)
by using an encoder of X pulse per revolution, you can even calculate speed X times/rev. |
|
|
|