Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c1c2cb7

Browse files
committed
ENCODERS.md: Add note on missed pulses. encoder.py: replace property with function.
1 parent 2f5f2d0 commit c1c2cb7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

encoders/ENCODERS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ hardware may need to be adapted to limit the rate at which signals can change,
9292
possibly with a CR low pass filter and a schmitt trigger. This clearly won't
9393
work if the pulse rate from actual shaft rotation exceeds this limit.
9494

95+
In a careful test on a Pyboard 1.1 with an optical encoder pulses were
96+
occasionally missed. My guess is that, on rare occasions, pulses can arrive too
97+
fast for even hard IRQ's to keep track. For machine tool applications, the
98+
conclusion would seem to be that hardware decoding or possibly a rate limiting
99+
circuit is required.
100+
95101
# Problem 3: Concurrency
96102

97103
The presented code samples use interrupts in order to handle the potentially

encoders/encoder.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def y_callback(self, line):
2424
self.forward = self.pin_x.value() ^ self.pin_y.value() ^ self.reverse ^ 1
2525
self._pos += 1 if self.forward else -1
2626

27-
@property
2827
def position(self):
2928
return self._pos*self.scale
3029

0 commit comments

Comments
 (0)