Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/04/11 09:16
Read: times


 
#181680 - Some advice
Responding to: ???'s previous message
Hello there

I want your help about this program. I have a device that I must one packet which consists of 25 bytes via serial interface (rs-232) using 8051 micro-controller and after the package received form the device it responds with another packet (25 bytes).

I wrote this program and now I want to see the packet that the device sent to host (8051). But I can't see it, this is the program, is it anything wrong ?

ORG 000H

;===================================baudrate==========================================

MOV SCON,#50H ; receive enable, 8-BIT, 1 STOP BIT.
MOV TMOD,#20H ; timer 1 in 8-bit auto reload.
MOV TH1,#0FDH ; baud rate 9600.
SETB TR1 ; Start Timer 1
ANL PCON, #01111111B ; SMOD = 0
;======================================================================================

MOV R0,#25
MOV DPTR,#TABLE
NEXT:
MOV A,#0
MOVC A,@A+DPTR
CLR TI ;Clear TI.
MOV SBUF,A
JNB TI,$ ;Pause until the TI bit is set.
INC DPTR
DJNZ R0,NEXT

MOV R2,#25
NEXT1:
JNB RI,$ ;Wait for 8051 to set the RI flag.
MOV A,SBUF ;Read the character from the serial port.
MOV P2,A
MOV P0,#3EH
CALL DELAY
CLR RI
DJNZ R2,NEXT1

;==============================
; DELAY 0.5S
;==============================
DELAY:
MOV R5,#5
DL2:
MOV R6,#200
DL1:
MOV R7,#249
DJNZ R7,$
DJNZ R6,DL1
DJNZ R5,DL2
RET

;==============================
TABLE: DB 7EH,00H,00H,00H,33H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,1AH,00H,00H,00H,00H,00H,00H,00H,4EH
END


List of 10 messages in thread
TopicAuthorDate
RS232            01/01/70 00:00      
   Loop            01/01/70 00:00      
   Be specific            01/01/70 00:00      
   PB&J            01/01/70 00:00      
   sounds like a cue for a song...            01/01/70 00:00      
      Some advice            01/01/70 00:00      
         New Thread Would Help            01/01/70 00:00      
            it would also help if ...            01/01/70 00:00      
               How to post legible source code            01/01/70 00:00      
                  new thread            01/01/70 00:00      

Back to Subject List