rajtech
Member level 2
Hi,
I am using pic17f877 to measure motor speed in RPM.
I connect sensor output(pulse) to RB0 interrupt.
Turn ON Timer0 and check the RB0 pin for every 1 sec to count the pulse and then multiply the data with 60 to get RPM -- per 1 min.
Here is my code, Pls help me to check and advice me , is this is the correct way of calculate the RPM. tHANKS.
CRYSTAL FREQ: 4 MHZ
if (TMR0 ==250 ){
TMR0 = 0;
SEC ++;
if(SEC == 1000 ){ //
RPM = (count/8)*60;
SEC = 0;
}
}
/////////////////////////////////////
static void interrupt
isr()
{
if(INTF==1)
{
INTF=0;
count++;
}
}
I am using pic17f877 to measure motor speed in RPM.
I connect sensor output(pulse) to RB0 interrupt.
Turn ON Timer0 and check the RB0 pin for every 1 sec to count the pulse and then multiply the data with 60 to get RPM -- per 1 min.
Here is my code, Pls help me to check and advice me , is this is the correct way of calculate the RPM. tHANKS.
CRYSTAL FREQ: 4 MHZ
if (TMR0 ==250 ){
TMR0 = 0;
SEC ++;
if(SEC == 1000 ){ //
RPM = (count/8)*60;
SEC = 0;
}
}
/////////////////////////////////////
static void interrupt
isr()
{
if(INTF==1)
{
INTF=0;
count++;
}
}