Hi everyone,
I'm facing trouble in a project of mine.
I'm having trouble in USART communication(9600-8-1-N).
The communication is between 2 atmega128 (one on stk501 and the other in a grifo (+mini) board).
I think the problem is in the atmega128 whixh is placed in the Stk.It gets stuck hear:
rcall usart_transmit ldi ta,0x0f out PORTC,ta rcall usart_receive ldi ta,0xff
the initializations and routines are the one's shown below.
usart_receive: ; Wait for data to be received sbis UCSR0A, RXC0 rjmp usart_receive ; Get and return received data from buffer in r16, UDRE0 ret usart_transmit: ; Wait for empty transmit buffer sbis UCSR0A,UDRE0 rjmp usart_transmit ; Put data (r16) into buffer, sends the data out UDRE0,r16 ret
;;; Setup USART configuration ;;; BAUD 9600,8-bit data frame,1 stop bits,no parity,synchronous mode usart_init: clr r16 sts UBRR0H,r16 ldi r16,6 out UBRR0L,r16 ldi r16,(1<<RXEN0)|(1<<TXEN0) out UCSR0B,r16 ldi temp,(3<<UCSZ00)|(1<<UMSEL0) sts UCSR0C,r16
I can't trace any mistake, or bag. The most frustrating of all is that everything works well when both are programmed in C, but that's out of the question due to constraints of our proffesor(it's about univercity).
Thanx in advance for every response :D[/code]