Prasad Noolu
Newbie level 3
hi,every one
i was trying the project which sends the sms alert when ever an intruder enters into a room
i am using atmega16 and gsm sim 300 modem and pir sensor
some how i managed to get the code but the problem occurs at compiling i am using WINAVR-2010 version
Even though i have added the header file the compiler gives the error
> "make.exe" all
-------- begin --------
avr-gcc (WinAVR 20100110) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Compiling C: main.c
avr-gcc -c -mmcu=atmega16 -I. -gdwarf-2 -DF_CPU=8000000UL -O2 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./main.lst -std=gnu99 -MMD -MP -MF .dep/main.o.d main.c -o main.o
main.c: In function 'main':
main.c:63: warning: passing argument 1 of 'Avr_Usart_Write_String' makes pointer from integer without a cast
main.c:101: warning: implicit declaration of function 'sprintf'
main.c:101: warning: incompatible implicit declaration of built-in function 'sprintf'
Linking: main.elf
avr-gcc -mmcu=atmega16 -I. -gdwarf-2 -DF_CPU=8000000UL -O2 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=main.o -std=gnu99 -MMD -MP -MF .dep/main.elf.d main.o --output main.elf -Wl,-Map=main.map,--cref -lm
main.o: In function `main':
C:\Users\suryanareshprasad\Desktop\home/main.c:37: undefined reference to `LCDInit'
C:\Users\suryanareshprasad\Desktop\home/main.c:38: undefined reference to `Avr_Usart_Init'
C:\Users\suryanareshprasad\Desktop\home/main.c:39: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:40: undefined reference to `Avr_Usart_Write_Char'
C:\Users\suryanareshprasad\Desktop\home/main.c:41: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:42: undefined reference to `Avr_Usart_Write_Char'
C:\Users\suryanareshprasad\Desktop\home/main.c:43: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:44: undefined reference to `Avr_Usart_Write_Char'
C:\Users\suryanareshprasad\Desktop\home/main.c:103: undefined reference to `LCDWriteString'
C:\Users\suryanareshprasad\Desktop\home/main.c:98: undefined reference to `LCDGotoXY'
C:\Users\suryanareshprasad\Desktop\home/main.c:98: undefined reference to `LCDWriteString'
C:\Users\suryanareshprasad\Desktop\home/main.c:58: undefined reference to `LCDGotoXY'
C:\Users\suryanareshprasad\Desktop\home/main.c:58: undefined reference to `LCDWriteString'
C:\Users\suryanareshprasad\Desktop\home/main.c:59: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:60: undefined reference to `Avr_Usart_Write_Char'
C:\Users\suryanareshprasad\Desktop\home/main.c:62: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:63: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:65: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:67: undefined reference to `Avr_Usart_Write_Char'
C:\Users\suryanareshprasad\Desktop\home/main.c:69: undefined reference to `Avr_Usart_Write_Char'
C:\Users\suryanareshprasad\Desktop\home/main.c:71: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:72: undefined reference to `Avr_Usart_Write_Char'
C:\Users\suryanareshprasad\Desktop\home/main.c:77: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:79: undefined reference to `Avr_Usart_Write_Char'
C:\Users\suryanareshprasad\Desktop\home/main.c:80: undefined reference to `LCDGotoXY'
C:\Users\suryanareshprasad\Desktop\home/main.c:80: undefined reference to `LCDWriteString'
make.exe: *** [main.elf] Error 1
> Process Exit Code: 2
> Time Taken: 00:01
my code:
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <string.h>
#include "lcd.h"
#include "avr_usart.h"
#define ADC_VREF_TYPE 0b00000000
// Read the AD conversion result
unsigned int read_adc(unsigned char adc_input){
ADMUX=adc_input|ADC_VREF_TYPE;
ADCSRA|=0x40; // Start the AD conversion
while ((ADCSRA & 0x10)==0); // Wait for the AD conversion to complete
ADCSRA|=0x10;
return ADCW;
}
//end
int ADCinit(void)
{
ADMUX=0;
ADCSRA=0b10000101;
return 0;
}
char buff[200]="";
char C[18]=" ";
int i,jp;
int main(void)
{
int val,po=0;
ADCinit();
LCDInit(LS_NONE);
Avr_Usart_Init(25);
Avr_Usart_Write_String("AT");
Avr_Usart_Write_Char(0X0D);
Avr_Usart_Write_String("ATE0");
Avr_Usart_Write_Char(0X0D);
Avr_Usart_Write_String("AT+CMGF=1");
Avr_Usart_Write_Char(0X0D);
while(1) //loop demos
{
val=read_adc(0);
if(val>=890)
{
DDRD|=1<<5;
{
if(po==4)
{
LCDWriteStringXY(0,1,"theft detected");
Avr_Usart_Write_String("AT+CMGF=1\n\r");
Avr_Usart_Write_Char(0X0D);
_delay_ms(10);
Avr_Usart_Write_String("AT+CMGS=");
Avr_Usart_Write_String(0X22);
_delay_ms(10);
Avr_Usart_Write_String("08712411484");
_delay_ms(10);
Avr_Usart_Write_Char(0X22);
_delay_ms(10);
Avr_Usart_Write_Char(0X0D);
_delay_ms(90);
Avr_Usart_Write_String("Theft Detected at your house");_delay_ms(10);
Avr_Usart_Write_Char(0X1A);
}
else if(po==60)
{
Avr_Usart_Write_String("ATD08712411484;");
_delay_ms(10);
Avr_Usart_Write_Char(0X0D);
LCDWriteStringXY(0,1,"----calling----");
}
else
{
OCR1A=255;
_delay_ms(60);
OCR1A=230;
_delay_ms(60);
}
}
po++;_delay_ms(400);}
else
{
po=0;
DDRD&=(~(1<<5));
LCDWriteStringXY(0,1,"----waiting----");
}
sprintf(C,"Value=%d",val);
LCDWriteString(C);
}
return 0;
}
i was trying the project which sends the sms alert when ever an intruder enters into a room
i am using atmega16 and gsm sim 300 modem and pir sensor
some how i managed to get the code but the problem occurs at compiling i am using WINAVR-2010 version
Even though i have added the header file the compiler gives the error
> "make.exe" all
-------- begin --------
avr-gcc (WinAVR 20100110) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Compiling C: main.c
avr-gcc -c -mmcu=atmega16 -I. -gdwarf-2 -DF_CPU=8000000UL -O2 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./main.lst -std=gnu99 -MMD -MP -MF .dep/main.o.d main.c -o main.o
main.c: In function 'main':
main.c:63: warning: passing argument 1 of 'Avr_Usart_Write_String' makes pointer from integer without a cast
main.c:101: warning: implicit declaration of function 'sprintf'
main.c:101: warning: incompatible implicit declaration of built-in function 'sprintf'
Linking: main.elf
avr-gcc -mmcu=atmega16 -I. -gdwarf-2 -DF_CPU=8000000UL -O2 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=main.o -std=gnu99 -MMD -MP -MF .dep/main.elf.d main.o --output main.elf -Wl,-Map=main.map,--cref -lm
main.o: In function `main':
C:\Users\suryanareshprasad\Desktop\home/main.c:37: undefined reference to `LCDInit'
C:\Users\suryanareshprasad\Desktop\home/main.c:38: undefined reference to `Avr_Usart_Init'
C:\Users\suryanareshprasad\Desktop\home/main.c:39: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:40: undefined reference to `Avr_Usart_Write_Char'
C:\Users\suryanareshprasad\Desktop\home/main.c:41: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:42: undefined reference to `Avr_Usart_Write_Char'
C:\Users\suryanareshprasad\Desktop\home/main.c:43: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:44: undefined reference to `Avr_Usart_Write_Char'
C:\Users\suryanareshprasad\Desktop\home/main.c:103: undefined reference to `LCDWriteString'
C:\Users\suryanareshprasad\Desktop\home/main.c:98: undefined reference to `LCDGotoXY'
C:\Users\suryanareshprasad\Desktop\home/main.c:98: undefined reference to `LCDWriteString'
C:\Users\suryanareshprasad\Desktop\home/main.c:58: undefined reference to `LCDGotoXY'
C:\Users\suryanareshprasad\Desktop\home/main.c:58: undefined reference to `LCDWriteString'
C:\Users\suryanareshprasad\Desktop\home/main.c:59: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:60: undefined reference to `Avr_Usart_Write_Char'
C:\Users\suryanareshprasad\Desktop\home/main.c:62: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:63: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:65: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:67: undefined reference to `Avr_Usart_Write_Char'
C:\Users\suryanareshprasad\Desktop\home/main.c:69: undefined reference to `Avr_Usart_Write_Char'
C:\Users\suryanareshprasad\Desktop\home/main.c:71: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:72: undefined reference to `Avr_Usart_Write_Char'
C:\Users\suryanareshprasad\Desktop\home/main.c:77: undefined reference to `Avr_Usart_Write_String'
C:\Users\suryanareshprasad\Desktop\home/main.c:79: undefined reference to `Avr_Usart_Write_Char'
C:\Users\suryanareshprasad\Desktop\home/main.c:80: undefined reference to `LCDGotoXY'
C:\Users\suryanareshprasad\Desktop\home/main.c:80: undefined reference to `LCDWriteString'
make.exe: *** [main.elf] Error 1
> Process Exit Code: 2
> Time Taken: 00:01
my code:
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <string.h>
#include "lcd.h"
#include "avr_usart.h"
#define ADC_VREF_TYPE 0b00000000
// Read the AD conversion result
unsigned int read_adc(unsigned char adc_input){
ADMUX=adc_input|ADC_VREF_TYPE;
ADCSRA|=0x40; // Start the AD conversion
while ((ADCSRA & 0x10)==0); // Wait for the AD conversion to complete
ADCSRA|=0x10;
return ADCW;
}
//end
int ADCinit(void)
{
ADMUX=0;
ADCSRA=0b10000101;
return 0;
}
char buff[200]="";
char C[18]=" ";
int i,jp;
int main(void)
{
int val,po=0;
ADCinit();
LCDInit(LS_NONE);
Avr_Usart_Init(25);
Avr_Usart_Write_String("AT");
Avr_Usart_Write_Char(0X0D);
Avr_Usart_Write_String("ATE0");
Avr_Usart_Write_Char(0X0D);
Avr_Usart_Write_String("AT+CMGF=1");
Avr_Usart_Write_Char(0X0D);
while(1) //loop demos
{
val=read_adc(0);
if(val>=890)
{
DDRD|=1<<5;
{
if(po==4)
{
LCDWriteStringXY(0,1,"theft detected");
Avr_Usart_Write_String("AT+CMGF=1\n\r");
Avr_Usart_Write_Char(0X0D);
_delay_ms(10);
Avr_Usart_Write_String("AT+CMGS=");
Avr_Usart_Write_String(0X22);
_delay_ms(10);
Avr_Usart_Write_String("08712411484");
_delay_ms(10);
Avr_Usart_Write_Char(0X22);
_delay_ms(10);
Avr_Usart_Write_Char(0X0D);
_delay_ms(90);
Avr_Usart_Write_String("Theft Detected at your house");_delay_ms(10);
Avr_Usart_Write_Char(0X1A);
}
else if(po==60)
{
Avr_Usart_Write_String("ATD08712411484;");
_delay_ms(10);
Avr_Usart_Write_Char(0X0D);
LCDWriteStringXY(0,1,"----calling----");
}
else
{
OCR1A=255;
_delay_ms(60);
OCR1A=230;
_delay_ms(60);
}
}
po++;_delay_ms(400);}
else
{
po=0;
DDRD&=(~(1<<5));
LCDWriteStringXY(0,1,"----waiting----");
}
sprintf(C,"Value=%d",val);
LCDWriteString(C);
}
return 0;
}