Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

Problem in serial communication with pc

Problem in serial communication with pc

2008-03-13 by rakesh modi

Hello,
I am trying to do serial communication with PC using STK500 & AVRSTUDIO4.  I have written a complete code. and I think now there is no change can b done in code. But my code is not working good. Is there any setting or wire connection i have to do on STK500?
I m giving my code below.
Plz reply me.

.include "m32def.inc"

LDI R16, 0X5F
OUT SPL, R16
LDI R16, 0X08
OUT SPH, R16

rjmp main
Init_Uart:
    ldi R16,0x00
    out ucsra,R16

    ldi R16,0x98
    out ucsrb,R16

    ldi R16,0x00
    out ubrrh,R16

    ldi R16,0x47
    out ubrrl,R16

    ldi R16,0x86
    out ucsrc,R16

    ldi R16,0x80
    out acsr,R16

    
    ret


main:
    sbi ddra,0
    call Init_Uart
again:
    ldi r16,'R'
    out udr,r16

wait:
    sbic ucsra,udre
    rjmp again
    sbi porta,0
    rjmp wait    

 
R.P.Modi





      Now you can chat without downloading messenger. Go to http://in.messenger.yahoo.com/webmessengerpromo.php

[Non-text portions of this message have been removed]

Re: [AVR-Chat] Problem in serial communication with pc

2008-03-13 by John Samperi

At 04:51 PM 13/03/2008, you wrote:
>But my code is not working good.
>LDI R16, 0X5F
>....
>     ldi R16,0x98

Please use label such as ramend and bit names such as TXEN, RXEN
in your code otherwise it's hard to understand what you have done.

>Is there any setting or wire connection i have to do on STK500?

Did you connect the wires for the spare RS232 connector to the
TX and RX pins?

Have you set the fuses for proper clock settings? Otherwise the chip
will work from the internal 1MHz clock.

Regards

John Samperi

********************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495       Fax (02) 9674-8745
Email: john@ampertronics.com.au
Website  http://www.ampertronics.com.au
*Electronic Design * Custom Products * Contract Assembly
********************************************************

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.