keil 컴파일러 쓰고있구요
stdio.h 인클루드해서 printf 를 쓸려고하는데
printf(\"asdf\"); 이렇게하면 asdf 가 시리얼통신을 통해서 출력이 잘되는데
printf(\"%d\",b); 이렇게하면 컴파일은 잘되는데 보드에서 인식을 못합니다;
왜이런걸까요ㅠ;
int main(void)
{
float a = 0;
short b;
ADCCON = 0x20; // power-on the ADC
delay(2000);
ADCCP = 0x10; // Select Temperature Sensor as an // input to the ADC
REFCON = 0x01; // connect internal 2.5V reference // to Vref pin
ADCCON = 0xE4; // continuous conversion
while(1)
{
while (!ADCSTA){}; // wait for end of conversion
b = (ADCDAT >> 16);
// To calculate temperature in °C, use the formula:
a = 0x525 - b;
// ((Temperature = 0x525 - Sensor Voltage) / 1.3)
a /= 1.3;
b = floor(a);
printf(\"Temperature: %d oC\\n\",b);
}
return 0;
}
이건 arm회사의 보드사용메뉴얼같은건데... 온도출력하는 코드 예가 있더라구요
똑같이해도 안되더라구요;; 왜그럴까요
stdio.h 인클루드해서 printf 를 쓸려고하는데
printf(\"asdf\"); 이렇게하면 asdf 가 시리얼통신을 통해서 출력이 잘되는데
printf(\"%d\",b); 이렇게하면 컴파일은 잘되는데 보드에서 인식을 못합니다;
왜이런걸까요ㅠ;
int main(void)
{
float a = 0;
short b;
ADCCON = 0x20; // power-on the ADC
delay(2000);
ADCCP = 0x10; // Select Temperature Sensor as an // input to the ADC
REFCON = 0x01; // connect internal 2.5V reference // to Vref pin
ADCCON = 0xE4; // continuous conversion
while(1)
{
while (!ADCSTA){}; // wait for end of conversion
b = (ADCDAT >> 16);
// To calculate temperature in °C, use the formula:
a = 0x525 - b;
// ((Temperature = 0x525 - Sensor Voltage) / 1.3)
a /= 1.3;
b = floor(a);
printf(\"Temperature: %d oC\\n\",b);
}
return 0;
}
이건 arm회사의 보드사용메뉴얼같은건데... 온도출력하는 코드 예가 있더라구요
똑같이해도 안되더라구요;; 왜그럴까요
댓글 0