avr - ATmega128 - UCSROA undeclared (first use in this function) -
i have question atmega128 (uart) program sends hello message through uart.
the following code.
#include <avr/io.h> void putch(unsigned char data) { while((ucsroa & 0x20) == 0); udr0 = data; ucsroa |= 0x20; } int main() { unsigned char text[] = "hello! world!\r\n"; unsigned char = 0; ddre = 0xfe; ucsroa = 0x00; ucsrob = 0x18; ucsroc = 0x06; ubrroh = 0x00; ubrrol = 0x03; while(text[i] != '\0') putch(text[i++]); return 0; }
this error messages.
build succeeded 0 warnings... avr-gcc -mmcu=atmega128 -wall -gdwarf-2 -std=gnu99 -df_cpu=7372800ul -os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -md -mp -mt hello.o -mf dep/hello.o.d -c ../hello.c ../hello.c: in function 'putch': ../hello.c:5: error: 'ucsroa' undeclared (first use in function) ../hello.c:5: error: (each undeclared identifier reported once ../hello.c:5: error: each function appears in.) ../hello.c: in function 'main': ../hello.c:16: error: 'ucsroa' undeclared (first use in function) ../hello.c:17: error: 'ucsrob' undeclared (first use in function) ../hello.c:18: error: 'ucsroc' undeclared (first use in function) ../hello.c:19: error: 'ubrroh' undeclared (first use in function) ../hello.c:20: error: 'ubrrol' undeclared (first use in function) make: *** [hello.o] error 1 build failed 8 errors , 0 warnings...
i tested code other computers.
but, it's not working.
don't know how fix problem.
give me advice.
thanks.
its not
ucsroa
with letter "o", is
ucsr0a
with number 0
.
Comments
Post a Comment