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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/03/04 01:05
Read: times


 
#73562 - RE: Polling
Responding to: ???'s previous message
Nonetheless, doesn't it seem just a bit haphazard to trust that your never going to execute more than 2300 instructions before the next poll?

Haphazard? Not at all. I think you might be assuming that all systems need to do I/O concurrently with other processes. That's not always the case. The choice between polled and interrupt-driven I/O is a matter of designing to meet requirements. If your requirements dictate that I/O and other processes run concurrently, you pretty much have no choice but to commit some RAM for transmit and/or receive buffers for interrupt-driven I/O. On the other hand if your requirements allow for more of a single-threaded approach, you can allocate those buffers temporarily, if at all. By "if at all", I mean that some systems are entirely state-driven and don't buffer anything; they examine a received byte and transition to the next state defined by that byte's value (receive errors or timeouts would cause a different transition).

Are you using ad hoc free-flowing (so to speak) communications, or are you using some kind of packet protocol? Interrupt-driven might be better for the former, whereas if your system is designed around the packets in the latter, it may have nothing at all to do until packets are exchanged, in which case interrupt-driven doesn't buy you anything.

And wouldn't it be easier to just use the hardware interrupt rather than implementing something in software to ensure a poll in no more than every 2000 instructions?

Yep, if some kind of concurrency is necessary.

Don't get me wrong, I'm not saying not to use interrupts. What I am saying is that using polling is just as legitimate a design choice as using interrupts. Interrupt-driven I/O is not always the best way to go and neither is polling.

When I/O speeds reach a certain threshold, the sheer overhead of servicing interrupts introduces too many cycles to be able to keep up. A couple of months ago, I did a packet-based comms design with the data rate at 13Mbps -- not a heck of a lot of time to do much else but try to keep up, and not enough headroom for ISRs, so I did it by polling. And by the way, the system had absolutely nothing else to do until it received a packet.


List of 29 messages in thread
TopicAuthorDate
UART Without Serial Interrupt?            01/01/70 00:00      
   Polling            01/01/70 00:00      
      RE: Polling            01/01/70 00:00      
         RE: Polling            01/01/70 00:00      
            RE: Polling            01/01/70 00:00      
               RE: Polling            01/01/70 00:00      
                  RE: Polling            01/01/70 00:00      
                     RE: Polling            01/01/70 00:00      
                        RE: Polling            01/01/70 00:00      
                           RE: Polling            01/01/70 00:00      
                              RE: one step further            01/01/70 00:00      
                                 RE: one step further            01/01/70 00:00      
                                 another step further            01/01/70 00:00      
                                    RE: another step further            01/01/70 00:00      
                                       RE: another step further caveats            01/01/70 00:00      
                                          RE: another step further caveats            01/01/70 00:00      
                     RE: Polling -- long            01/01/70 00:00      
            RE: Polling            01/01/70 00:00      
               RE: Polling            01/01/70 00:00      
   RE: UART Without Serial Interrupt?            01/01/70 00:00      
      RE: UART Without Serial Interrupt?            01/01/70 00:00      
         RE: UART Without Serial Interrupt?            01/01/70 00:00      
         RE: UART Without Serial Interrupt?            01/01/70 00:00      
            RE: UART Without Serial Interrupt?            01/01/70 00:00      
   RE: UART Without Serial Interrupt?            01/01/70 00:00      
   When is polling preferable?            01/01/70 00:00      
      RE: When is polling preferable?            01/01/70 00:00      
   RE: UART Without Serial Interrupt?            01/01/70 00:00      
   Advantage of polling            01/01/70 00:00      

Back to Subject List