CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

how to measure the RPM

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
karthickiw



Joined: 09 Aug 2007
Posts: 82
Location: TN, India

View user's profile Send private message Send e-mail

how to measure the RPM
PostPosted: Wed Apr 21, 2010 9:26 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Apr 21, 2010 10:41 am     Reply with quote

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

View user's profile Send private message Send e-mail

thank you
PostPosted: Wed Apr 21, 2010 10:03 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Apr 21, 2010 10:38 pm     Reply with quote

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 Wink
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

Re: thank you
PostPosted: Thu Apr 22, 2010 6:24 am     Reply with quote

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

View user's profile Send private message

Re: thank you
PostPosted: Thu Apr 22, 2010 7:09 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group