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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/02/10 14:33
Modified:
  05/02/10 14:34

Read: times


 
#175603 - 4 -> 10 nsec Pulse Does Not Work for MCU
Responding to: ???'s previous message
Joe:

In his first posting Arun stated that he is using the AT89S52 MCU. When using the external interrupt inputs on an 8051 variant type part one has to obey certain timing requirements on the input pin to get the interrupt to be recognized. Timing requirements will vary from vendor to vendor and will change based upon clock frequency and clock divider ratio.

The following taken from the "8051 bible" should help explain the requirements. Note that many MCU data sheets fail to point out or discuss this at all.

8051 Bible says said:
External Interrupts
The external sources can be programmed to be level-activated or transition-activated by setting or clearing bit IT1 or IT0 in Register TCON. If ITx = 0, external interrupt x is triggered by a detected low at the INTx pin. If ITx = 1, external interrupt x is edge triggered. In this mode if successive samples of the INTx pin show a high in one cycle and a low in the next cycle, interrupt request flag IEx in TCON is set. Flag bit IEx then requests the interrupt.

Since the external interrupt pins are sampled once each machine cycle, an input high or low should hold for at least 12 oscillator periods to ensure sampling. If the external interrupt is transition-activated, the external source has to hold the request pin high for at least one cycle, and then hold it low for at least one cycle. This is done to ensure that the transition is seen so that interrupt request flag IEx will be set. IEx will be automatically cleared by the CPU when the service routine is called.

If the external interrupt is level-activated, the external source has to hold the request active until the requested interrupt is actually generated. Then it has to deactivate the request before the interrupt service routine is completed, or else another interrupt will be generated.


So based on that your "generic dual edge detection" will not work for an MCU that uses sampled edge detection. I also fully agree with Jez that the design approach you describe is problematic. It may work in your lab but fail to work correctly in some cases out in the field. You could modify your design some so that it would be a little better by changing the two inverters to 74xx14 type parts and then putting a series R in the signal path between the two. Then add some C to ground at the input of the second inverter. Proper selection of R and C would extends the resulting pulse width out to a length that would make it be not so dependent on voltage, chip characteristics and the phase of the moon.

The method described by Kiran is the tried and true method of providing a dual edge interrupt capability. That method has a significant advantage in that the MCU software can at all times know what edge has caused the interrupt. In many pulse train detection algorithms this is essential information. In one application that I worked on where Kiran idea was used it was necessary in the decoding algorithm so sometimes detect on rising edge only and then sometimes on both edges.

Some newer variant types have dual edge interrupt capability built in. This can eliminate the need for the external XOR gate. If these are used for pulse train detection the software may need to be able to read the interrupt signal in the ISR to be able determine which edge caused the interrupt. One needs to make sure your specific MCU allows the interrupt signal to be directly read this way. The XOR approach with the external gate does not need to be able to read the interrupt signal because the port pin that comes out from the MCU will tell you which level caused the current interrupt.

Michael Karas





List of 86 messages in thread
TopicAuthorDate
External Interrupt on both Falling edge & rising edge            01/01/70 00:00      
   ABORT!, ABORT!, ABORT!            01/01/70 00:00      
      Better circuits exists            01/01/70 00:00      
      one more            01/01/70 00:00      
   DANGER!! Don't Try This At Home!            01/01/70 00:00      
      Its not just Atmel            01/01/70 00:00      
   interrupts on both edges            01/01/70 00:00      
      Thank you All            01/01/70 00:00      
         Read about external Gate for Timer            01/01/70 00:00      
            gate for timer            01/01/70 00:00      
               Jan, will you Shhhhh!!!            01/01/70 00:00      
               Great Idea !            01/01/70 00:00      
                  But i've used up INT0 and INT1 pins            01/01/70 00:00      
                     int0 is gate for timer0            01/01/70 00:00      
                     T1(T0) pin is not use here            01/01/70 00:00      
                        so only one Ext.int pin will do            01/01/70 00:00      
                           i think so            01/01/70 00:00      
                              I haven't tried it yet            01/01/70 00:00      
                                 is a Zener that costly?            01/01/70 00:00      
                                 so try something safely            01/01/70 00:00      
                                    That the most exhaustive reply i got so far !            01/01/70 00:00      
                                       You are wellcome            01/01/70 00:00      
                                          Here's what i have done            01/01/70 00:00      
                                             simulation is partial            01/01/70 00:00      
                                                I'll try writing a sample code            01/01/70 00:00      
                                                   Dimmer            01/01/70 00:00      
                                                      its a dimmer for commercial sale            01/01/70 00:00      
                                                         Dimmer            01/01/70 00:00      
   Its in my Profile            01/01/70 00:00      
      is 8051/2 I/O similar to Zilog Z8            01/01/70 00:00      
         Cease and Desist            01/01/70 00:00      
         It's DANGEROUS - It's not about the IOs!!            01/01/70 00:00      
         Either you are NOT listening...or you don't want to listen            01/01/70 00:00      
            It's worse than that!            01/01/70 00:00      
               Its like openning Pandora's box            01/01/70 00:00      
                  chip A != chip B != chip C            01/01/70 00:00      
                  Consider these points...            01/01/70 00:00      
                     not a newbie to electronics            01/01/70 00:00      
                        What results do you really get from an experiment?            01/01/70 00:00      
                        Reply to Arun Kumar V            01/01/70 00:00      
                  what if the result is death?            01/01/70 00:00      
                     very positive opinion            01/01/70 00:00      
                     Thanks for the pointer            01/01/70 00:00      
   A generic approach to dual edge detection            01/01/70 00:00      
      Here is the method I have been using...            01/01/70 00:00      
      Oh Noes!!!!!!            01/01/70 00:00      
      4 -> 10 nsec Pulse Does Not Work for MCU            01/01/70 00:00      
         No additional logic gates            01/01/70 00:00      
         Modifying design            01/01/70 00:00      
            Yeah But...            01/01/70 00:00      
               If you say so            01/01/70 00:00      
                  Poppycock            01/01/70 00:00      
   Why you should not do this...            01/01/70 00:00      
      Galvanic isolation            01/01/70 00:00      
         Can't we use single AC optocoupler            01/01/70 00:00      
            not 1,8V            01/01/70 00:00      
            can be wrong circuit below            01/01/70 00:00      
               Critical again...            01/01/70 00:00      
                  varistor?            01/01/70 00:00      
                     Yes, but...            01/01/70 00:00      
            You can do a lot of things...            01/01/70 00:00      
               25V is too coarse            01/01/70 00:00      
                  use tha appnote I gave you the link to            01/01/70 00:00      
                  25V is not bad            01/01/70 00:00      
                     You still don't know what my product is?            01/01/70 00:00      
                        sorry            01/01/70 00:00      
                           Its O.K - this thread has crossed 65 replies            01/01/70 00:00      
                              npn            01/01/70 00:00      
                        no, I do not know what your product is            01/01/70 00:00      
                           Answers            01/01/70 00:00      
                              OK, then            01/01/70 00:00      
                                 No headphones            01/01/70 00:00      
                  Then take a better opto!            01/01/70 00:00      
                     he wants to build a Yogo, not a Mercedes            01/01/70 00:00      
                        which makes the lamp flicker when the fridge turns-off            01/01/70 00:00      
                           it (probably) does that anyhow            01/01/70 00:00      
                              No body wants to buy a Mercedez            01/01/70 00:00      
                                 What do you expect??            01/01/70 00:00      
                                    What is there to be ashamed of ?            01/01/70 00:00      
                                       Thread began with ....            01/01/70 00:00      
                                          Dead Horse is Alive and Kicking            01/01/70 00:00      
                                             obviously a comparator is a better solution            01/01/70 00:00      
                                                Oh My God...you having sleepless nights???            01/01/70 00:00      
                                             Then share it with us...            01/01/70 00:00      
                                             to Arun PLEASE get ...            01/01/70 00:00      
                                 what did you expect            01/01/70 00:00      

Back to Subject List