| ??? 08/28/02 03:22 Read: times |
#28018 - Are\\\'nt they correct?? |
Dan Henry wrote:
------------------------------- DB COUNTER
THVAL EQU 0FDH
ORG 0000H
AJMP 0100H
ORG 0023H
JBC TI,TMT
RETI
TMT:
DJNZ COUNTER,NEXT
CLR TR1
AJMP R
NEXT: INC DPTR
MOVX A,@DPTR
MOV SBUF,A
R: RET
ORG 0100H
MOV COUNTER,#20H
MOV SP,#50H
MOV DPTR,#STR
MOV SCON,#74H
MOV PCON,#00H
MOV IE,#98H
MOV IP,#18H
MOV TCON,#00H
MOV TMOD,#20H
MOV TH1,#THVAL
MOV TL1,#THVAL
SETB SCON.6
MOVX A,@DPTR
MOV SBUF,A
STR: DB 'WELCOME TO 8052.COM AND MY PAGE.',0
END
Here are a few, but not necessarily all, bugs I see at first glance: "MOV TCON,#00H" has Timer1 stopped, so it can't generate the serial bit clock. "CLR TR1" in the ISR stops the serial baud clock if it were to get started. The "RET" at label "R:" should be "RETI". After "MOV SBUF,A", you have nothing to prevent the string at "STR" from being executed as program instructions. The string appears to be located in program memory, so your MOVX's should be MOVC's. ======================================== Hi Henry, First: MOV TCON,#00h was intentionally given so that the timer does not start until all other initializations are over. Later in the code you can find the start of the timer using SETB TR1 Second: CLR TR1 in the ISR will only get executed when all the characters in the Transmission line (STR) are over. Once all the bytes are transferred, the transmission should stop, so I stopped the TR1. Third: RETI is written in the ISP. From the ISP I used a JUMP instruction and to return back I used RET. Is it not correct? I mean,a jump statements destination cant be used as a function? Fourth: This last part, Im not sure if I understood what you said..Can you please clarify.. Thanks, Regards, Harsha |
| Topic | Author | Date |
| Serial Program for 89C51 not responding | 01/01/70 00:00 | |
| RE: Serial Program for 89C51 not responding | 01/01/70 00:00 | |
| RE: Serial Program for 89C51 not responding | 01/01/70 00:00 | |
| Are\\\'nt they correct?? | 01/01/70 00:00 | |
| 89C51 in Normal Mode?? | 01/01/70 00:00 | |
| RE: Addendum to Dan\'s message | 01/01/70 00:00 | |
| RE: Addendum to Dan\\\'s message | 01/01/70 00:00 | |
| RE: Addendum to Dan\\\\\\\'s message | 01/01/70 00:00 | |
| Addendum to my message ;-) | 01/01/70 00:00 | |
| RE: Are\\\\\\\'nt they correct?? | 01/01/70 00:00 | |
| RE: Addendum to my message ;-) | 01/01/70 00:00 | |
| RE: Addendum to my message ;-) | 01/01/70 00:00 | |
RE: Addendum to my message ;-) | 01/01/70 00:00 |



