From a9f5c422432c5f24050baa53bab98b60778f8025 Mon Sep 17 00:00:00 2001 From: Elp03 Date: Tue, 9 Apr 2024 13:37:38 +0200 Subject: [PATCH] Fix comments --- prosjekt.X/main.c | 3 +- prosjekt.X/nbproject/configurations.xml | 200 +----------------------- prosjekt.X/nbproject/project.xml | 4 +- prosjekt.X/voltage.c | 26 +-- prosjekt.X/voltage.h | 8 +- 5 files changed, 24 insertions(+), 217 deletions(-) diff --git a/prosjekt.X/main.c b/prosjekt.X/main.c index 4325f26..c6898b6 100644 --- a/prosjekt.X/main.c +++ b/prosjekt.X/main.c @@ -17,13 +17,12 @@ #define F_CPU 4E6 int main() { - sensor_init(); ADC0_init(); init_uart((uint16_t)9600); stdout = &USART_stream; while (1) { - uint16_t adcVal = voltage_values(); + uint16_t adcVal = ADC0_read(); printf("The values: \n%u , %u\n",VREF_REFSEL_VDD_gc , adcVal); } } \ No newline at end of file diff --git a/prosjekt.X/nbproject/configurations.xml b/prosjekt.X/nbproject/configurations.xml index ff5c2b4..75cd8bb 100644 --- a/prosjekt.X/nbproject/configurations.xml +++ b/prosjekt.X/nbproject/configurations.xml @@ -1,4 +1,3 @@ -<<<<<<< Updated upstream @@ -8,11 +7,6 @@ uart.h voltage.h - - Makefile - @@ -24,6 +18,11 @@ uart.c voltage.c + + Makefile + Makefile @@ -179,192 +178,3 @@ -======= - - - - - themistor-temp.h - uart.h - voltage.h - fan_speeeed.h - - - Makefile - - - - - main.c - thermistor-temp.c - uart.c - voltage.c - fan_speeeed.c - - - - . - - Makefile - - - - localhost - AVR128DB48 - - - nEdbgTool - XC8 - 2.46 - 3 - - - - - - - - - - - - - - - false - false - - - - - - - false - false - - false - - false - false - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ->>>>>>> Stashed changes diff --git a/prosjekt.X/nbproject/project.xml b/prosjekt.X/nbproject/project.xml index 9ac6a37..cd4eb8b 100644 --- a/prosjekt.X/nbproject/project.xml +++ b/prosjekt.X/nbproject/project.xml @@ -8,9 +8,7 @@ 0 ISO-8859-1 - - . - + default diff --git a/prosjekt.X/voltage.c b/prosjekt.X/voltage.c index 8c43dfd..6e61b12 100644 --- a/prosjekt.X/voltage.c +++ b/prosjekt.X/voltage.c @@ -3,9 +3,21 @@ void ADC0_init(void) { /* Initializing ADC0 pin*/ + /*Voltage reading on pin pd6*/ PORTD.PIN6CTRL &= ~PORT_ISC_gm; PORTD.PIN6CTRL |= PORT_ISC_INPUT_DISABLE_gc; /* Disable */ PORTD.PIN6CTRL &= PORT_PULLUPEN_bm; + + /* Voltage reading T2 */ + PORTD.PIN2CTRL &= ~PORT_ISC_gm; + PORTD.PIN2CTRL |= PORT_ISC_INPUT_DISABLE_gc; /* Disable */ + PORTD.PIN2CTRL &= PORT_PULLUPEN_bm; + + /* Voltage reading T1 */ + PORTD.PIN1CTRL &= ~PORT_ISC_gm; + PORTD.PIN1CTRL |= PORT_ISC_INPUT_DISABLE_gc; /* Disable */ + PORTD.PIN1CTRL &= PORT_PULLUPEN_bm; + ADC0.CTRLC = ADC_PRESC_DIV4_gc; VREF.ADC0REF = VREF_REFSEL_VDD_gc; /* Internal reference */ @@ -27,7 +39,7 @@ uint16_t ADC0_read(void) { return ADC0.RES; } -uint16_t diode_voltage_read() { +uint16_t photodiode_voltage_read() { /* Gets value for the diode */ uint8_t adcVal = ADC0_read(); @@ -39,15 +51,3 @@ uint16_t internal_voltage_read() { VREF.ADC0REF = VREF_REFSEL_VDD_gc; } - -uint16_t diode_voltage_read(){ - /* Gets value for the diode */ - uint8_t adcVal = ADC0_read(); - return adcVal; -} -uint16_t internal_voltage_read() { - /* Gets value for the internal voltage reffreance*/ - - VREF.ADC0REF = VREF_REFSEL_VDD_gc; - return VREF_REFSEL_VDD_gc; -} \ No newline at end of file diff --git a/prosjekt.X/voltage.h b/prosjekt.X/voltage.h index c006796..a001a19 100644 --- a/prosjekt.X/voltage.h +++ b/prosjekt.X/voltage.h @@ -20,9 +20,9 @@ */ /* - * File: - * Author: - * Comments: + * File: Voltage.h + * Author: Sebastian Hernø Gabrielli, Helle Augland Grasmo, Ina Min Rørnes + * Comments: * Revision history: */ @@ -54,7 +54,7 @@ extern "C" { uint16_t ADC0_read(void); // Gets the value from sensor and internal voltage uint16_t internal_voltage_read(); - uint16_t diode_voltage_read(); + uint16_t photodiode_voltage_read(); #ifdef __cplusplus } #endif /* __cplusplus */