![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | Thread Tools | Display Modes |
| | (permalink) |
| Experienced Member | sooryyyyy rubbbish code ...was stupid mistake.please dont follow the code below..its wrongsooory again to bother Last edited by neelam29; 19th April 2008 at 11:15 AM. |
| | |
| | (permalink) |
| Experienced Member | 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;
__________________ ========================= Futz's Microcontrollers & Robotics ========================= |
| | |
| | (permalink) |
| Experienced Member | sorry the code is wrong...got the stupid mistake |
| | |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Hall-Effect -> PIC | rackley | General Electronics Chat | 9 | 2nd March 2008 10:21 AM |
| Quik PIC Programming kit | Krumlink | General Electronics Chat | 5 | 27th January 2008 11:27 PM |
| Capturing and reproducing audio with a PIC | Fred.Amoson | Micro Controllers | 14 | 14th December 2007 08:21 PM |
| Problems switchin relay with PIC | Andy1845c | General Electronics Chat | 5 | 17th November 2007 06:13 PM |
| High ADC sampling rate PIC, 18F needed? | bananasiong | Micro Controllers | 24 | 28th October 2007 12:13 PM |