[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] compiler not generating IO

From: developer2112 (sent by Nabble.com)
Subject: Re: [avr-gcc-list] compiler not generating IO
Date: Thu, 26 Jan 2006 12:30:11 -0800 (PST)

Thanks Joerg,

I figured something like that, but since my serial port wasn't spitting out anything, I had to question it. I wrote a small test program in assembler to send out a char repetitively and it still doesn't work. I am using an atmega16 on stk500 using their rs232 spare port. I don't have a scope with me, but I did hook the serial port to a known good port on my computer with a decent terminal program (realterm). This is my first try with an avr so I am not not sure if it's a fault in what I am doing in code or if there is a hardware problem. Here is my code:

.include "m16def.inc"


.org    0

    jmp        RESET

.org    0x100


    ldi r16,0x02            ; not sure if this is needed
    out DDRD,r16         ; setting up the tx pin as output
    ldi r16,0xFF            ; and
    out PORTD,r16      ; enable pullups
    clr r17
    ldi r16,5
    out UBRRH, r17      ; 5 = 115200 baud
    out UBRRL, r16
; Enable receiver and transmitter
    ldi r16, (1<<RXEN)|(1<<TXEN)
    out UCSRB,r16
; Set frame format: 8data, 2stop bit
    ldi r16, (1<<URSEL)|(1<<USBS)|(3<<UCSZ0)
    out UCSRC,r16

    ldi r16,'A'            ; char to send
;**** Test input/output

 ; Wait for empty transmit buffer
    sbis UCSRA,UDRE
    rjmp USART_Transmit
; Put data (r16) into buffer, sends the data
    out UDR,r16
    rjmp    LOOP

thanks for any help.

View this message in context: Re: compiler not generating IO
Sent from the AVR - gcc forum at Nabble.com.
reply via email to

[Prev in Thread] Current Thread [Next in Thread]