| ??? 02/10/02 02:08 Read: times |
#19619 - RE: HELP ME........ |
Had to make the following changes in order for your code to run under Pinnacle. I'm not quite sure what you are doing with SCON. Setting it to #7Ah gives you the following:
7A = 0111 1010 Bit 7&6 01 = Mode 1 8-bit UART Variable baud rate bit 5 1 = Multiprocessor comm feature bit 4 1 = Enable Reception bit 3 1 = 9th transmit bit for Modes 2 & 3 bit 2 0 = RB8 = 0 bit 1 1 = Transmit Interrupt flag set bit 0 0 = Receive interrupt flag not set I moved CLR TI to the beginning of the Interrupt routine. Also relocated MOV A,#20h before the Interrupt enable instruction, otherwise the first interrupt prevents loading ACC with data. I think loading 00h to SBUF will not result in a transmit. If I am wrong I hope someone will clarify. Your code which runs successfully on Pinnacle: ORG 00h LJMP MAIN ORG 0023H LJMP SPISR ORG 0030H MAIN: MOV SCON,#7AH MOV IP,#038H MOV TMOD,#20H ; TIMER 1 MODE2 MOV TH1,#0FDH ; 9600 BAUD RATE SETB TR1 MOV A,#20H ;moved this line here MOV IE,#90H SJMP $ SPISR: CLR TI ;moved this line PUSH PSW CJNE A,#7FH,SKIP MOV A,#20H SKIP: MOV SBUF,A INC A POP PSW RETI END Also, in a response to another earlier posting Erik stated in very strong terms that any unused interrupt vectors should have a RETI at that location. I heartily (and humbly) endorse his suggestion. I'm sure we all have horror stories of unexpected interrupts vectoring into the Enchanted Forest, never to return. Hope this helps, Hal |



