??? 06/23/06 09:10 Read: times |
#118928 - JBC Responding to: ???'s previous message |
Richard, Erik,
Look at these code snippets and see what you gain by letting the SBUF access clear the flags. uart_isr_explicit: push ACC jnb RI,transmit receive: clr RI ;explicitly clear RI mov a,SBUF ... ;store it where you like it transmit: jnb TI,uart_isr_end clr TI ;explicitly clear TI ... ;get next byte in a mov SBUF,a uart_isr_end: pop ACC reti uart_isr_jbc: push ACC jbc RI,receive ;test and clear RI jbc TI,transmit ;test and clear TI sjmp uart_isr_end receive: mov a,SBUF ... ;store it where you like it jbc TI,transmit ;still have to do this sjmp uart_isr_end transmit: ... ;get next byte in a mov SBUF,a uart_isr_end: pop ACC reti uart_isr_auto: push ACC jnb RI,transmit receive: mov a,SBUF ;auto-clear RI ... ;store it where you like it transmit: jnb TI,uart_isr_end ... ;get next byte in a mov SBUF,a ;auto-clear TI uart_isr_end: pop ACC reti The solution with jbc has a lot of jumps which is generally not a good thing if you want to pipe-line the core. It is also a few instructions longer. The explicit version is slightly bigger than the auto version but all things considered doesn't bring you that much. And if you think you can do multiple instrcutions in parallel it won't cost you anything. Maarten |