UART i avr-gcc

Loading thread data ...

ogi napisał:

Jako przyklad... program wysylajacy przez USART1 znak 0x01 (ATmega128)

#include <avr/io.h>

int main() { // Ustaw baud rate: 230400 kbit/s, XTAL = 7.3728 MHz UBRR1H = (1 >> 8); UBRR1L = 1;

// Inicjalizuj UART // TXEN0 = 1 UCSR1B = _BV(TXEN);

while(1) { // Czy mozna wysylac? if (bit_is_set(UCSR1A, UDRE1)) { UDR1 = 0x01; } }

return 0; }

Pozdrawiam, voice

Reply to
voice

Na wlasne potrzeby napisalem sobie kilka procedurek asynchronicznej obslugi porty szeregowego. Dziala na ATMedze8535, ale przerobka na inny procesor nie powinna zajac dluzej niz 10 minut. Dlugosci buforow ustawiane sa w makefile Wrzucilem na

formatting link
pzdr. j.

Reply to
Jacek R. Radzikowski

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.