Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to send data to Microcontroller???

Status
Not open for further replies.

nofnof

Junior Member level 3
Joined
Mar 2, 2005
Messages
31
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,288
Activity points
1,614
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 !
 

save data to atmega8515

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

    nofnof

    Points: 2
    Helpful Answer Positive Rating
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


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

    nofnof

    Points: 2
    Helpful Answer Positive Rating
sending data from microcontroller

glenjoy said:
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 :cry: , 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:

seadolphine2000 said:
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
 

microcontroller data include

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

    nofnof

    Points: 2
    Helpful Answer Positive Rating
give data to microcontroller

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

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top