AVR 2313 UART won't work. Please help

Oct 16, 2003 5 Replies

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


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

what

the

the

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 USB to RS232 Converter that works http://www.dontronics.com/usb_232.html The World's Largest Range of Atmel/AVR & PICmicro Hardware and Software

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

formatting link

Leon

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

formatting link

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

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

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required