| ??? 08/28/02 04:26 Read: times |
#28025 - RE: Addendum to Dan\'s message |
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
There is nothing wrong with starting timer 1 before the initialization is complete so you might as well start the timer there. In any case, your code doesn't seem to have the SETB TR1 that you mention here. At least I don't see it in the code you posted. If timer 1 isn't started the data will never be sent to the serial port. 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? But you got to your JUMP from within the interrupt. Until a RETI is executed you're still in the interrupt. So, as Dan mentioned, you need to change that RET to a RETI. After "MOV SBUF,A", you have nothing to prevent the string at "STR" from being executed as program instructions. What Dan is saying is that after the MOV SBUF,A instruction you immediately insert the data for your string. After the MCU executes the MOV SBUF,A instruction, it will attempt to execute the next byte in memory--but the next byte in memory is your text string! You can't execute a text string (at least not with good results). To avoid executing the text string, insert an SJMP $ or something like that AFTER the MOV instruction and before your string. That way the program will stall there and just let the interrupt send out all the data. Also, you seem to be enabling timer 1 interrupt. I don't see any reason to do that. And if you DO enable timer 1, you need to have an ISR for timer 1 at code address 001Bh. You don't seem to have anything at 001Bh, so whenever timer 1 overflows it's going to execute (nothing) at 001Bh until it runs into your serial ISR. So your serial interrupt code is going to get executed whenever there is a serial interrupt AND whenever there is a timer interrupt. Bad thing. Best regards, Craig Steiner |
| 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 |



