Last active
July 12, 2019 18:34
-
-
Save HectorTorres/b0ffc36d8f1e5a7e00bceddf31c75d41 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* _10bits.c | |
* | |
* Created: 24/06/2019 01:01:25 p.m. | |
* Author: JG-Hetpro | |
*/ | |
#include <avr/io.h> | |
#include<util/delay.h> | |
int main(void) | |
{ | |
DDRD=0xFF; // declaramos el puerto D como salida | |
DDRB=0xFF; // declaramos el puerto B como salida | |
ADMUX=0b11000000; // voltaje de ref 2.56v, resultado a la derecha, usamos el ADC0. | |
while(1) | |
{ | |
ADCSRA=0b11100100; // habilitamos, iniciamos, free running, factor de divisisión = 16 | |
PORTB=ADCL; // Almacenamos el valor de ADCL en el puerto B y lo mostramos | |
PORTD=ADCH; // Almacenamos el valor de ADCH en el puerto D y lo mostramos | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment