---
+ Post New Thread
Results 1 to 6 of 6
  1. #1
    Junior Member level 3
    Points: 1,713, Level: 9
    nofnof's Avatar
    Join Date
    Mar 2005
    Posts
    31
    Helped
    2 / 2
    Points
    1,713
    Level
    9

    atmega8515 usart asm

    how can i send data to ATmega8515 using Hyperterminal , i have connected the microcontroller to a MAX232 and the pc with the max232 using a serial RS232 cable
    i've connected them as the graph in the attachmnt , and i have programmed the microcontroller with this program before conneting it with max232 and hyperteminal

    the program :

    ;************************************************* **************************
    ;* File Name :uart.asm
    ;* Title :UART based RS232 communication
    ;* Target MCU :AT90S8515
    ;*
    ;* DESCRIPTION
    ;* Test the UART based RS232 communication
    ;************************************************* **************************

    ;***** Directives
    .device atmega8515
    .nolist
    .include "m8515def.inc"
    .list

    .def temp = r16


    ;***** Interrupt vector table

    rjmp RESET ; Reset handle
    reti ; External Interrupt0 handle
    reti ; External Interrupt1 handle
    reti ; T/C1 Capture Event Interrupt handle
    reti ; T/C1 CompareA Interrupt handle
    reti ; T/C1 CompareB Interrupt handle
    reti ; T/C1 Overflow Interrupt handle
    reti ; T/C0 Overflow Interrupt handle
    reti ; SPI Transfer Complete Interrupt handle
    reti ; UART Rx Complete Interrupt handle
    reti ; UART Data Register Empty Interrupt handle
    reti ; UART Tx Complete Interrupt handle
    reti ; Analog Comparator Interrupt handle



    ;***** Subroutines

    uart_init:
    sbi UCSRB, RXEN ; Rx Enable
    LDI R18,$80
    OUT UCSRC,R18
    LDI R18,$86
    OUT UCSRC,R18
    LDI R18,$06
    OUT UCSRC,R18
    ldi temp, 51 ; Baudrate 9600 @ 8MHz Clock
    out UBRRl, temp
    ldi r18, $00
    out UBRRH, R18
    ret

    getc:


    IN TEMP, UDR
    OUT PORTA, TEMP
    ret

    ;***** Main


    RESET:
    ldi temp, LOW(RAMEND)
    out SPL, temp ; Initialize SPL
    ldi temp, HIGH(RAMEND)
    out SPH, temp ; Initialize SPH

    rcall uart_init ; Initialize UART


    loop:sbis UCSRA, RXC ; Wait for character
    rjmp loop
    rcall getc ; Read character from RS232


    rjmp loop ; Repeat endless






    is this correct ???
    ive send data and theres no response !

    •   Alt7th August 2005, 19:48

      advertising

        
       

  2. #2
    Banned
    Points: 9,649, Level: 23

    Join Date
    Jan 2004
    Location
    Philippines
    Posts
    966
    Helped
    74 / 74
    Points
    9,649
    Level
    23

    save data to atmega8515

    Use C language, can save you a lot from troubles. Btw, give us also your real schematic.


    1 members found this post helpful.

    •   Alt8th August 2005, 03:52

      advertising

        
       

  3. #3
    Advanced Member level 3
    Points: 17,217, Level: 31

    Join Date
    Apr 2005
    Posts
    880
    Helped
    126 / 126
    Points
    17,217
    Level
    31

    atmega8515 8515def.inc

    Here you are a file for sending data to AT90S8515, although the chip is defferent, I think it could help. Here is the code in BOLD.
    --------------------------------------------------------------------------

    .include "8515def.inc"
    .def temp = r16
    .org $000
    rjmp start
    .org $009
    rjmp receiving

    start:
    cli
    ldi temp,$5f
    out spl,temp
    ldi temp,$02
    out sph,temp
    ldi temp,$90
    out ucr,temp
    ldi temp,$40
    out usr,temp
    ldi temp,$33
    out ubrr,temp
    in temp,udr
    ldi temp,$ff
    out ddrc,temp
    ldi temp,$ff
    out portc,temp
    sei

    main_loop:
    rjmp main_loop

    receiving:
    in temp,udr
    com temp
    out portc,temp
    reti


    ---------------------------------------------------------------


    1 members found this post helpful.

    •   Alt8th August 2005, 05:33

      advertising

        
       

  4. #4
    Junior Member level 3
    Points: 1,713, Level: 9
    nofnof's Avatar
    Join Date
    Mar 2005
    Posts
    31
    Helped
    2 / 2
    Points
    1,713
    Level
    9

    sending data from microcontroller

    Quote Originally Posted by glenjoy
    Use C language, can save you a lot from troubles. Btw, give us also your real schematic.
    i dont know how to progam the microcontroller using C language , as i have mentioned that i want to program it using MEGAPRG program using its parallel port programmer.
    i want to send a code from the microcontroller a message to appear on the hyperterminal (like HELLO)

    THANKS

    Added after 3 minutes:

    Quote Originally Posted by seadolphine2000
    Here you are a file for sending data to AT90S8515, although the chip is defferent, I think it could help. Here is the code in BOLD.
    --------------------------------------------------------------------------

    .include "8515def.inc"
    .def temp = r16
    .org $000
    rjmp start
    .org $009
    rjmp receiving

    start:
    cli
    ldi temp,$5f
    out spl,temp
    ldi temp,$02
    out sph,temp
    ldi temp,$90
    out ucr,temp
    ldi temp,$40
    out usr,temp
    ldi temp,$33
    out ubrr,temp
    in temp,udr
    ldi temp,$ff
    out ddrc,temp
    ldi temp,$ff
    out portc,temp
    sei

    main_loop:
    rjmp main_loop

    receiving:
    in temp,udr
    com temp
    out portc,temp
    reti


    ---------------------------------------------------------------
    Thanks dear , but this is a very short program , can u post here a full program for ATmega8515 to receive a message from it on the hyperterminal

    thanks



  5. #5
    Advanced Member level 3
    Points: 17,217, Level: 31

    Join Date
    Apr 2005
    Posts
    880
    Helped
    126 / 126
    Points
    17,217
    Level
    31

    microcontroller data include

    Try this and if it works, you can then develop it.


    1 members found this post helpful.

  6. #6
    Newbie level 2
    Points: 1,315, Level: 8

    Join Date
    Aug 2005
    Posts
    2
    Helped
    0 / 0
    Points
    1,315
    Level
    8

    give data to microcontroller

    It's excellent code................



+ Post New Thread
Please login