All pastes #129966 Raw Edit

NeZinovaS

public c v1 · immutable
#129966 ·published 2006-08-13 20:41 UTC
rendered paste body
#include "avr/io.h"#include "avr/signal.h"#include "stdlib.h"#include "string.h"void init_com(){	// 4800 on 8Mhz		int baud = 103;	UBRRH = (uint8_t)(baud>>8);	UBRRL = (uint8_t)baud;	/* Enable receiver and transmitter */	UCSRB = (1<<RXEN)|(1<<TXEN);	/* Set frame format: 8data, 2stop bit */	UCSRC = (1<<URSEL) | (1<<USBS)|(3<<UCSZ0);	// 1bit stop, 	//UCSRC = (3<<UCSZ0);}void send_com( uint8_t dt ){	/* Wait for data to be received */		while (!(UCSRA & (1<<UDRE)));		UDR = dt;	//while (!(UCSRA & (1<<TXC)));}int main(){	init_com();	uint8_t a = 0;	while (1) {		send_com(a);		a++;	}		return 0;}