Difference between revisions of "Protocol decoder:Graycode"

From sigrok
Jump to navigation Jump to search
(Created page with "{{Infobox protocol decoder | id = graycode | name = graycode | description = Gray Code and Rotary Encoder | status = ?? | license...")
 
(mention "quadrature")
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Infobox protocol decoder
{{Infobox protocol decoder
| id              = graycode
| id              = graycode
| name            = graycode
| name            = Gray code and rotary encoder
| description    = Gray Code and Rotary Encoder
| description    = Accumulate rotary encoder increments, provide timing statistics.
| status          = ??
| status          = supported
| license        = GPLv2+
| license        = GPLv2+
| source_code_dir = ??
| source_code_dir = graycode
| image          = [[File:Pd graycode.png|250px]]
| image          = [[File:Pd graycode.png|250px]]
| input          = logic
| input          = logic
Line 11: Line 11:
| probes          = —
| probes          = —
| optional_probes = D0-D7
| optional_probes = D0-D7
| options        = numchannels, pulses, avg_period
| options        = numchannels, edges, avg_period
}}
}}


The '''graycode''' protocol decoder can decode Gray Codes up to 8 data lines (but easily generalizes). One popular special case is the Rotary Encoder, which has two lines, A and B. The decoder will report phase, counting direction, absolute count, as well as timing information. Sorry for that mislabeling.
The '''graycode''' protocol decoder can decode Gray Codes up to 8 data lines (but easily generalizes). One popular special case is the Rotary Encoder, which has two lines, A and B, representing a quadrature signal. The decoder will report phase, counting direction, absolute count, as well as timing information.


== Parameters ==
== Parameters ==


'''pulses''': Rotary encoders are usually labeled as having X pulses per turn. A pulse consists of rising and falling edge and you have two lines that are phase-shifted by 90° to one another. This allows to extract ''4X'' edges per turn. the ''pulses'' parameter should be equal to the number of edges per turn.
'''edges''': Number of ''rising and falling'' edges per turn of ''all'' lines. Rotary encoders are usually labeled as having N ''pulses'' per turn. A pulse consists of rising and falling edge and you have two lines that are phase-shifted by 90° to one another. This allows to extract ''4N edges'' per turn.


'''numchannels''': due to a current bug in Pulseview, assigned optional probes aren't reported correctly, so you'll have to select the number of channels manually.
'''numchannels''': due to a current bug in Pulseview, assigned optional probes aren't reported correctly, so you'll have to select the number of channels manually.
Line 24: Line 24:
== Resources ==
== Resources ==


* [https://github.com/crackwitz/sigrok-pd-graycode Source on Github]
* [https://en.wikipedia.org/wiki/Gray_code Wikipedia: Gray Code]
* [https://en.wikipedia.org/wiki/Gray_code Wikipedia: Gray Code]



Latest revision as of 19:33, 5 May 2020

graycode
Pd graycode.png
Name Gray code and rotary encoder
Description Accumulate rotary encoder increments, provide timing statistics.
Status supported
License GPLv2+
Source code decoders/graycode
Input logic
Output graycode
Probes
Optional probes D0-D7
Options numchannels, edges, avg_period

The graycode protocol decoder can decode Gray Codes up to 8 data lines (but easily generalizes). One popular special case is the Rotary Encoder, which has two lines, A and B, representing a quadrature signal. The decoder will report phase, counting direction, absolute count, as well as timing information.

Parameters

edges: Number of rising and falling edges per turn of all lines. Rotary encoders are usually labeled as having N pulses per turn. A pulse consists of rising and falling edge and you have two lines that are phase-shifted by 90° to one another. This allows to extract 4N edges per turn.

numchannels: due to a current bug in Pulseview, assigned optional probes aren't reported correctly, so you'll have to select the number of channels manually.

Resources