mikrokontrollersystemer-pro.../prosjekt.X/main.c

30 lines
606 B
C
Raw Normal View History

2024-03-06 11:34:22 +00:00
/*
* File: main.c
* Author: Sebastian H. Gabrielli
*
* Created on March 6, 2024, 12:34 PM
*/
2024-03-12 12:37:29 +00:00
#include "voltage.h"
#include "uart.h"
#define RTC_PERIOD (511)
#define DELAY_TIME 1000
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <string.h>
#include <stdbool.h>
2024-03-06 11:34:22 +00:00
2024-03-06 14:36:24 +00:00
#define F_CPU 4E6
2024-03-12 12:13:06 +00:00
int main() {
sensor_init();
ADC0_init();
2024-03-12 12:13:06 +00:00
init_uart((uint16_t)9600);
stdout = &USART_stream;
while (1) {
2024-03-12 12:37:29 +00:00
uint16_t adcVal = ADC0_read();
2024-03-12 12:26:12 +00:00
VREF.ADC0REF = VREF_REFSEL_VDD_gc;
printf("The values: \n%u , %u\n",VREF_REFSEL_VDD_gc , adcVal);
}
2024-03-11 14:48:20 +00:00
}