SidJhamb
Newbie level 2
Sir my objective is to build an rpm meter using ATmega8L.I have written the following code using timers and interrupts.
But it's showing the following errors.
Please guide me regarding this..it's urgent !!!
Looking forward to your response.
Thank you.
Code:
#define F_CPU 1000000UL
#include<avr/io.h>
#include<avr/interrupt.h>
#include"lcd.h"
#include"lcd.c"
volatile uint16_t count=0;
volatile uint16_t rps=0;
volatile uint16_t rpm=0;
char buffer[20];
void main()
{
DDRD=0b11110111;
lcd_init(LCD_DISP_ON);
TCCR1A|=(1<<COM1A1);
TCCR1B|=(1<<CS10)|(1<<WGM12);
TIMSK|=(1<<OCIE1A)
TCNT1H=0x00;
TCNT1L=0x00;
OCR1AH=Ox03;
OCR1AL=0xE8;
MCUCR |= (1<<ISC11)|(1<<ISC10);
GICR |= (1 << INT1);
sei();
lcd_gotoxy(0,0);
while(1)
(
sprintf(buffer,"RPM=%2d",rpm);
lcd_puts(buffer);
}
ISR(TIMER1_COMPA_vect)
{
rps=count;
rpm=rps*60;
count=0;
}
ISR(INT1_vect)
{
count++;
}
}
../iitkproject.c:22: error: called object '16' is not a function
../iitkproject.c:24: error: 'Ox03' undeclared (first use in this function)
../iitkproject.c:24: error: (Each undeclared identifier is reported only once
../iitkproject.c:24: error: for each function it appears in.)
../iitkproject.c:35: error: expected ')' before ';' token
../iitkproject.c:37: error: expected ';' before '}' token
../iitkproject.c:51: error: expected identifier or '(' before '}' token
Build failed with 7 errors and 3 warnings...
Please guide me regarding this..it's urgent !!!
Looking forward to your response.
Thank you.
Last edited by a moderator: