JP7200333B2 - Code conversion method - Google Patents

Code conversion method Download PDF

Info

Publication number
JP7200333B2
JP7200333B2 JP2021185047A JP2021185047A JP7200333B2 JP 7200333 B2 JP7200333 B2 JP 7200333B2 JP 2021185047 A JP2021185047 A JP 2021185047A JP 2021185047 A JP2021185047 A JP 2021185047A JP 7200333 B2 JP7200333 B2 JP 7200333B2
Authority
JP
Japan
Prior art keywords
digit
converted
ternary
color pattern
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2021185047A
Other languages
Japanese (ja)
Other versions
JP2022016524A (en
Inventor
耕一郎 藤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Component Ltd
Original Assignee
Fujitsu Component Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from JP2017222727A external-priority patent/JP7058983B2/en
Application filed by Fujitsu Component Ltd filed Critical Fujitsu Component Ltd
Priority to JP2021185047A priority Critical patent/JP7200333B2/en
Publication of JP2022016524A publication Critical patent/JP2022016524A/en
Application granted granted Critical
Publication of JP7200333B2 publication Critical patent/JP7200333B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、コード変換方法に関する。 The present invention relates to a code conversion method.

服飾店で衣服を新調したり又は衣服のサイズ直しをする場合、店員がメジャーを用いて寸法を計測するのが一般的である。店員は測定データを客毎の寸法票に手書きで記入し、その後店舗の端末等に手動で測定データを入力している。この場合、測定データを寸法票に記入する作業及び測定データを端末に入力する作業が必要となり、二度手間になっていた。 2. Description of the Related Art When purchasing new clothes or resizing clothes in a clothing store, it is common for a store clerk to measure dimensions using a tape measure. The store clerk manually enters the measurement data into the size chart for each customer, and then manually inputs the measurement data into a store terminal or the like. In this case, it is necessary to enter the measurement data into the dimension chart and to input the measurement data into the terminal, which is a double effort.

この問題を解決するため、寸法票を用いずに測定データを端末に入力することができる装置が知られている(例えば、特許文献1参照)。この装置は、測定対象(人又は物)の各部の寸法を測定するメジャー及びその測定データを送信する機能を備えたメジャー付きの送信器と、送信器より送信された信号を受信し、測定データをプリントするメジャー信号受信・記録器とを備えている。送信器では、メジャーに付された白ドット及び黒ドットで構成されるバイナリコードを読み取り器で光学的に読み取り、読み取ったデータをデコードし、デコードしたデータを受信・記録器に送信している。 In order to solve this problem, there is known a device capable of inputting measurement data into a terminal without using a size chart (see, for example, Patent Document 1). This device includes a measure for measuring the dimensions of each part of an object (person or object) and a transmitter equipped with the measure, which has a function of transmitting the measurement data; and a measure signal receiver/recorder that prints the In the transmitter, a reader optically reads a binary code composed of white dots and black dots attached to the measure, decodes the read data, and transmits the decoded data to the receiver/recorder.

特開平7-35535号公報JP-A-7-35535

バイナリコードを用いる場合、測定対象の長さが長くなるほど、バイナリコードの桁数が増加する。このため、多桁数のバイナリコードをメジャーに付す場合には、メジャーの幅を太くする必要がある。また、多桁数のバイナリコードを読み取るために、読み取り器の読み取りセンサー数を増やす必要がある。このため、送信器の大型化が避けられないという問題がある。 When using a binary code, the number of digits of the binary code increases as the length of the object to be measured increases. Therefore, when a binary code with a large number of digits is attached to a measure, it is necessary to increase the width of the measure. Also, in order to read a binary code with a large number of digits, it is necessary to increase the number of reading sensors of the reader. Therefore, there is a problem that the size of the transmitter cannot be avoided.

本発明の目的は、装置の小型化を図ることが可能なコード変換方法を提供することにある。 SUMMARY OF THE INVENTION An object of the present invention is to provide a code conversion method capable of miniaturizing the device.

上記目的を達成するため、明細書に開示されたコード変換方法は、3進数と2値変化が発生しない3進グレイコードとを変換するコード変換方法において、変換元の下位桁から順に変換対象の桁を設定し、前記変換対象の桁よりも上位の桁の数値の合計が、0乃至は偶数の場合、あるいは奇数且つ前記変換対象の桁の数値が1の場合には、前記変換対象の桁の数値をそのまま維持し、前記変換対象の桁よりも上位の桁の数値の合計が奇数であり、前記変換対象の数値が0の場合には、前記変換対象の桁の数値を2に変換し、前記変換対象の桁よりも上位の桁の数値の合計が奇数であり、前記変換対象の数値が2の場合には、前記変換対象の桁の数値を0に変換することを特徴とする。 In order to achieve the above object, the code conversion method disclosed in the specification is a code conversion method for converting between a ternary number and a ternary Gray code in which no binary change occurs . When a digit is set, and the sum of the numerical values of the digits higher than the digit to be converted is 0 or an even number, or when the numerical value of the digit to be converted is an odd number and the numerical value of the digit to be converted is 1, the conversion target If the value of the digits to be converted is maintained as it is, and the sum of the values of the digits higher than the digit to be converted is an odd number and the value to be converted is 0, the value of the digit to be converted is set to 2. and converting the numerical value of the digit to be converted to 0 when the sum of the numerical values of the digits higher than the digit to be converted is an odd number and the numerical value to be converted is 2. do.

本発明によれば、装置の小型化を図ることができる。 According to the present invention, it is possible to reduce the size of the device.

本実施の形態に係る長さ計測器の構成図である。1 is a configuration diagram of a length measuring instrument according to this embodiment; FIG. 3進数のカラーパターンの読取処理を示す図である。FIG. 10 is a diagram showing reading processing of a ternary color pattern; (A)は、3進数のカラーパターンの例を示す図である。(B)は、3進グレイコードによるカラーパターンの例を示す図である。(A) is a diagram showing an example of a ternary color pattern. (B) is a diagram showing an example of a ternary Gray code color pattern. 3進グレイコードによるカラーパターンの読取処理を示す図である。FIG. 10 is a diagram showing a color pattern reading process using a ternary Gray code; 3色を用いた3進グレイコードを改良したコードのカラーパターンの例を示す図である。FIG. 4 is a diagram showing an example of a color pattern of a code that is an improvement of a ternary Gray code using three colors; 3進グレイコードから2値変化が発生しない3進グレイコードを作成する方法を示す図である。FIG. 2 is a diagram showing a method of creating a ternary Gray code in which no binary change occurs from a ternary Gray code; 計測器の処理動作を示すフローチャートである。It is a flowchart which shows the processing operation of a measuring device.

以下、図面を参照しながら本発明の実施の形態を説明する。 BEST MODE FOR CARRYING OUT THE INVENTION Hereinafter, embodiments of the present invention will be described with reference to the drawings.

図1は、本実施の形態に係る長さ計測器の構成図である。 FIG. 1 is a configuration diagram of a length measuring instrument according to this embodiment.

長さ計測器(以下「計測器」という)1は、複数桁のカラーパターン付きのメジャー7aのカラーパターンを読み取る読取部2と、読取部2で読み取られたデータから測定対象の長さを計測する計測手段としてのマイコン3と、算出された測定対象の長さのデータを有線又は無線で外部端末10に送信する通信装置4と、測定の開始をマイコン3に指示するスイッチ5と、読取部2、マイコン3及び通信装置4に電力を供給するバッテリ6と、メジャー7aを格納する格納部7とを備えている。 A length measuring device (hereinafter referred to as "measuring device") 1 has a reading unit 2 that reads the color pattern of a measure 7a with a multi-digit color pattern, and measures the length of the object from the data read by the reading unit 2. a microcomputer 3 as a measuring means, a communication device 4 that transmits the data of the calculated length of the object to be measured to the external terminal 10 by wire or wirelessly, a switch 5 that instructs the microcomputer 3 to start measurement, and a reading unit 2. It has a battery 6 that supplies power to the microcomputer 3 and the communication device 4, and a storage unit 7 that stores a measure 7a.

読取部2は、カラーパターンに対して光を照射するLED(Light Emitting Diode)8と、カラーパターンからの反射光を受光し、受光量を電流値又は電圧値に変換するフォトトランジスタ(PT)9とを備えている。LED8は、赤外線、可視光線及び紫外線の少なくとも1つを照射し、PT9はカラーパターンで反射された赤外線、可視光線及び紫外線の少なくとも1つを受光する。本実施の形態ではLED8及びPT9はカラーパターンの桁数分設けられ、図1では、LED8及びPT9のセットが6個あるが、セット数はこれに限定されるものではない。また、本実施の形態では、発光手段としてLED8を、受光手段としてPT9を用いているが、LED以外の発光素子やPT以外の受光素子を用いてもよい。 The reading unit 2 includes an LED (Light Emitting Diode) 8 that irradiates the color pattern with light, and a phototransistor (PT) 9 that receives the reflected light from the color pattern and converts the amount of received light into a current value or a voltage value. and The LED 8 emits at least one of infrared rays, visible rays and ultraviolet rays, and the PT 9 receives at least one of the infrared rays, visible rays and ultraviolet rays reflected by the color pattern. In this embodiment, the LEDs 8 and PT9 are provided for the number of digits of the color pattern, and although there are six sets of the LEDs 8 and PT9 in FIG. 1, the number of sets is not limited to this. Also, in the present embodiment, the LED 8 is used as the light emitting means and the PT 9 is used as the light receiving means, but light emitting elements other than the LEDs and light receiving elements other than the PT may be used.

マイコン3はLED8のオン/オフを制御し、PT9の電流値又は電圧値を読み取る。カラーパターンの色によって反射率が異なり、PT9の受光量は反射率に応じて変動するため、マイコン3はPT9から出力される電流値又は電圧値によって色の判断が可能である。例えば、PT9から出力される電圧値が2.0V、1.5V又は1.0Vである場合には、マイコン3はカラーパターンの色をそれぞれ白、青又は黒と判断する。 The microcomputer 3 controls the ON/OFF of the LED 8 and reads the current value or voltage value of the PT9. Since the reflectance differs depending on the color of the color pattern, and the amount of light received by the PT9 fluctuates according to the reflectance, the microcomputer 3 can determine the color based on the current value or voltage value output from the PT9. For example, when the voltage value output from PT9 is 2.0V, 1.5V or 1.0V, the microcomputer 3 determines that the color pattern is white, blue or black, respectively.

メジャー7aでは、おもて面に目盛りが長さ方向に沿って印刷されており、例えば裏面にN(N≧3。以下同様)色を用いたN進グレイコードを改良したコードのカラーパターンが一定の長さ毎に印刷されている。尚、N進グレイコードを改良したコードについては後述する。また、カラーパターンの各桁ではN色の異なる色ではなく、例えばN個以上の異なる濃度を有する同一色が使われていてもよい。ただし、このような濃度の違いなども本願では「異なる色」として扱う。格納部7は計測器1の筐体に取り付けられており、計測器1の筐体から取り外し可能である。 In the measure 7a, scales are printed along the length direction on the front surface, and for example, on the back surface, there is a code color pattern improved from the N-ary gray code using N (N≧3; the same shall apply hereinafter) colors. It is printed every fixed length. A code obtained by improving the N-ary Gray code will be described later. Also, each digit of the color pattern may use, for example, the same color having N or more different densities instead of N different colors. However, such differences in density are treated as "different colors" in the present application. The storage unit 7 is attached to the housing of the measuring instrument 1 and can be removed from the housing of the measuring instrument 1 .

外部端末10は、コンピュータ又はスマートホンのような有線又は無線の通信機能を有する通信端末であり、測定対象の長さのデータを通信装置4から受信し、データベースに登録して管理する。測定対象の長さのデータを登録するデータベースは、外部端末10に内蔵されていてもよいし、アクセス可能な状態で外部端末10の外部に設けられていてもよい。 The external terminal 10 is a communication terminal having a wired or wireless communication function, such as a computer or a smart phone, receives data on the length of the object to be measured from the communication device 4, registers it in a database, and manages it. The database for registering the length data of the object to be measured may be built in the external terminal 10, or may be provided outside the external terminal 10 in an accessible state.

図2は、3進数のカラーパターンの読取処理を示す図である。 FIG. 2 is a diagram showing reading processing of a ternary color pattern.

3進数のカラーパターン11は、例えば、6桁で構成され、3進数の0、1、2に対応する色として白、青及び黒の3色が採用されているものとする。反射率は、白、青、黒の順で低くなっている。図2では、説明の便宜上、各色に対応する3進数の数値や桁番号が記載されているが、実際のカラーパターンには3進数の数値や桁番号は記載されていない。また、PT9から出力される電圧値はアナログデータであり、白、青及び黒を読み取った場合、PT9から出力される電圧値はそれぞれ2.0V、1.5V及び1.0Vであるとする。 The ternary color pattern 11 is composed of, for example, six digits, and three colors of white, blue and black are adopted as colors corresponding to 0, 1 and 2 of the ternary numbers. Reflectance decreases in the order of white, blue, and black. In FIG. 2, ternary numerical values and digit numbers corresponding to each color are shown for convenience of explanation, but ternary numerical values and digit numbers are not shown in actual color patterns. It is also assumed that the voltage values output from PT9 are analog data, and the voltage values output from PT9 are 2.0 V, 1.5 V and 1.0 V when white, blue and black are read, respectively.

1セットのLED8及びPT9は、カラーパターン11の1桁分のパターンを読み取るように割り当てられている。 A set of LEDs 8 and PT 9 are assigned to read one digit pattern of the color pattern 11 .

カラーパターン11の領域21が読み取られたときは、白の桁番号1~桁番号3に対応するPT9は2.0Vを出力し、青の桁番号4及び桁番号6に対応するPT9は1.5Vを出力し、黒の桁番号5に対応するPT9は1.0Vを出力する。マイコン3は、各PT9からの電圧値に基づいて各桁の色を判断し、対応する3進数に変換する。図2の例では、領域21のパターンが3進数「000121」に変換される。マイコン3は、3進数の「000121」を10進数に変換することで測定対象の長さを算出する。領域21では、3進数の「000121」は10進数の「16」に変換される。図2では、領域21を読み取った結果得られた数値は、領域21に割り当てられた数値と一致する。 When area 21 of color pattern 11 is read, PT9 corresponding to digit numbers 1 to 3 of white outputs 2.0V, and PT9 corresponding to digit numbers 4 and 6 of blue outputs 1.0V. PT9, which outputs 5V and corresponds to black digit number 5, outputs 1.0V. The microcomputer 3 determines the color of each digit based on the voltage value from each PT 9 and converts it into a corresponding ternary number. In the example of FIG. 2, the pattern in area 21 is converted to the ternary number "000121". The microcomputer 3 converts the ternary number "000121" into a decimal number to calculate the length of the object to be measured. In area 21, ternary "000121" is converted to decimal "16". In FIG. 2, the number resulting from reading area 21 matches the number assigned to area 21 .

一方、カラーパターン11の領域22は2つの行にまたがっているため、領域22が読み取られると、双方の行が白い桁番号1~桁番号3に対応するPT9は2.0Vを出力するが、一方の行が白く他方の行が青い桁番号4に対応するPT9は1.75Vを出力し、一方の行が白く他方の行が黒い桁番号5及び桁番号6に対応するPT9は1.5Vを出力する。このように、PT9から出力される電圧値はアナログデータであるため、カラーパターン11の境目を読み取った場合は隣接する上下パターンの色の中間値が計測される。 On the other hand, since the area 22 of the color pattern 11 spans two rows, when the area 22 is read, the PT9 whose both rows correspond to the white digit number 1 to digit number 3 outputs 2.0V. The PT9 corresponding to digit number 4 with one row white and the other blue will output 1.75V, and the PT9 corresponding to digits 5 and 6 with one row white and the other black will output 1.5V. to output Since the voltage value output from the PT 9 is thus analog data, when the boundary between the color patterns 11 is read, the intermediate value between the colors of the adjacent upper and lower patterns is measured.

マイコン3は、各PT9からの電圧値に基づいて、領域22のパターンを3進数の「000011」又は「000111」に変換し、この値を10進数に変換して測定対象の長さを算出する。しかし、3進数の「000011」又は「000111」から変換された10進数の「4」または「13」は、ともに領域22の位置に対応する10進数の「8」又は「9」と同一ではないため、マイコン3で算出された測定対象の長さと実際の長さとが一致せず、読み取り誤差が生じてしまう。このように、カラーパターン11の境目で読み取り誤差が生じてしまうため、計測器1では図2のカラーパターン11を採用することはできない。 The microcomputer 3 converts the pattern of the area 22 into ternary numbers "000011" or "000111" based on the voltage value from each PT9, converts this value into a decimal number, and calculates the length of the object to be measured. . However, the decimal numbers '4' or '13' converted from the ternary numbers '000011' or '000111' are not identical to the decimal numbers '8' or '9', which both correspond to locations in region 22. Therefore, the length of the object to be measured calculated by the microcomputer 3 does not match the actual length, resulting in a reading error. In this way, reading errors occur at the borders of the color patterns 11, so the measuring instrument 1 cannot adopt the color patterns 11 of FIG.

図3(A)は、3進数のカラーパターン11の例を示す図であり、図3(B)は、3進グレイコードによるカラーパターン12の例を示す図である。 FIG. 3A is a diagram showing an example of a ternary color pattern 11, and FIG. 3B is a diagram showing an example of a color pattern 12 based on a ternary Gray code.

上述したように、カラーパターンの境目では隣接する上下パターンの中間値が計測されるため、図3(A)のようなカラーパターンを使用すると、実際の測定対象の長さとマイコン3で算出された測定対象の長さとの間に誤差が生じる場合がある。 As described above, at the boundary between color patterns, the intermediate value of adjacent upper and lower patterns is measured. An error may occur between the length of the object to be measured.

誤差が生じる原因の1つは、図3(A)の領域23~25に示すように、互いに隣接する上下のパターンにおいて、色変化(数値変化)が複数の桁で発生することである。例えば、領域23、24では、色変化が桁番号5及び桁番号6で発生している。領域25では、色変化が桁番号4~桁番号6で発生している。 One of the causes of errors is that color changes (numerical changes) occur in multiple digits in upper and lower patterns adjacent to each other, as shown in regions 23 to 25 in FIG. 3(A). For example, in regions 23 and 24, color changes occur at digit number five and digit number six. In region 25, color change occurs at digit number 4-digit number 6. FIG.

誤差発生を解消するために、図3(B)に示すような3進グレイコードによるカラーパターン12を採用することが考えられる。カラーパターン12は、互いに隣接する上下のパターンにおいて色変化が1桁のみで発生する。 In order to eliminate the occurrence of errors, it is conceivable to adopt a color pattern 12 based on a ternary Gray code as shown in FIG. 3(B). In the color pattern 12, the upper and lower patterns adjacent to each other have a color change of only one digit.

図4は、3進グレイコードによるカラーパターン12の読取処理を示す図である。 FIG. 4 is a diagram showing the reading process of the color pattern 12 by the ternary Gray code.

カラーパターン12の領域27が読み取られると、白の桁番号1~桁番号3に対応するPT9は2.0Vを出力し、青の桁番号4及び桁番号6に対応するPT9は1.5Vを出力し、黒の桁番号5に対応するPT9は1.0Vを出力する。マイコン3は、各PT9からの電圧値に基づいて各桁の色を判断し、対応する3進グレイコードに変換する。図4の例では、領域27のパターンから3進グレイコード「000121」が求められる。マイコン3は、3進グレイコードの「000121」を10進数に変換することで測定対象の長さを算出する。尚、3進グレイコードを3進数に変換する方法や3進数を10進数に変換する方法は公知の方法を利用する。領域27では、3進グレイコード「000121」は10進数の「10」に変換される。カラーパターン12の領域27の位置は10進数の「10」に対応するため、マイコン3で算出された測定対象の長さとメジャー7aが示す長さとが一致し、読み取り精度は良好である。 When area 27 of color pattern 12 is read, PT9 corresponding to white digit number 1 to digit number 3 outputs 2.0V, and PT9 corresponding to blue digit number 4 and digit number 6 outputs 1.5V. PT9 corresponding to black digit number 5 outputs 1.0V. The microcomputer 3 determines the color of each digit based on the voltage value from each PT9 and converts it into corresponding ternary gray code. In the example of FIG. 4, the ternary Gray code "000121" is determined from the pattern in region 27. In the example of FIG. The microcomputer 3 converts the ternary Gray code "000121" into a decimal number to calculate the length of the object to be measured. A method for converting a ternary Gray code to a ternary number and a method for converting a ternary number to a decimal number are known methods. In region 27, the ternary Gray code "000121" is converted to decimal "10". Since the position of the area 27 of the color pattern 12 corresponds to the decimal number "10", the length of the object to be measured calculated by the microcomputer 3 matches the length indicated by the measure 7a, and the reading accuracy is good.

一方、カラーパターン12の領域28が読み取られると、上下が白い桁番号1~4に対応するPT9はそれぞれ2.0Vを出力し、上下が青の桁番号5及び一方の行が黒く他方の行が白い桁番号6に対応するPT9はそれぞれ同じ1.5Vを出力する。図4の例では、領域28のパターンに対応する3進グレイコードは「000011」である。マイコン3は、3進グレイコードの「000011」を10進数に変換することで測定対象の長さを算出する。領域28の3進グレイコード「000011」は10進数の「5」に変換される。カラーパターン12の領域28の位置は10進数の「3」又は「4」に対応するため、マイコン3で算出された10進数と一致しない。従って、計測器1ではカラーパターン12も採用することはできない。 On the other hand, when the area 28 of the color pattern 12 is read, the PT9 corresponding to the digit numbers 1 to 4 with white top and bottom output 2.0V respectively, the digit number 5 with blue top and bottom and black on one line and black on the other line. The PT9 corresponding to the white digit number 6 each output the same 1.5V. In the example of FIG. 4, the ternary Gray code corresponding to the pattern in region 28 is "000011". The microcomputer 3 converts the ternary Gray code "000011" into a decimal number to calculate the length of the object to be measured. The ternary Gray code "000011" in area 28 is converted to decimal "5". Since the position of the area 28 of the color pattern 12 corresponds to the decimal number "3" or "4", it does not match the decimal number calculated by the microcomputer 3. FIG. Therefore, the color pattern 12 cannot be adopted in the measuring instrument 1 either.

カラーパターン12を利用しても誤差が生じる原因は、カラーパターン12の境目に隣接する上下パターンの各桁で、2値変化が生じる場合があるためである。2値変化とは上下パターンの同一桁の数値の差が2以上であること、つまり図4のカラーパターン12では白⇔黒の変化があることを意味している。 The reason why an error occurs even if the color pattern 12 is used is that each digit of the upper and lower patterns adjacent to the boundary of the color pattern 12 may cause a binary change. A binary change means that the difference between the numerical values of the same digit in the upper and lower patterns is 2 or more, that is, there is a change from white to black in the color pattern 12 of FIG.

カラーパターン12の領域28の桁番号6では、境目に隣接する上パターンが黒(2)で、下パターンが白(0)である。この場合、桁番号6に対応するPT9は1.5Vを出力するが、これは青を読み取った場合のPT9の出力値と同一であるため、マイコン3は桁番号6を青色と判断してしまう。このため、実際の測定対象の長さとマイコン3で算出された測定対象の長さとの間に誤差が生じる。 In digit number 6 of area 28 of color pattern 12, the upper pattern adjacent to the boundary is black (2) and the lower pattern is white (0). In this case, PT9 corresponding to digit number 6 outputs 1.5V, but since this is the same as the output value of PT9 when blue is read, the microcomputer 3 judges digit number 6 as blue. . Therefore, an error occurs between the actual length of the object to be measured and the length of the object to be measured calculated by the microcomputer 3 .

カラーパターン12の隣接する上下パターン間の数値変化が1値変化であれば、このような誤差は生じない。1値変化とは、上下パターンの同一桁の数値の差が1であること、つまり図4のカラーパターン12では白⇔青又は青⇔黒の変化であることを意味している。 If the numerical value change between the adjacent upper and lower patterns of the color pattern 12 is a single value change, such an error does not occur. The 1-value change means that the difference between the numerical values of the same digit in the upper and lower patterns is 1, that is, the color pattern 12 in FIG.

図5は、3色を用いた3進グレイコードを改良したコードのカラーパターン13の例を示す図である。 FIG. 5 is a diagram showing an example of a color pattern 13 of a code improved from a ternary Gray code using three colors.

カラーパターン13では、互いに隣接する上下のパターンの色変化又は数値変化が1桁のみで生じ、且つその数値変化が1値変化である。従って、カラーパターン13は、2値変化が発生しない3進グレイコードに対応する。換言すれば、カラーパターン13では、それぞれが1つの異なる数字に割り当てられたパターンが複数配列され、当該複数のパターンのそれぞれは、N進数(Nは3以上)の数値が割り当てられた桁を複数有し、各桁は割り当てられている数値に応じた異なる色を有している。そして、複数のパターンは昇順あるいは降順に配列され、配列方向に隣り合うパターン同士のハミング距離は1であり、隣り合うパターン同士の桁間の数値の変化量は1である。 In the color pattern 13, the color change or numerical value change of the upper and lower patterns adjacent to each other occurs only in one digit, and the numerical value change is a single value change. Color pattern 13 thus corresponds to a ternary Gray code in which no binary changes occur. In other words, in the color pattern 13, a plurality of patterns each assigned a different number are arranged, and each of the plurality of patterns has a plurality of digits assigned a numeric value in base N (N is 3 or more). , and each digit has a different color depending on the numerical value assigned to it. A plurality of patterns are arranged in ascending or descending order, the Hamming distance between patterns adjacent to each other in the arrangement direction is 1, and the amount of change in numerical value between digits between adjacent patterns is 1.

カラーパターン13を使用することで、隣接する上下パターンの境目を読み取って隣接する上下パターンの中間の電圧値がPT9から出力されても、マイコン3は当該電圧値を上下パターンのいずれかに対応する10進数に変換できるので、実際の測定対象の長さとマイコン3で算出された測定対象の長さとの間に実質的な誤差が生じなくなる。 By using the color pattern 13, even if the boundary between the adjacent upper and lower patterns is read and the intermediate voltage value between the adjacent upper and lower patterns is output from the PT 9, the microcomputer 3 will correspond the voltage value to either of the upper and lower patterns. Since it can be converted into decimal numbers, no substantial error occurs between the actual length of the object to be measured and the length of the object to be measured calculated by the microcomputer 3 .

図6は、3進数のコードから2値変化が発生しない3進グレイコードを作成する方法を示す図である。 FIG. 6 is a diagram showing a method of generating a ternary Gray code in which no binary change occurs from a ternary code.

3進数のコードから2値変化が発生しない3進グレイコードを作成する変換ルールは、以下の通りである。
(1)変換対象の桁よりも上位の桁の数値の合計が0又は偶数の場合には、変換対象の桁の数値を維持する。
(2)変換対象の桁よりも上位の桁の数値の合計が奇数であり、且つ変換対象の桁の数値が1である場合には、変換対象の桁の数値を維持する。
(3)変換対象の桁よりも上位の桁の数値の合計が奇数であり、且つ変換対象の桁の数値が2である場合には、変換対象の桁の数値を0に変換する。
(4)変換対象の桁よりも上位の桁の数値の合計が奇数であり、且つ変換対象の桁の数値が0である場合には、変換対象の桁の数値を2に変換する。
The conversion rule for creating a ternary Gray code in which no binary change occurs from a ternary code is as follows.
(1) If the sum of the numerical values of the digits higher than the digit to be converted is 0 or an even number, the numerical value of the digit to be converted is maintained.
(2) If the sum of the numerical values of the digits higher than the digit to be converted is an odd number and the numerical value of the digit to be converted is 1, the numerical value of the digit to be converted is maintained.
(3) If the sum of the numerical values of the digits higher than the digit to be converted is an odd number and the numerical value of the digit to be converted is 2, convert the numerical value of the digit to be converted to 0.
(4) If the sum of the numerical values of the digits higher than the digit to be converted is an odd number and the numerical value of the digit to be converted is 0, convert the numerical value of the digit to be converted to 2.

尚、桁番号1が最上位の桁であり、桁番号6が最下位の桁であるとする。また、図6の変換前の3進数のコードには桁番号0の桁が存在するが、この桁番号0は桁番号1の数値変換処理のために便宜上設定されている桁であり、桁番号0の桁には固定値として0が設定されている。 It is assumed that digit number 1 is the highest digit and digit number 6 is the lowest digit. In addition, the ternary code before conversion in FIG. 0 is set as a fixed value in the 0 digit.

一例として、図6に示す「001010」の3進数のコードから2値変化が発生しない3進グレイコードを作成する方法を示す。 As an example, a method of generating a ternary Gray code in which no binary change occurs from the ternary code of "001010" shown in FIG. 6 will be described.

まず、変換前の桁番号6の「0」の変換を検討する。桁番号6よりも上位の桁番号0~桁番号5の数値の合計は2(偶数)になるため、上記(1)の変換ルールに従って桁番号6の「0」は維持される。次いで、変換前の桁番号5よりも上位の桁番号0~桁番号4の数値の合計は1(奇数)であり、且つ桁番号5の数値が「1」であるため、上記(2)の変換ルールに従って桁番号5の「1」は維持される。 First, consider conversion of "0" of digit number 6 before conversion. Since the sum of the numerical values of digit number 0 to digit number 5 higher than digit number 6 is 2 (an even number), "0" of digit number 6 is maintained according to the above conversion rule (1). Next, since the sum of the numerical values of digit number 0 to digit number 4 higher than digit number 5 before conversion is 1 (odd number) and the numerical value of digit number 5 is "1", the above (2) The "1" in digit number 5 is maintained according to the conversion rules.

次いで、変換前の桁番号4よりも上位の桁番号0~3の数値の合計は1(奇数)であり、且つ桁番号4の数値が「0」であるため、上記(4)の変換ルールに従って桁番号4の「0」は「2」に変換される。次いで、変換前の桁番号3よりも上位の桁番号0~2の数値の合計は0になるため、上記(1)の変換ルールに従って桁番号3の「1」は維持される。 Next, since the sum of the numerical values of the digit numbers 0 to 3 higher than the digit number 4 before conversion is 1 (odd number) and the numerical value of the digit number 4 is "0", the above conversion rule (4) "0" of digit number 4 is converted to "2" according to Next, since the sum of the numerical values of digit numbers 0 to 2 higher than digit number 3 before conversion is 0, "1" of digit number 3 is maintained according to the above conversion rule (1).

変換前の桁番号2よりも上位の桁番号0~1の数値の合計は0になるため、上記(1)の変換ルールに従って桁番号2の「0」は維持される。最後に、変換前の桁番号1よりも上位の桁番号0の数値は0になるため、上記(1)の変換ルールに従って桁番号1の「0」は維持される。 Since the sum of the numerical values of digit numbers 0 to 1 higher than digit number 2 before conversion is 0, "0" of digit number 2 is maintained according to the above conversion rule (1). Finally, since the numeric value of digit number 0, which is higher than digit number 1 before conversion, becomes 0, the "0" of digit number 1 is maintained according to the above conversion rule (1).

このような手順により、図6に示す「001010」は、2値変化が発生しない3進グレイコード「001210」に変換される。 By this procedure, "001010" shown in FIG. 6 is converted into ternary Gray code "001210" in which no binary change occurs.

尚、上記(1)~(4)の変換ルールに従って、2値変化が発生しない3進グレイコードから元の3進数のコードに逆変換することもできる。 In addition, according to the conversion rules (1) to (4) above, the ternary Gray code in which no binary change occurs can be reversely converted to the original ternary code.

このように、N進数のコードに対応する変換ルールを決めることで、N進数のコードから2値変化が発生しないN進グレイコードを作成することができる。 By determining the conversion rule corresponding to the N-ary code in this way, it is possible to create an N-ary Gray code in which no binary change occurs from the N-ary code .

図7は、計測器1の処理動作を示すフローチャートである。 FIG. 7 is a flow chart showing the processing operation of the measuring instrument 1. As shown in FIG.

まず、スイッチ5が押下されると、測定の開始がマイコン3に指示される(S1)。マイコン3は各LED8をオンにし(S2)、LED8はカラーパターン13に光を照射する(S3)。各PT9はカラーパターン13からの反射光を受光し、受光量を電流値又は電圧値に変換する(S4)。マイコン3は、各PT9の電流値又は電圧値を読み取る(S5)。 First, when the switch 5 is pressed, the microcomputer 3 is instructed to start measurement (S1). The microcomputer 3 turns on each LED 8 (S2), and the LED 8 irradiates the color pattern 13 with light (S3). Each PT 9 receives reflected light from the color pattern 13 and converts the amount of received light into a current value or a voltage value (S4). The microcomputer 3 reads the current value or voltage value of each PT9 (S5).

マイコン3は各PT9から出力される電流値又は電圧値によって2値変化が発生しないN進グレイコードによって表現されたカラーパターン13の色を判断し、N進数のコードに対応する変換ルールに基づいてカラーパターン13からN進の値を求め、さらにN進数の値を公知の変換方法に基づいて10進数の値に変換する(S6)。マイコン3は、カラーパターン13の色と10進数の値との対応関係を示すテーブルを予め備えておいて、このテーブルに基づいて10進数の値を算出してもよい。そして、マイコン3は、10進数に変換された測定対象の長さのデータを、通信装置4を介して外部端末10に送信し(S7)、本処理を終了する。 The microcomputer 3 judges the color of the color pattern 13 expressed by the N-ary gray code that does not cause a binary change depending on the current value or voltage value output from each PT 9, and based on the conversion rule corresponding to the N-ary code . N- adic values are obtained from the color pattern 13 using the color pattern 13, and the N-adic values are converted into decimal values based on a known conversion method (S6). The microcomputer 3 may be provided in advance with a table showing the correspondence between the colors of the color pattern 13 and the decimal values, and may calculate the decimal values based on this table. Then, the microcomputer 3 transmits the data of the length of the object to be measured converted into decimal numbers to the external terminal 10 via the communication device 4 (S7), and ends this process.

以上説明したように、本実施の形態によれば、計測器1は、それぞれが1つの異なる数字に割り当てられたパターンが複数配列され、複数のパターンのそれぞれは、N進数(Nは3以上)の数値が割り当てられた桁を複数有し、各桁は割り当てられている数値に応じた異なる色を有し、複数のパターンは昇順あるいは降順に配列され、配列方向に隣り合うパターン同士のハミング距離は1であり、隣り合うパターン同士の桁間の数値の変化量は1であるコードが印刷されたメジャー7aと、上記パターンを光学的に読み取る読取部2と、読取部2による読み取り結果から測定対象の長さを計測するマイコン3と、を備える。 As described above, according to the present embodiment, the measuring instrument 1 has a plurality of patterns each assigned a different number, and each of the plurality of patterns is an N-ary number (N is 3 or more). Each digit has a different color according to the assigned numerical value, multiple patterns are arranged in ascending or descending order, and the Hamming distance between adjacent patterns in the arrangement direction is 1, and the amount of change in the numerical value between the digits of adjacent patterns is 1. Measured from a measure 7a printed with a code, a reading unit 2 that optically reads the pattern, and the result of reading by the reading unit 2. and a microcomputer 3 for measuring the length of an object.

従って、パターンが3以上のN進数であるので、バイナリコードをメジャーに付す場合に比べて、パターンを構成する桁数を減らすことができ、メジャー7aの幅を細くすることができる。また、多数の桁数のパターンを読み取るための読み取りセンサー数、即ちLED8及びPT9の個数を減らすことができる。このため、装置の小型化を図ることができる。 Therefore, since the pattern is an N-ary number of 3 or more, the number of digits constituting the pattern can be reduced and the width of the measure 7a can be reduced compared to the case where a binary code is attached to the measure. Also, the number of reading sensors for reading a pattern with a large number of digits, that is, the number of LEDs 8 and PTs 9 can be reduced. Therefore, it is possible to reduce the size of the device.

尚、本発明は、上述した実施の形態に限定されるものではなく、その要旨を逸脱しない範囲内で種々変形して実施することが可能である。 It should be noted that the present invention is not limited to the above-described embodiments, and various modifications can be made without departing from the gist of the present invention.

1 長さ計測器
2 読取部
3 マイコン
4 通信装置
7 格納部
7a メジャー
8 LED
9 フォトトランジスタ
1 length measuring instrument 2 reading unit 3 microcomputer 4 communication device 7 storage unit 7a measure 8 LED
9 phototransistor

Claims (1)

3進数と2値変化が発生しない3進グレイコードとを変換するコード変換方法において、
変換元の下位桁から順に変換対象の桁を設定し、
前記変換対象の桁よりも上位の桁の数値の合計が、0乃至は偶数の場合、あるいは奇数且つ前記変換対象の桁の数値が1の場合には、前記変換対象の桁の数値をそのまま維持し、
前記変換対象の桁よりも上位の桁の数値の合計が奇数であり、前記変換対象の数値が0の場合には、前記変換対象の桁の数値を2に変換し、
前記変換対象の桁よりも上位の桁の数値の合計が奇数であり、前記変換対象の数値が2の場合には、前記変換対象の桁の数値を0に変換することを特徴とするコード変換方法。
In a code conversion method for converting between a ternary number and a ternary Gray code in which no binary change occurs ,
Set the digits to be converted in order from the lower digits of the conversion source ,
If the sum of the numerical values of the digits higher than the digit to be converted is 0 or an even number, or if the numerical value of the digit to be converted is an odd number and the numerical value of the digit to be converted is 1, the numerical value of the digit to be converted is keep it as is
when the sum of the numerical values of the digits higher than the digit to be converted is an odd number and the numerical value to be converted is 0, converting the numerical value of the digit to be converted to 2;
A code conversion characterized by converting the numeric value of the digit to be converted to 0 when the sum of the numeric values of the digits higher than the digit to be converted is an odd number and the numeric value to be converted is 2. Method.
JP2021185047A 2017-11-20 2021-11-12 Code conversion method Active JP7200333B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2021185047A JP7200333B2 (en) 2017-11-20 2021-11-12 Code conversion method

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2017222727A JP7058983B2 (en) 2017-11-20 2017-11-20 Length measuring instrument, code and code conversion method
JP2021185047A JP7200333B2 (en) 2017-11-20 2021-11-12 Code conversion method

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2017222727A Division JP7058983B2 (en) 2017-11-20 2017-11-20 Length measuring instrument, code and code conversion method

Publications (2)

Publication Number Publication Date
JP2022016524A JP2022016524A (en) 2022-01-21
JP7200333B2 true JP7200333B2 (en) 2023-01-06

Family

ID=87885237

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2021185047A Active JP7200333B2 (en) 2017-11-20 2021-11-12 Code conversion method

Country Status (1)

Country Link
JP (1) JP7200333B2 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006147112A (en) 2004-11-24 2006-06-08 Toshiba Corp Magnetic recording medium and magnetic recording and reproducing device
WO2008086237A2 (en) 2007-01-05 2008-07-17 California Institute Of Technology Codes for limited magnitude asymmetric errors in flash memories
JP2012063344A (en) 2010-08-20 2012-03-29 Nsk Ltd Absolute encoder, absolute position detector, and signal pattern arrangement generation method for absolute encoder

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6475990A (en) * 1987-09-18 1989-03-22 Japan Atomic Energy Res Inst Position detector of nuclear reactor control rod

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006147112A (en) 2004-11-24 2006-06-08 Toshiba Corp Magnetic recording medium and magnetic recording and reproducing device
WO2008086237A2 (en) 2007-01-05 2008-07-17 California Institute Of Technology Codes for limited magnitude asymmetric errors in flash memories
JP2012063344A (en) 2010-08-20 2012-03-29 Nsk Ltd Absolute encoder, absolute position detector, and signal pattern arrangement generation method for absolute encoder

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
K. Jaya Sankar et al.,Generalized Gray Codes,Proceedings of 2004 International Symposium on Intelligent Signal Processing and Communication Systems (ISPACS 2004),2004年,pp.654-659
M. C. ER,On generating the N-ary Reflected Gray Codes,IEEE Transactions on Computers,1984年,Vol. C-33, No. 8,pp.739-741

Also Published As

Publication number Publication date
JP2022016524A (en) 2022-01-21

Similar Documents

Publication Publication Date Title
JP7118748B2 (en) Meters and optical readers
JP7058983B2 (en) Length measuring instrument, code and code conversion method
US9934760B2 (en) Information code, information code producing method, information code reader, and system which uses information code
US20090242649A1 (en) Two-dimensional code having rectangular region provided with specific patterns for specify cell positions and distinction from background
JP2004234318A (en) Two-dimension information code, and display method, generation method and reading method thereof
JP2007122243A (en) Optical information verification device
US11415402B2 (en) Measuring instrument
JP2013030184A (en) Two-dimensional code, two-dimensional code generating method, computer readable program for displaying two-dimensional code, authentication method using two-dimensional code, and information providing method using two-dimensional code
JP7200333B2 (en) Code conversion method
CN106713694A (en) Image reading apparatus and image forming apparatus using the same
US11333480B2 (en) Measuring instrument and measure
US20210216837A1 (en) Measuring instrument and measure
US11120238B2 (en) Decoding color barcodes
JPS6233630B2 (en)
JP2021096235A (en) Measuring unit, measure, and method for manufacturing measure
JP6225595B2 (en) Information code generation method, information code, information code reader, information code utilization system

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20211116

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20220929

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20221004

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20221201

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20221220

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20221221

R150 Certificate of patent or registration of utility model

Ref document number: 7200333

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150