diff --git a/prosjekt.X/header.h b/prosjekt.X/header.h index 4b61ac2..d374053 100644 --- a/prosjekt.X/header.h +++ b/prosjekt.X/header.h @@ -54,8 +54,9 @@ extern "C" { #endif /* XC_HEADER_TEMPLATE_H */ -void led_init(void); +void sensor_init(void); void ADC0_init(void); void ADC0_start(void); bool ADC0_conversationDone(void); +uint16_t ADC0_read(void); uint16_t adcVal; \ No newline at end of file diff --git a/prosjekt.X/main.c b/prosjekt.X/main.c index 3157197..8f6879c 100644 --- a/prosjekt.X/main.c +++ b/prosjekt.X/main.c @@ -20,9 +20,6 @@ #include "uart.h" #include -int main() { - init_uart((uint16_t)9600); - stdout = &USART_stream; void sensor_init(void) { /* Disable digital input buffer */ @@ -68,10 +65,12 @@ bool ADC0_conversationDone(void) { } -int main(void) { +int main() { sensor_init(); ADC0_init(); - + init_uart((uint16_t)9600); + stdout = &USART_stream; + while (1) { //printf("loop\n"); if (ADC0_conversationDone()) { @@ -79,6 +78,8 @@ int main(void) { VREF.ADC0REF = VREF_REFSEL_VDD_gc; printf("The values: \n"); printf("%u , %u",VREF_REFSEL_VDD_gc , adcVal); + } else { + printf("Not done\n"); } } } \ No newline at end of file diff --git a/prosjekt.X/nbproject/configurations.xml b/prosjekt.X/nbproject/configurations.xml index 9fa5b00..0bf8a5f 100644 --- a/prosjekt.X/nbproject/configurations.xml +++ b/prosjekt.X/nbproject/configurations.xml @@ -1,173 +1,173 @@ - - - - - uart.h - header.h - - - Makefile - - - - - main.c - uart.c - - - Makefile - - - - localhost - AVR128DB48 - - - nEdbgTool - XC8 - 2.46 - 3 - - - - - - - - - - - - - - - false - false - - - - - - - false - false - - false - - false - false - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + uart.h + header.h + + + Makefile + + + + + main.c + uart.c + + + Makefile + + + + localhost + AVR128DB48 + + + nEdbgTool + XC8 + 2.46 + 3 + + + + + + + + + + + + + + + false + false + + + + + + + false + false + + false + + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +