Bulk order of LSI LS7184N Quadrature Decoder IC

popchops

Well-known member
Thanks for your reply! I know they are easily available in the US. Digikey want an additional $80 for shipping to the UK. It's a problem.
25504
 

oracacle

Senior Member
Erco, would you be willing to ship one or more at a lower cost?
Seems like a logical solution to extortion.
 

popchops

Well-known member
Is this something a Picaxe could do?
Yes I currently have tested on a 28X2, just this minute soldering in a 08M2 to confirm it works. It will never be as good/elegant as the HW decoder chips, but it's good enough considering that my main loop needs a minimum IR timeout of 27ms to scan for IR input. Cannot be interrupted in this period, which means my overall rate of change is limited to ~37 changes per second without missing a change. For an encoder with 32 detents, that's more than one full revolution so quite unlikely. 32 detents represents an increase in audio volume of 16 dB which is quite a lot. As you see, a picaxe SW solution capable of ~90 changes per second is quite adequate.

Nice guys at LSI did send me a couple of samples of LS7184, but it's the surface mount package (the fat-finger version LS7184N is out of stock, and has minimum quantity of 100). I've ordered a proto board with 0.05in pitch so I will try my hand at soldering in miniature. o_O
 

hippy

Technical Support
Staff member
Is this something a Picaxe could do?
I would have thought it's the ideal application for a PICAXE-08M2. It would be possible to make the CLK_UP and CLK_DN outputs toggling which could make polling for changes easier than looking for a short pulse.

Code:
#Picaxe 08M2

;     -|+V 0V|-
;     -|SI O0|- 
; A >--|X4 X1|--> CLK_UP
; B >--|I3 X2|--> CLK_DN

Symbol CLK_UP = 1
Symbol CLK_DN = 2

;     .------- A was
;     |.------ B was
;     ||.----- A now
;     |||.---- B now
;     ||||
Data %0010, ( CLK_UP )
Data %0111, ( CLK_DN )

Init:
  SetFreq M32
  Low CLK_UP
  Low CLK_DN

MainLoop:
  Do
    b0 = pins / 8
    b1 = b1 & %11 * 4 | b0
    Read b1, b2
    Toggle b2
  Loop
That is the simplest quadrature detector, just detecting A going high. Detecting A falling as well, or all transitions on A or B would simply be a case of adding extra DATA definitions.
 

popchops

Well-known member
Yes - I will use a picaxe 08M2. It's fast enough even for full quadrature detection of all edges up to 100 Hz.

Thanks Hippy.
 

hippy

Technical Support
Staff member
Untested but, if you do need more responsiveness, you can use a more complicated bit mapping in 'b1' to track changes -
Code:
  Do          ;  76543210           ;        Was     Now
    b1 = b1   & %00011000 * 4       ; .---.-------.-------.-----------.
    b1 = pins & %00011000 + b1      ; | - | A | B | A | B | - | - | - |
    Read b1, b2                     ; `---^-------^-------^-----------'
That saves on a division so should be faster. Not sure if adding 'b1' four times would be quicker than a multiplication, but I suspect not.

The DATA entries then have to be adjusted to suit that -
Code:
;     .------- A was
;     |.------ B was
;     ||.----- A now
;     |||.---- B now
;     ||||
Data %0010000, ( CLK_UP ) ; A rising  - B = 0
Data %0111000, ( CLK_DN ) ; A rising  - B = 1
Data %1000000, ( CLK_DN ) ; A falling - B = 0
Data %1101000, ( CLK_UP ) ; A falling - B = 1
Data %0001000, ( CLK_DN ) ; B rising  - A = 0
Data %1011000, ( CLK_UP ) ; B rising  - A = 1
Data %0100000, ( CLK_UP ) ; B falling - A = 0
Data %1110000, ( CLK_DN ) ; B falling - A = 1
 
Top