Error in AVR-GCC code...please help !

Status
Not open for further replies.

SidJhamb

Newbie level 2
Joined
Jan 22, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,298
Sir my objective is to build an rpm meter using ATmega8L.I have written the following code using timers and interrupts.


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++;
}

}
But it's showing the following errors.



Please guide me regarding this..it's urgent !!!

Looking forward to your response.

Thank you.
 
Last edited by a moderator:

I am using this code now..it is not showing any error but is not giving the required output..Can you please spot the mistake ??

#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 millisecond=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=0x03;
OCR1AL=0xE8;

MCUCR |= (1<<ISC11)|(1<<ISC10);
GICR |= (1 << INT1);

sei();



while(1)
{
sprintf(buffer,"RPM=%2d",rpm);
lcd_puts(buffer);
}
}
ISR(TIMER1_COMPA_vect)
{
millisecond++;
if(millisecond==1000)
{
lcd_gotoxy(0,0);
rps=count;
rpm=rps*60;
millisecond=0;
count=0;
}}

ISR(INT1_vect)
{
count++;
}
 

What output do you require?

Read tutorials about avr studio
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…