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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/29/03 06:06
Read: times


 
#61485 - Quadrature encoder and edge trigger
Responding to: ???'s previous message
I'm doing a project based on 8052 clone ADuC812, and it will include two quadrature encoders. 1000 cycles per revolution, max speed about 150 RPM but usually much lower.

I was pondering a solution: I generate a low pulse for each transition of any channel(*), trigger INT by falling edge, and in the interrupt I examine a port where I read channels A and B, and knowing them and their previous values, just increase or decrease the counter. (The program does much more than that so I can't sacrifice the main program loop for that, though nothing else is so time-critical)

I have some questions.
The short question is: Can it work?
(and why, and how to fix it)
The longer questions...
1) How short pulses can I generate so the edge still gets detected?
2) If another edge arrives during an interrupt routine, is another interrupt polled for launching after the first ends, or simply the event is lost? (I think I can finish routine from one encoder before it sends another signal, but I can't guarantee that the other encoder won't send a signal in the meantime)
3) I came up with this method of determining the direction: If A' is previous value of A and B' is previous B, A equal B' (or B=A', just the same) means one direction, different means the other. (seems right?) But since 8052 has no bitwise XOR or comparison, I'm pondering performing that externally - feed B' to a port and XOR it through a chip with A, feeding the result back to a port - this way I may get the result in 2 CPU cycles instead of, at least 4 (four interleaved jb, jnb). Is this idea completely dumb or is there anything to it?
4) Any experiences/advices on that subject?

(*) For one encoder XOR the A and B signals [result: one edge for each transition], convert both edges to pulses by passing direct [falling edge to pulse] and negated [rising edge to pulse] signal through two schmidt triggers or monostable multivibrators, then NOR the results [high on no pulse, low on pulse from any of two outputs] and pass them to INT input.

List of 30 messages in thread
TopicAuthorDate
Quadrature encoder            01/01/70 00:00      
   RE: Quadrature encoder            01/01/70 00:00      
      RE: Quadrature encoder            01/01/70 00:00      
      RE: Quadrature encoder            01/01/70 00:00      
   RE: Quadrature encoder            01/01/70 00:00      
      RE: Quadrature encoder            01/01/70 00:00      
         RE: Quadrature encoder            01/01/70 00:00      
         RE: Quadrature encoder            01/01/70 00:00      
            RE: Quadrature encoder            01/01/70 00:00      
   RE: Quadrature encoder            01/01/70 00:00      
      RE: Quadrature encoder            01/01/70 00:00      
         Quadrature encoder and edge trigger            01/01/70 00:00      
            RE: Quadrature encoder and edge trigger            01/01/70 00:00      
      RE: Quadrature encoder            01/01/70 00:00      
      RE: Quadrature encoder            01/01/70 00:00      
         RE: Quadrature encoder            01/01/70 00:00      
         RE: Quadrature encoder            01/01/70 00:00      
            RE: Quadrature encoder            01/01/70 00:00      
   RE: Quadrature encoder            01/01/70 00:00      
      RE: Quadrature encoder            01/01/70 00:00      
         RE: Quadrature encoder            01/01/70 00:00      
            RE: Quadrature encoder            01/01/70 00:00      
               RE: Quadrature encoder            01/01/70 00:00      
                  RE: Quadrature encoder            01/01/70 00:00      
                     RE: Quadrature encoder            01/01/70 00:00      
                        RE: Quadrature encoder            01/01/70 00:00      
                           RE: Quadrature encoder            01/01/70 00:00      
                              RE: Quadrature encoder            01/01/70 00:00      
                                 RE: Quadrature encoder            01/01/70 00:00      
                                    RE: Quadrature encoder            01/01/70 00:00      

Back to Subject List