| ??? 02/09/02 20:40 Read: times |
#19612 - RE: HELP ME........ |
Marco: I have run your code through my Pinnacle simulator multiple times. As your code stands the simulator crashes after about 5 passes through your program with an error indicating that a RETI has been executed without an interrupt beforehand. This is because your code, without the CLR TI command is single stepping through your interrupt routine as though it were your main, which there isn't any as Peter D. has been telling you. Without a main program to be interrupted from your program will continue to crash after several passes. I made two minor changes which resulted in the program outputting a continuous stream of characters to the UART, beginning with an upper case T.
Your code with the change: ORG LJMP MAIN ORG 0023H LJMP SPISR ORG 0030H MAIN: MOV TMOD,#20H ; TIMER 1 MODE2 MOV TH1,#-3 ; 9600 BAUD RATE SET TR1 MOV SCON,#42H MOV A,#054H MOV IE,#90H MAIN1: nop ;added do nothing main1 routine nop SJMP MAIN1 SPISR: CLR TI ; added clearing of TI CJNE A,#7FH, SKIP MOV A,#20H SKIP : MOV SBUF,A INC A RETI I hope this works out for you. Take strong heed of Craig's suggestions regarding your use of the accumulator. Hal |



