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.

[SOLVED] Saving Data Using Serial INT

Status
Not open for further replies.

s.k.sahoo

Junior Member level 1
Joined
Jul 18, 2008
Messages
17
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,471
Dear Sir,

Help me Please

I have written the code below in Assembly to receive data serially using serial interrupt. I want the data should save at RAM, then read from that location and finally to load at Port1.

Please correct if there are any mistakes are there.

CODE:
;****************************************************************
; My Serial_Int_Code_01 (Using Serial Interrupt)
; 1: To Receive 8 Byte of data serialy
; 2: Save at RAM Location Staring from 40H
; 3: Read data from RAM Location
; 4: Load them at Port 1
;****************************************************************

ORG 00H
LJMP MAIN

ORG 23H
LJMP SERIAL ;Jump to Serial ISR

ORG 30H

MAIN:
MOV TMOD,#20H ;Timer1 Mode2, Auto reload
MOV TH1,#-3 ;9600 baudrate with 11.0592MHz XTAL
MOV SCON,#50H ;8Bit, 1Stopbit, REN enable
MOV IE,10010000B ;Enable Serial Interrupt
SETB TR1 ;Start Timer1
MOV R0,#40H ;Destination Pointer R0=40h (Storing DATA in RAM location)
MOV R1,#8 ;Data Counter R1=8

STORE:
MOV @R0,A
INC R0
DJNZ R1,STORE

RST:
CLR A
MOV R1,#8
MOV R0,#40H

READ:
MOV A,@R0
CPL A
MOV P1,A ;Send incoming data to P1
INC R0
DJNZ R1,READ
AJMP RST

;*********************************************************************
; Serial ISR Starts
;*********************************************************************

ORG 100H
SERIAL:
JB TI,TRANS ;Jump if TI is High
MOV A,SBUF ;Other wise Receive data
CLR RI ;Clear RI since CPU doesn't
RETI ;return from ISR

TRANS:
CLR TI ;Clear TI since CPU doesn't
RETI ;return from ISR

END
 

PLEASE HELP ME SOME ONE.
This code is not working in Proteus. Please guide some body.
S.K.Sahoo
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top