Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Can't identify a gray code

Status
Not open for further replies.

stube40

Member level 3
Joined
Feb 10, 2010
Messages
55
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,288
Location
Queensland, Australia
Activity points
1,825
I'm using an Omron E6CP-A Rotary encoder which has a gray code that looks like this. Anyone know what the algorithm for it is?

0
1
5
4
6
7
23
22
20
21
..... and so on
 

Have a look at the attached circuit ..
It should help you to convert the output from the rotary encoder into binary ..

Rgds,
IanP
:|
 

Yes, as the other specifications in the datasheet, it's assuming standard 8-Bit gray code. Your above posted sequence however isn't.
 

It is really hard to do it for 8 bits.
But It may reverse of shaft angle encoding.
What do you think guys?
 

Just for reference - I confirmed, and verified, all 256 values of the 8-bit output the hardway (using a data logger through a complete rotation). The first 10 values are as listed. If you search this sequence on the internet it crops up in the odd gray-code-related conversation, but no where does anyone say what the algorithm is. It surprised me to learn that there was more than one type of gray code!!!

My first suspicion was that I'd connected the sensor up the wrong way, but the colours are correct as defined by the data sheet and, further, a detailed Excel analysis of this sequence to a standard gray code sequence (eg 0, 1, 3, 2 etc) shows that it's not possible to make them the same just by swapping the bits around to undo a possible misconnection.

I feel a little bit more confident that I'm not being an idiot since one of my colleagues used the same rotary encoder in one of his projects and ended up creating a truth table by hand because he couldn't work it out either - and he is an experienced electronic engineer.

So the mystery continues......

What get's me is that the Omron data sheet doesn't mention it at all - pretty crappy for a $250 sensor!
 

What get's me is that the Omron data sheet doesn't mention it at all.
More exactly, it shows a coding that explicitely contradicts ýour measurement, as far as I understand, it's simply incorrect.
Either you have a special version of the encoder, or Omron changed the code without correcting the datasheet.
 

Here is the full sequence:

0
1
5
4
6
7
23
22
20
21
17
16
18
19
27
26
24
25
29
28
30
31
95
94
92
93
89
88
90
91
83
82
80
81
85
84
86
87
71
70
68
69
65
64
66
67
75
74
72
73
77
76
78
79
111
110
108
109
105
104
106
107
99
98
96
97
101
100
102
103
119
118
116
117
113
112
114
115
123
122
120
121
125
124
126
127
255
254
252
253
249
248
250
251
243
242
240
241
245
244
246
247
231
230
228
229
225
224
226
227
235
234
232
233
237
236
238
239
207
206
204
205
201
200
202
203
195
194
192
193
197
196
198
199
215
214
212
213
209
208
210
211
219
218
216
217
221
220
222
223
159
158
156
157
153
152
154
155
147
146
144
145
149
148
150
151
135
134
132
133
129
128
130
131
139
138
136
137
141
140
142
143
175
174
172
173
169
168
170
171
163
162
160
161
165
164
166
167
183
182
180
181
177
176
178
179
187
186
184
185
189
188
190
191
63
62
60
61
57
56
58
59
51
50
48
49
53
52
54
55
39
38
36
37
33
32
34
35
43
42
40
41
45
44
46
47
15
14
12
13
9
8
10
11
3
2
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top