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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/26/06 18:20
Modified:
  06/26/06 18:30

Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#119143 - Program # 2
Responding to: ???'s previous message
	ORG	00H
	LJMP	MAIN
MAIN:	MOV	TMOD,#20H
	MOV	TH1,#0FAH
	MOV	SCON,#50H
	SETB	TR1
	MOV	DPTR,#TEXT
AGAIN:	CLR	A
	MOVC	A,@A+DPTR
        JZ      STOP     < --- check for zero at end of text
	MOV	P1,A
	ACALL	SEND
	INC	DPTR
	SJMP	AGAIN
STOP:   SJMP    $        < --- endless loop here, stop program
SEND:	MOV	SBUF,A
BACK:	JNB	TI,BACK
	CLR	TI
	RET
RECVE:	JNB	RI,RECVE
	MOV	A,SBUF
	CLR	RI
	RET
TEXT: DB "I AM READY",0     < -- added zero
END


This program sets up serial port for 4800 baud, then starts reading the message TEXT, sends the data to P1 and also serial port. The problem with this program is after you complete the message "I AM READY", there is nothing to stop the reading/display loop from continuing through the [edit]next 65525 bytes of [/edit] the ROM displaying what ever may be there.

You need to add something like a zero "0" to the end of your text string, then a check for zero to exit the loop.

Jon

List of 18 messages in thread
TopicAuthorDate
im confused program not working            01/01/70 00:00      
   the upper one will never assemble!            01/01/70 00:00      
      bascom-8051            01/01/70 00:00      
         BASIC compiler; proper link            01/01/70 00:00      
   1st program TMOD wrong.            01/01/70 00:00      
      How to post code            01/01/70 00:00      
   as usual            01/01/70 00:00      
      Evidently...            01/01/70 00:00      
         do not judge people on their mistakes, j            01/01/70 00:00      
   As Usual Erik BULLIES Not Help            01/01/70 00:00      
      Instead of bullying ME why do'nt YOU hel            01/01/70 00:00      
      Charles take note            01/01/70 00:00      
      fait accompli            01/01/70 00:00      
         That's true...            01/01/70 00:00      
         Why would he?            01/01/70 00:00      
      Stop the War please            01/01/70 00:00      
         the crux            01/01/70 00:00      
   Program # 2            01/01/70 00:00      

Back to Subject List