AVR 2313 UART won't work. Please help

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hello.
    I just got an STK-500 with an AVR AT90S2313 and i've been trying to
write a program to take in a lowercase letter from the UART and display what
number letter it is in the alphabet on LEDs.
    I'm pretty sure my code is ok (see below), Im using a null modem cable
to the STK-500 user serial port, and i've wired the RXD and TXD pins on the
STK-500 to PD0 and PD1 on the 2313. I hook the other end of the null modem
cable to my computer and connect from hyperterminal at 9600 bps 8-n-1.
According to the 2313 specs, the BAUD setting (UBBR) for the speed i set the
STK-500 to (1.84 Mhz) is 11.
    However, when i program the chip, nothing happens. I connect from
hyperterminal and press letters, but they never affect the LEDs. What am I
doing wrong??

Thanks,
    Daniel

Code:
.include "2313def.inc"

.def Temp = R16
.def Input = R17

.org 0x0000
      rjmp RESET

.org    URXCaddr
     rjmp    SerialInt


RESET:
      ldi Temp, 255
      out DDRB, Temp

     ldi Temp, 11
     out UBRR, Temp

      ldi Temp, (1<<RXEN)|(1<<TXEN)|(1<<RXCIE)
     out UCR, Temp

      sei

      ldi Input, 0

      com Input
      out PORTB, Input
      com Input

LOOP:
      rjmp LOOP

SerialInt:
      cli
      sbis USR, RXC
      rjmp SerialInt

      in Input, SerialInt
      subi Input, 'a'

      com Input
      out PORTB, Input
      com Input

      sei
      reti



Re: AVR 2313 UART won't work. Please help
SerialInt part should read (wrote SerialInt instead of UDR, see *****'d
line)

SerialInt:
 cli
 sbis USR, RXC
 rjmp SerialInt

 in Input, UDR    ; *****
 subi Input, 'a'

 com Input
 out PORTB, Input
 com Input

 sei
 reti


Fixed that but it still doesnt work.
Thanks


Quoted text here. Click to load it
what
the
the



Re: AVR 2313 UART won't work. Please help
Quoted text here. Click to load it

someone may be able to help you on this group Daniel, but I feel in the
long run, you will be far better off putting your questions to 4000+ AVR
enthusiasts at avrfreaks.net

Give it a try.

Don...

--
Don McKenzie  E-mail:    http://www.dontronics.com/e-mail.html
              Home Page: http://www.dontronics.com

We've slightly trimmed the long signature. Click to see the full one.
Re: AVR 2313 UART won't work. Please help


Quoted text here. Click to load it

I've got some code that will get you started here:

http://www.geocities.com/leon_heller

Leon


Re: AVR 2313 UART won't work. Please help
On Fri, 17 Oct 2003 03:59:41 +0100, in msg

Quoted text here. Click to load it

For one, you don't use a null modem cable with the STK-500, just a simple
standard straight through serial cable is all you need...

-Zonn
--------------------------------------------------------
Zonn Moore
Zektor, LLC
www.zektor.com

Remove the ".AOL" from the email address to reply.

Re: AVR 2313 UART won't work. Please help

Quoted text here. Click to load it

I vote for bad cabling, wrong oscillator frequency or perhaps wrong
serial port in hyperterm.

To rule out cabling (and serial port) use the following program.

        rjmp    reset

reset:  ldi     r16,$fe
        out     DDRD,r16

loop:   in      r16,PIND        ; read RxD
        lsl     r16             ; shift RxD to bit1
        out     PORTD,r16       ; write to TxD
        jmp     loop

Now every character you type in hyperterm should be echoed.

 Jan-Hinnerk


Site Timeline