AVR simulator - UART

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi everyone,

I am using AVRStudio v4.08 and I have problem with UART simulation. I've done simple code to send one byte by UART and if I observed PINE register during simulation there was not activity in time (TXD pin was set to high).

Code is following:

; usart.asm
; 4MHz clock

.include "m169def.inc"

.cseg

jmp RESET

.org 0x002E

RESET:
;stack initialization
ldi r16,high(RAMEND)
out SPH,r16
ldi r16,low(RAMEND)
out SPL,r16

;usart init,9600Bd,1stop
ldi r16,25
ldi r17,0
sts UBRRH,r17 ; baud rate H-byte
sts UBRRL,r16 ; baud rate L-byte
ldi r16,(1<<RXEN0)|(1<<TXEN0)
sts UCSRB,r16 ; enable TX+RX
ldi r16,(3<<UCSZ00)
sts UCSRC,r16 ; 1stop + 8data

call USART_send_data

cycle:
jmp cycle

USART_send_data:
ldi r16,0x1E
sts UDR,r16
ret

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

take a closer look to the AVRstudio docs...

every studio (ver.3 to 4) does NOT SUPPORT SERIAL COMUNICATION!!!

sorry, but you have to trust in your code...

but, what is this???:
ldi r16,(1< sts UCSRB,r16 ; enable TX+RX
ldi r16,(3< sts UCSRC,r16 ; 1stop + 8data

all other code seems to work...

regards Sven

(if you are german-speeking, you can mail me for deeper information)