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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/22/04 03:08
Read: times


 
#81652 - Event Timer
Responding to: ???'s previous message

Your problem would be a good candidate for using a device with a PCA (programmable counter array). You would use two capture inputs (a PCA has up to 5 available) which store the current counter value in a pair of registers and can cause an interrupt. Then it would be a matter of calculating the difference between the two capture values. Apart from using external hardware, I think this is the only way you're going to get microsecond resolution. The Philips 89c668 has a PCA, I'm not too sure of other devices that have this capability also. If you wanted to use Timer1, I think you would have to have some external logic to gate the clock to the timer - depending on the actual cpu you want to use, 1uS is not too much time to do much in - the PCA removes the need for a super fast cpu - you'll get 1uS resolution at 12mhz.

As to your question of any port pin being used as an interrupt - No - only specific pins can be used as interrupts.

How do you create a data table? You mention a FIFO - this would be one way of addressing your problem - the interrupt code which has calculated the difference of your pulses would put the result into the FIFO, then your main line code would extract the values and calculate an average or whatever. How do we create a FIFO? Do you want to know the method or the implementation? For the implementation - in 'C' or assembler? There's plenty written about FIFOs here and on the web. A FIFO can also be implemented as a CIRCULAR BUFFER - if the buffer overflows, it overwrites the oldest values.

List of 10 messages in thread
TopicAuthorDate
Event Timer (2 seperate events)            01/01/70 00:00      
   Event Timer            01/01/70 00:00      
      Event Timer , and a PCA            01/01/70 00:00      
   A question            01/01/70 00:00      
      NAND Gate            01/01/70 00:00      
         Nand gate            01/01/70 00:00      
            NAND Gate and Data Table            01/01/70 00:00      
   Code            01/01/70 00:00      
      Further to Nand gate            01/01/70 00:00      
   Event Timer (2 seperate events)            01/01/70 00:00      

Back to Subject List