Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
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

List of 95 messages in thread
TopicAuthorDate
How badly would this hurt ...            01/01/70 00:00      
   Depends            01/01/70 00:00      
      dam'd americans            01/01/70 00:00      
   not a new variant, exactly            01/01/70 00:00      
      Use the Power of the 8052            01/01/70 00:00      
         which history?            01/01/70 00:00      
         That's my first choice ... however ...            01/01/70 00:00      
      DMA            01/01/70 00:00      
         No such plan is in the works.            01/01/70 00:00      
            DMA!            01/01/70 00:00      
               OK, but how much will you give up?            01/01/70 00:00      
                  DMA, logic and stuff...            01/01/70 00:00      
                     I think you have a different concept            01/01/70 00:00      
                        I don't understand... but...            01/01/70 00:00      
                           I'm not sure where this is headed            01/01/70 00:00      
      Cool            01/01/70 00:00      
         TI writable            01/01/70 00:00      
         if this is it, it is solved, if not rest            01/01/70 00:00      
   major confusion            01/01/70 00:00      
      Aye ... there's the rub...            01/01/70 00:00      
         a loud and resounding NO WAY            01/01/70 00:00      
            too late to edit            01/01/70 00:00      
               That's not what I want ... right now ...            01/01/70 00:00      
                  it DOES matter            01/01/70 00:00      
                     not in this case            01/01/70 00:00      
                        XDATA vs DATA/IDATA            01/01/70 00:00      
                           it's a work in progress, and, like many            01/01/70 00:00      
                        We seem to have come a long way            01/01/70 00:00      
                           yes, it's a mess ...            01/01/70 00:00      
                              if this is a survey            01/01/70 00:00      
                                 I'd have to agree            01/01/70 00:00      
                                    you can have your cake and eat it too.            01/01/70 00:00      
                        sure it does            01/01/70 00:00      
                           depends on memory width, doesn't it?            01/01/70 00:00      
                              go ahead, but PLEASE do not refer to the            01/01/70 00:00      
                                 I don't know what one should call it            01/01/70 00:00      
                                    I do, when it has benefits            01/01/70 00:00      
                                       I looked at them years ago            01/01/70 00:00      
                                          you are missing 'enhancements'            01/01/70 00:00      
                                             well if it uses the SFR's            01/01/70 00:00      
                                                as an example of an enhancement            01/01/70 00:00      
                                                   This is field-programmable logic.            01/01/70 00:00      
                                                      and have one more development step/uncer            01/01/70 00:00      
                                                         That's the whole point ...            01/01/70 00:00      
                           back up a bit ...            01/01/70 00:00      
                              AR7 is the annotation used by the better            01/01/70 00:00      
               Actually, that's not rational            01/01/70 00:00      
   It wouldn't bug me at all            01/01/70 00:00      
      not good enough            01/01/70 00:00      
         someone didn't read the datasheet first            01/01/70 00:00      
            that is impossible, ridiculous as well            01/01/70 00:00      
   not a thought but the fact            01/01/70 00:00      
      How to make a simple process ugly            01/01/70 00:00      
         new core            01/01/70 00:00      
            Atmel says            01/01/70 00:00      
               of course, they do            01/01/70 00:00      
               Why not just switch to another mfg?            01/01/70 00:00      
                  availability            01/01/70 00:00      
                     too bad ... how about a 68HCsomething?            01/01/70 00:00      
                     no problem            01/01/70 00:00      
                        Today Russia is            01/01/70 00:00      
      Be careful with ATMEL ...            01/01/70 00:00      
         What's with the French bashing?            01/01/70 00:00      
            French bashing            01/01/70 00:00      
               nothing wrong with french bashing            01/01/70 00:00      
                  There's nothing pressing            01/01/70 00:00      
                  You guys should be ashamed of yourselves            01/01/70 00:00      
                     Oh, LIGHTEN UP!            01/01/70 00:00      
            Probably this            01/01/70 00:00      
               Yes, that played a significant part            01/01/70 00:00      
                  I agree half the way            01/01/70 00:00      
                     Well, I'm P*ssed off!            01/01/70 00:00      
                        of course not            01/01/70 00:00      
   there are ways            01/01/70 00:00      
      Where does this fit?            01/01/70 00:00      
         with code as above you can feed a 460k U            01/01/70 00:00      
            I don't doubt that for a moment, but ...            01/01/70 00:00      
               already answered            01/01/70 00:00      
                  they're cleared independently, right?            01/01/70 00:00      
                  you get to the ISR, how do you know why?            01/01/70 00:00      
                     isn't that TI and RI            01/01/70 00:00      
                        I'm puzzled too            01/01/70 00:00      
                     you have two flags            01/01/70 00:00      
                        and so what?            01/01/70 00:00      
                           That would cause a problem.            01/01/70 00:00      
                              Richard, sleep on it            01/01/70 00:00      
                                 It's exactly how Moto does it            01/01/70 00:00      
                                 Maybe not ...            01/01/70 00:00      
                                    JBC            01/01/70 00:00      
                                       it's not clear yet            01/01/70 00:00      
                                    What is the difference, they take the sa            01/01/70 00:00      
                                 to Richard            01/01/70 00:00      
                                    Thanks, I'll give it a look            01/01/70 00:00      
   you get to the ISR, how do you know why?            01/01/70 00:00      
      don't RI and TI tell you?            01/01/70 00:00      

Back to Subject List