rpm with pic 877

Status
Not open for further replies.

neelam29

New Member
sooryyyyy rubbbish code ...was stupid mistake.please dont follow the code below..its wrongsooory again to bother
 
Last edited:
Is this what you meant to ask?
Code:
unsigned int TimerOverFlow;
float countLeft,TimerTimeLeft,TotalTimeTaken,RPM,x;

static void interrupt isr()
{
	if(INTF)
	{
		if(TMR1ON==0)
		{
			TimerOverFlow=0;
			TMR1H=0xFB;
			TMR1L=0x1D;
			TMR1ON=1;
		}
		else
		{
			TMR1ON=0;
			INTE=0;
			countLeft=(TMR1H*256+TMR1L)-0xFB1D;
			TimerTimeLeft=countLeft/125000;
			TotalTimeTaken=TimerOverFlow*0.01+TimerTimeLeft;
			x=countLeft;
			RPM=60/TotalTimeTaken;
			TimerOverFlow=0;
			TMR1H=TMR1L=0;
			INTE=1;
			TMR1ON=1;
		}
		INTF=0;
	}
	if(TMR1IF)
	{
		TMR1H=0xFB;
		TMR1L=0x1D;
		TimerOverFlow++;
		TMR1IF=0;
	}
}

//////////////////////////////////

void main(void){
	unsigned RPMReadingHold;
	TRISA = TRISC = 0x00;
	PORTA = PORTC = 0x00;

	INTCON=0xC0;
	INTE=1;
	T1CON=0X30;
	TMR1H=0xFB;
	TMR1L=0x1E;
	INTEDG=1;
Please use code tags when posting code, or it turns into the mess in your post. Just click on the # in the menu just before pasting your code. With proper code tags the code will hold its formatting (mostly) and be readable.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…