c/exam/exo2.c
2020-09-12 18:34:55 +02:00

40 lines
No EOL
563 B
C
Executable file

/*
* controletptestxddd.c
*
* Created: 04/04/2021 15:10:52
* Author : Alzyohan
*/
#include <avr/io.h>
#define F_CPU 3686400
#include <util/delay.h>
#define UBRR_THEO 47
void uart_init(void);
void uart_putchar(char c);
int main(void)
{
unsigned char x='<';
uart_init();
while (1)
{
uart_putchar(x);
_delay_ms(1000);
};
}
void uart_init(void)
{
DDRD |= (1<<PD1);
UBRRL = UBRR_THEO;
UCSRB |= (1<<TXEN);
UCSRC |= (1<<USBS)|(3<<UPM0)|(3<<UCSZ0);
}
void uart_putchar(char c)
{
do{
//rien
}while ( !(UCSRA & (1<<UDRE)) );
UDR = c;
}