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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/13/01 14:49
Read: times


 
#16568 - RE: What approach is appropriate:
I think there is not a general answer to your question.

If inputs are expected to change slowly (say every second), you can poll them asynchronously within your 'main loop'.

If inputs change very quickly (say every 100 microseconds), you must use interrupts.

There are intermediate solutions for inputs that change at an intermediate rate. For example, if they change fast enough to be lost using the asynchronous polling approach, you can use a timed interrupt (say every 200 microseconds) that reads the inputs and save their history in memory for later processing. This history could be simply a flag per input indicating that a transition has ocurred.

And if you really want to write a very structured code, then writting state-machines could be a good approach.

Regards,

Alfredo del Rio.


List of 9 messages in thread
TopicAuthorDate
What approach is appropriate:            01/01/70 00:00      
RE: What approach is appropriate:            01/01/70 00:00      
RE: What approach is appropriate:            01/01/70 00:00      
RE: What approach is appropriate:            01/01/70 00:00      
RE: What approach is appropriate - Felix            01/01/70 00:00      
RE: What approach is appropriate:            01/01/70 00:00      
RE: What approach is appropriate:            01/01/70 00:00      
RE: What approach is appropriate:            01/01/70 00:00      
RE: What approach is appropriate:            01/01/70 00:00      

Back to Subject List