아크마님께서 전에 올려주신 ds1620을 이용한 온도측정기 글에 따라 제작하고
첨부한 소스를 빌드시 아래와 같은 오류가 발생하였습니다.
혹시 제가 뭐 잘못한게 있는지? AVR Studio 와 |WinAVR 을 사용했습니다.
rm -rf ds1620.o ds16202.o ds1620.elf dep/* ds1620.hex ds1620.eep
Build succeeded with 0 Warnings...
avr-gcc.exe -mmcu=atmega16 -Wall -gdwarf-2 -O0 -MD -MP -MT ds1620.o -MF dep/ds1620.o.d -c ../ds1620.c
avr-gcc.exe -mmcu=atmega16 -Wall -gdwarf-2 -O0 -MD -MP -MT ds16202.o -MF dep/ds16202.o.d -c ../ds16202.c
../ds16202.c:19: error: parse error before "value"
../ds16202.c: In function `ds1620_set_CLOCK':
../ds16202.c:21: error: `value' undeclared (first use in this function)
../ds16202.c:21: error: (Each undeclared identifier is reported only once
../ds16202.c:21: error: for each function it appears in.)
../ds16202.c:22: warning: implicit declaration of function `SETBIT'
../ds16202.c:22: error: `PORTA' undeclared (first use in this function)
../ds16202.c:22: error: `PORTA1' undeclared (first use in this function)
../ds16202.c:24: warning: implicit declaration of function `CLRBIT'
../ds16202.c: At top level:
../ds16202.c:28: error: parse error before "value"
../ds16202.c: In function `ds1620_set_RST':
../ds16202.c:30: error: `value' undeclared (first use in this function)
../ds16202.c:31: error: `PORTA' undeclared (first use in this function)
../ds16202.c:31: error: `PORTA2' undeclared (first use in this function)
../ds16202.c: At top level:
../ds16202.c:36: error: parse error before "value"
../ds16202.c: In function `ds1620_set_IO':
../ds16202.c:38: error: `DDRA' undeclared (first use in this function)
../ds16202.c:38: error: `PORTA0' undeclared (first use in this function)
../ds16202.c:39: error: `value' undeclared (first use in this function)
../ds16202.c:40: error: `PORTA' undeclared (first use in this function)
../ds16202.c: At top level:
../ds16202.c:46: error: parse error before "ds1620_get_IO"
../ds16202.c:47: warning: return type defaults to `int'
../ds16202.c: In function `ds1620_get_IO':
../ds16202.c:48: error: `PORTA' undeclared (first use in this function)
../ds16202.c:48: error: `PORTA0' undeclared (first use in this function)
../ds16202.c:49: warning: implicit declaration of function `CHKBIT'
../ds16202.c:49: error: `PINA' undeclared (first use in this function)
../ds16202.c:49: error: `PINA0' undeclared (first use in this function)
../ds16202.c: At top level:
../ds16202.c:52: error: parse error before "BYTE"
../ds16202.c:52: warning: type defaults to `int' in declaration of `degree'
../ds16202.c:52: warning: data definition has no type or storage class
../ds16202.c:54: error: parse error before "data"
../ds16202.c: In function `Put1620byte':
../ds16202.c:56: error: `BYTE' undeclared (first use in this function)
../ds16202.c:56: error: parse error before "i"
../ds16202.c:59: error: `i' undeclared (first use in this function)
../ds16202.c:65: error: `data' undeclared (first use in this function)
../ds16202.c: At top level:
../ds16202.c:79: error: parse error before "Get1620byte"
../ds16202.c:80: warning: return type defaults to `int'
../ds16202.c: In function `Get1620byte':
../ds16202.c:82: error: `BYTE' undeclared (first use in this function)
../ds16202.c:82: error: parse error before "i"
../ds16202.c:84: error: `DDRA' undeclared (first use in this function)
../ds16202.c:84: error: `DDA0' undeclared (first use in this function)
../ds16202.c:86: error: `data' undeclared (first use in this function)
../ds16202.c:87: error: `data1' undeclared (first use in this function)
../ds16202.c:95: error: `i' undeclared (first use in this function)
../ds16202.c: In function `ds1620_Init':
../ds16202.c:126: error: `DDRA' undeclared (first use in this function)
../ds16202.c:126: error: `DDA1' undeclared (first use in this function)
../ds16202.c:127: error: `DDA0' undeclared (first use in this function)
../ds16202.c:128: error: `DDA2' undeclared (first use in this function)
../ds16202.c: At top level:
../ds16202.c:139: error: parse error before '*' token
../ds16202.c: In function `GetTemperature':
../ds16202.c:141: error: `BYTE' undeclared (first use in this function)
../ds16202.c:141: error: parse error before "data"
../ds16202.c:148: error: `WORD' undeclared (first use in this function)
../ds16202.c:148: error: parse error before "count_remain"
../ds16202.c:161: error: `data' undeclared (first use in this function)
../ds16202.c:225: error: `temp_and_half_bit' undeclared (first use in this function)
../ds16202.c:226: error: `sign_bit' undeclared (first use in this function)
../ds16202.c:233: error: `count_remain' undeclared (first use in this function)
../ds16202.c:243: error: `count_per_c' undeclared (first use in this function)
../ds16202.c:262: warning: implicit declaration of function `sprintf'
../ds16202.c:262: error: `ptrTemp' undeclared (first use in this function)
../ds16202.c:262: warning: double format, float arg (arg 3)
../ds16202.c:262: warning: embedded `\0' in format
make: *** [ds16202.o] Error 1
Build failed with 49 errors and 10 warnings...
첨부한 소스를 빌드시 아래와 같은 오류가 발생하였습니다.
혹시 제가 뭐 잘못한게 있는지? AVR Studio 와 |WinAVR 을 사용했습니다.
rm -rf ds1620.o ds16202.o ds1620.elf dep/* ds1620.hex ds1620.eep
Build succeeded with 0 Warnings...
avr-gcc.exe -mmcu=atmega16 -Wall -gdwarf-2 -O0 -MD -MP -MT ds1620.o -MF dep/ds1620.o.d -c ../ds1620.c
avr-gcc.exe -mmcu=atmega16 -Wall -gdwarf-2 -O0 -MD -MP -MT ds16202.o -MF dep/ds16202.o.d -c ../ds16202.c
../ds16202.c:19: error: parse error before "value"
../ds16202.c: In function `ds1620_set_CLOCK':
../ds16202.c:21: error: `value' undeclared (first use in this function)
../ds16202.c:21: error: (Each undeclared identifier is reported only once
../ds16202.c:21: error: for each function it appears in.)
../ds16202.c:22: warning: implicit declaration of function `SETBIT'
../ds16202.c:22: error: `PORTA' undeclared (first use in this function)
../ds16202.c:22: error: `PORTA1' undeclared (first use in this function)
../ds16202.c:24: warning: implicit declaration of function `CLRBIT'
../ds16202.c: At top level:
../ds16202.c:28: error: parse error before "value"
../ds16202.c: In function `ds1620_set_RST':
../ds16202.c:30: error: `value' undeclared (first use in this function)
../ds16202.c:31: error: `PORTA' undeclared (first use in this function)
../ds16202.c:31: error: `PORTA2' undeclared (first use in this function)
../ds16202.c: At top level:
../ds16202.c:36: error: parse error before "value"
../ds16202.c: In function `ds1620_set_IO':
../ds16202.c:38: error: `DDRA' undeclared (first use in this function)
../ds16202.c:38: error: `PORTA0' undeclared (first use in this function)
../ds16202.c:39: error: `value' undeclared (first use in this function)
../ds16202.c:40: error: `PORTA' undeclared (first use in this function)
../ds16202.c: At top level:
../ds16202.c:46: error: parse error before "ds1620_get_IO"
../ds16202.c:47: warning: return type defaults to `int'
../ds16202.c: In function `ds1620_get_IO':
../ds16202.c:48: error: `PORTA' undeclared (first use in this function)
../ds16202.c:48: error: `PORTA0' undeclared (first use in this function)
../ds16202.c:49: warning: implicit declaration of function `CHKBIT'
../ds16202.c:49: error: `PINA' undeclared (first use in this function)
../ds16202.c:49: error: `PINA0' undeclared (first use in this function)
../ds16202.c: At top level:
../ds16202.c:52: error: parse error before "BYTE"
../ds16202.c:52: warning: type defaults to `int' in declaration of `degree'
../ds16202.c:52: warning: data definition has no type or storage class
../ds16202.c:54: error: parse error before "data"
../ds16202.c: In function `Put1620byte':
../ds16202.c:56: error: `BYTE' undeclared (first use in this function)
../ds16202.c:56: error: parse error before "i"
../ds16202.c:59: error: `i' undeclared (first use in this function)
../ds16202.c:65: error: `data' undeclared (first use in this function)
../ds16202.c: At top level:
../ds16202.c:79: error: parse error before "Get1620byte"
../ds16202.c:80: warning: return type defaults to `int'
../ds16202.c: In function `Get1620byte':
../ds16202.c:82: error: `BYTE' undeclared (first use in this function)
../ds16202.c:82: error: parse error before "i"
../ds16202.c:84: error: `DDRA' undeclared (first use in this function)
../ds16202.c:84: error: `DDA0' undeclared (first use in this function)
../ds16202.c:86: error: `data' undeclared (first use in this function)
../ds16202.c:87: error: `data1' undeclared (first use in this function)
../ds16202.c:95: error: `i' undeclared (first use in this function)
../ds16202.c: In function `ds1620_Init':
../ds16202.c:126: error: `DDRA' undeclared (first use in this function)
../ds16202.c:126: error: `DDA1' undeclared (first use in this function)
../ds16202.c:127: error: `DDA0' undeclared (first use in this function)
../ds16202.c:128: error: `DDA2' undeclared (first use in this function)
../ds16202.c: At top level:
../ds16202.c:139: error: parse error before '*' token
../ds16202.c: In function `GetTemperature':
../ds16202.c:141: error: `BYTE' undeclared (first use in this function)
../ds16202.c:141: error: parse error before "data"
../ds16202.c:148: error: `WORD' undeclared (first use in this function)
../ds16202.c:148: error: parse error before "count_remain"
../ds16202.c:161: error: `data' undeclared (first use in this function)
../ds16202.c:225: error: `temp_and_half_bit' undeclared (first use in this function)
../ds16202.c:226: error: `sign_bit' undeclared (first use in this function)
../ds16202.c:233: error: `count_remain' undeclared (first use in this function)
../ds16202.c:243: error: `count_per_c' undeclared (first use in this function)
../ds16202.c:262: warning: implicit declaration of function `sprintf'
../ds16202.c:262: error: `ptrTemp' undeclared (first use in this function)
../ds16202.c:262: warning: double format, float arg (arg 3)
../ds16202.c:262: warning: embedded `\0' in format
make: *** [ds16202.o] Error 1
Build failed with 49 errors and 10 warnings...
일단 avrxx.h 와 같이 avr 모델에 따른 헤더파일을 인클루드 해줘야되고요
128일경우에는
#include "avr128.h"
이런식인데 컴파일러마다 조금씩 다르니까 확인해보셔야 합니다.
매크로로 사용된 setbit등도 main문 위에서 정의되어야 합니다;;