KR20000056840A - Speed detecting system and method thereof - Google Patents

Speed detecting system and method thereof Download PDF

Info

Publication number
KR20000056840A
KR20000056840A KR1019990006538A KR19990006538A KR20000056840A KR 20000056840 A KR20000056840 A KR 20000056840A KR 1019990006538 A KR1019990006538 A KR 1019990006538A KR 19990006538 A KR19990006538 A KR 19990006538A KR 20000056840 A KR20000056840 A KR 20000056840A
Authority
KR
South Korea
Prior art keywords
encoder
clock
interrupt
pulse
buffer
Prior art date
Application number
KR1019990006538A
Other languages
Korean (ko)
Other versions
KR100286043B1 (en
Inventor
유호선
Original Assignee
윤종용
삼성전자 주식회사
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
Application filed by 윤종용, 삼성전자 주식회사 filed Critical 윤종용
Priority to KR1019990006538A priority Critical patent/KR100286043B1/en
Publication of KR20000056840A publication Critical patent/KR20000056840A/en
Application granted granted Critical
Publication of KR100286043B1 publication Critical patent/KR100286043B1/en

Links

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01PMEASURING LINEAR OR ANGULAR SPEED, ACCELERATION, DECELERATION, OR SHOCK; INDICATING PRESENCE, ABSENCE, OR DIRECTION, OF MOVEMENT
    • G01P3/00Measuring linear or angular speed; Measuring differences of linear or angular speeds
    • G01P3/42Devices characterised by the use of electric or magnetic means
    • G01P3/44Devices characterised by the use of electric or magnetic means for measuring angular speed
    • G01P3/48Devices characterised by the use of electric or magnetic means for measuring angular speed by measuring frequency of generated current or voltage
    • G01P3/481Devices characterised by the use of electric or magnetic means for measuring angular speed by measuring frequency of generated current or voltage of pulse signals
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B23MACHINE TOOLS; METAL-WORKING NOT OTHERWISE PROVIDED FOR
    • B23KSOLDERING OR UNSOLDERING; WELDING; CLADDING OR PLATING BY SOLDERING OR WELDING; CUTTING BY APPLYING HEAT LOCALLY, e.g. FLAME CUTTING; WORKING BY LASER BEAM
    • B23K26/00Working by laser beam, e.g. welding, cutting or boring
    • B23K26/08Devices involving relative movement between laser beam and workpiece
    • B23K26/0869Devices involving movement of the laser head in at least one axial direction
    • B23K26/0876Devices involving movement of the laser head in at least one axial direction in at least two axial directions
    • B23K26/0884Devices involving movement of the laser head in at least one axial direction in at least two axial directions in at least in three axial directions, e.g. manipulators, robots
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01DMEASURING NOT SPECIALLY ADAPTED FOR A SPECIFIC VARIABLE; ARRANGEMENTS FOR MEASURING TWO OR MORE VARIABLES NOT COVERED IN A SINGLE OTHER SUBCLASS; TARIFF METERING APPARATUS; MEASURING OR TESTING NOT OTHERWISE PROVIDED FOR
    • G01D5/00Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable
    • G01D5/12Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable using electric or magnetic means
    • G01D5/244Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable using electric or magnetic means influencing characteristics of pulses or pulse trains; generating pulses or pulse trains
    • G01D5/24404Interpolation using high frequency signals

Abstract

PURPOSE: A speed detecting system is provided to detect a revolution speed with a high accuracy by adding an algorithm capable of correcting a variation in data for detecting a speed. CONSTITUTION: A speed detecting system comprises an encoder pulse counter(11), a clock counter(14), an operation part(20) and a memory(21). The encoder pulse counter(11) counts the number of pulses generated by an encoder and stores an encoder pulse counted value on the basis of a predetermine signal. The clock counter(14) has a clock pulse counter(15), an interrupt buffer(16) storing a predetermined interrupt generation cycle, a first buffer(18) storing a clock count value of the clock pulse counter, and a second buffer(19) storing the clock count value of the first buffer. The clock counter(14) generates a speed detection interrupt to the operation part at a predetermined cycle. Upon generation of the speed detection interrupt, the operation part executes the interrupt for calculating a speed on the basis of the interrupt generation cycle, an encoder pulse count value stored in the encoder pulse counter and a value stored in the first buffer, and calculates the speed using a clock count value stored in the second buffer instead of the clock count value stored in the first buffer when a new encoder pulse is generated by the encoder during an execution time starting from the point of time of generation of the speed detection interrupt to a point of time of actual execution of the interruption.

Description

속도검출 시스템 및 그 방법{speed detecting system and method thereof}Speed detecting system and method

본 발명은, 속도검출시스템 및 그 방법에 관한 것으로, 특히 속도검출센서로서 엔코더를 구비한 속도검출시스템 및 그 방법에 관한 것이다.The present invention relates to a speed detection system and a method thereof, and more particularly, to a speed detection system having an encoder as a speed detection sensor and a method thereof.

기존의 서보 모터 드라이버나 벡터제어 인버터 등 엔코더가 부착되어 있는 모터의 고성능 제어시스템에서는 고정밀도(high precision)의 회전속도검출을 위하여 연산부(CPU)의 외부에 별도의 하드웨어칩으로서 ASIC(application-specific integrated circuit)을 추가로 탑재하여 속도검출기능을 전담하도록 하였다. 여기서 ASIC이란 특별한 목적을 위해 디자인된 칩의 일종으로, 일정한 기능을 갖고 대량생산되어 널리 사용되는 범용칩에 대응된다.In the high performance control system of a motor with an encoder such as a conventional servo motor driver or a vector control inverter, an ASIC (application-specific) is provided as a separate hardware chip outside the computation unit (CPU) for high precision rotational speed detection. An additional integrated circuit is dedicated to the speed detection function. The ASIC is a kind of chip designed for a special purpose and corresponds to a general purpose chip which has a certain function and is mass produced and widely used.

도 1은 종래 ASIC을 이용하여 모터의 회전속도를 검출하는 속도검출시스템의 제어블럭도이다. 도시된 바와 같이, 종래의 속도검출시스템은 모터의 회전축에 동축적으로 결합된 엔코더(1)와, 엔코더(1)로부터 발생하는 펄스(A,B)와 외부클럭으로부터 클럭펄스를 수신하는 ASIC부(3), 및 ASIC부(3)으로부터 인터럽트요구와 속도검출에 필요한 데이터를 수신하는 연산부(CPU)(5)를 포함한다.1 is a control block diagram of a speed detection system for detecting a rotational speed of a motor using a conventional ASIC. As shown, the conventional speed detection system includes an encoder 1 coaxially coupled to a rotation axis of a motor, an ASIC unit for receiving clock pulses from external clocks and pulses A and B generated from the encoder 1. (3) and an arithmetic unit (CPU) 5 for receiving data required for interrupt request and speed detection from the ASIC unit 3.

엔코더(1)는 모터의 회전속도를 검출하기 위해 널리 사용되는 것으로, 모터의 회전속도에 비례하는 수의 펄스(A,B)를 발생시킨다. 모터의 회전속도검출을 위해서는, 소정시간동안 엔코더로부터 발생된 펄스의 수를 계수하거나 펄스의 발생간격을 측정하는 방법이 통상 사용되는 바, ASIC(3)은 외부의 클럭신호를 입력받아 소정시간(t)동안 엔코더(1)로부터 발생되는 펄스(A,B)의 수를 계수하거나, 펄스(A,B)의 발생간격을 측정하여, 모터의 회전속도검출에 필요한 데이터인 시간(t)과 이 시간(t)동안에 엔코더(3)로부터 발생된 펄스 수(m), 및 속도검출을 위한 인터럽트 요구를 연산부로 송신한다. ASIC(3)으로부터 속도검출을 위한 인터럽트 요구를 수신한 연산부(5)는 현재 진행중인 작업을 일시 중단하고 인터럽트로부터 지정된 장소로 분기하여 속도검출 인터럽트를 실행한다.The encoder 1 is widely used to detect the rotational speed of a motor and generates a number of pulses A and B proportional to the rotational speed of the motor. In order to detect the rotational speed of the motor, a method of counting the number of pulses generated from the encoder or measuring the interval of pulse generation for a predetermined time is commonly used. The ASIC 3 receives an external clock signal and receives a predetermined time ( During t), the number of pulses A and B generated from the encoder 1 is counted, or the intervals between the pulses A and B are measured, and time t, which is data necessary for detecting the rotational speed of the motor, The number of pulses m generated from the encoder 3 during the time t, and the interrupt request for speed detection are sent to the calculation unit. Receiving an interrupt request for speed detection from the ASIC 3, the calculation unit 5 suspends the current work in progress and branches from the interrupt to the designated place to execute the speed detection interrupt.

그러나, 위와 같은 속도검출방법은 다음과 같은 문제점을 갖는다.However, the above speed detection method has the following problems.

먼저, 소정시간동안 펄스 수를 계수하여 속도를 검출하는 방법은 모터의 속도가 저속일 때 엔코더로부터 입력되는 펄스 수가 적어서 속도검출의 정밀도가 낮아 신뢰성을 보장할 수 없게 된다. 이를 극복하기 위해 계수시간을 늘리면, 속도검출 간격이 넓어지게 되어 특히 고속운전시 모터의 제어응답이 늦어지게 된다. 엔코더의 1회전 당 발생펄스 수는 엔코더 제작시 결정되는 것으로 발생펄스 수가 많을수록 가격이 높을뿐더러 이의 증가는 엔코더의 특성상 한계를 갖는다.First, in the method of detecting the speed by counting the number of pulses for a predetermined time, since the number of pulses input from the encoder is small when the speed of the motor is low, the accuracy of speed detection is low and reliability cannot be guaranteed. If the counting time is increased to overcome this, the speed detection interval becomes wider, and the control response of the motor is slowed, especially during high speed operation. The number of pulses generated per one revolution of the encoder is determined when the encoder is manufactured. The higher the number of pulses generated, the higher the price, and the increase thereof has a limitation due to the characteristics of the encoder.

또한, 펄스간격측정방법에 있어서는, 모터의 고속회전시 발생펄스의 간격이 매우 좁아지게 되므로 계수되는 클럭펄스의 간격은 상대적으로 넓어지게 되어 이에 의해 계수되어 측정되는 펄스간격은 오차가 크고 따라서 검출된 속도의 정밀도가 낮아지게 된다.In addition, in the pulse interval measuring method, the spacing of pulses generated during high speed rotation of the motor becomes very narrow, so that the interval of the counted clock pulses becomes relatively wide, whereby the pulse interval measured and counted is large in error and thus detected. The precision of the speed is lowered.

이러한 문제점을 해결하기 위한 방법들 중 하나로서 미국특허No.4,584,528에서는 속도검출을 위한 펄스계수시간값을 구하는데 있어 속도검출인터럽트 발생주기로부터 소정시간을 가감하여 펄스의 발생시점(예를 들면, 상승에지)에서부터 마지막 펄스의 발생시점까지의 시간값을 사용하며, 설정된 인터럽트발생주기가 모터의 회전속도에 따라 변경될 수 있게 함으로써 속도검출의 정밀도를 높인 속도검출방법을 개시하고 있다.As one of the methods to solve this problem, U.S. Patent No. 4,584,528 shows a pulse count time value for speed detection by adding or subtracting a predetermined time from the speed detection interrupt generation period (for example, rising). A speed detection method is disclosed which increases the accuracy of speed detection by using the time value from the edge) to the time of the last pulse generation and by allowing the set interrupt generation period to be changed according to the rotational speed of the motor.

그러나, 상기와 같은 방법 역시 ASIC을 이용하여 구현된 것이므로, ASIC칩의 설계, 제작, 관리에 많은 비용이 소요된다. 또한, ASIC칩의 추가탑재에는 상당한 공간이 필요하므로 하드웨어의 소형화에 한계를 갖는다.However, the above-described method is also implemented using the ASIC, so that the design, manufacture, and management of the ASIC chip is expensive. In addition, the additional mounting of the ASIC chip requires considerable space, which limits the miniaturization of hardware.

또한, ASIC에 입력되는 외부클럭펄스에 의해 엔코더로부터 발생되는 펄스 간격을 계수하여 측정하며, 이 클럭주파수는 데이터의 정밀도에 비례하므로 1MHz 정도의 고주파 외부 클럭이 추가로 필요하다. 그러나, 클럭주파수가 높을수록 계수할 카운터의 비트수가 동시에 증가하게 되므로 카운터 구현비용이 상승하게 된다.In addition, the pulse interval generated from the encoder is counted and measured by an external clock pulse input to the ASIC. Since this clock frequency is proportional to the precision of data, an additional high frequency external clock of about 1 MHz is required. However, as the clock frequency increases, the counter implementation cost increases because the number of bits of the counter to be counted increases simultaneously.

한편, 모터의 회전속도 검출시스템을 구현하기 위해 ASIC을 사용함으로 인한 상술한 바와 같은 문제점을 해결하기 위해, 별도의 ASIC을 탑재하지 않고, 다종 양산되어 판매되는 원칩콘트롤러(one-chip controller)를 사용하여 연산부 내에서 직접 엔코더펄스를 처리할 수 있는 방법이 제안되고 있다.On the other hand, to solve the problems as described above by using the ASIC to implement the rotational speed detection system of the motor, using a one-chip controller sold in mass production without a separate ASIC mounted Has been proposed to process encoder pulses directly in arithmetic unit.

그러나, 일정한 주기로 속도검출인터럽트가 발생하여 실제로 연산부에 의해 상기 속도검출인터럽트가 실행되기까지의 이행시간동안에 엔코더로부터 또 다른 펄스가 발생되어 연산부의 속도연산을 위한 데이터에 오차가 발생될 수 있다. 모터가 고속으로 회전하면 엔코더로부터 발생되는 펄스의 주파수는 높아지고 따라서 상기 이행시간 내에 엔코더로부터 펄스가 발생될 가능성은 더욱 커진다. 모터가 저속으로 회전하면 상기 이행시간 내에 엔코더로부터 펄스가 발생될 가능성은 낮아지지만, 상기 펄스의 주파수가 낮으므로 속도감지를 위한 데이터의 오차는 더욱 커지게 된다.However, another pulse may be generated from the encoder during the transition time until the speed detection interrupt occurs at a constant cycle until the speed detection interrupt is actually executed by the calculation unit, thereby causing an error in data for speed calculation of the calculation unit. When the motor rotates at a high speed, the frequency of the pulses generated from the encoder is increased, thus increasing the possibility that pulses are generated from the encoder within the transition time. When the motor rotates at a low speed, the possibility of generating a pulse from the encoder within the transition time is low, but the frequency of the pulse is low, so that the error of the data for speed detection becomes larger.

그러나, 이러한 경우가 고려되어 있지 않아, 즉 데이터 상의 오차를 보상하지 않고 그대로 사용함으로써 정확한 속도값을 얻을 수 없게 되고, 따라서 이에 기초한 모터의 제어는 불안정하고 부정확해지는 문제점이 있다.However, such a case is not taken into consideration, i.e., it is impossible to obtain an accurate speed value by using it as it is without compensating for errors in the data, and thus there is a problem that control of the motor based thereon becomes unstable and inaccurate.

따라서, 본 발명의 목적은, 속도검출인터럽트 발생시점에서부터 실제 실행시점 사이에 엔코더로부터 펄스가 입력되어 속도검출을 위한 데이터에 변화가 발생되는 경우 이를 보정할 수 있는 알고리즘을 부가함으로써 높은 정밀도의 회전속도를 검출할 수 있는 속도검출시스템을 제공하는 것이다.Accordingly, an object of the present invention is to provide a high-precision rotational speed by adding an algorithm that can correct a change in data for speed detection by inputting a pulse from an encoder between a speed detection interrupt occurrence and an actual execution time. It is to provide a speed detection system capable of detecting.

본 발명의 다른 목적은, 원칩콘트롤러에 구현되어 비용절감과 회로설계의 단순화 및 이에 따른 부피감소를 도모할 수 있으며, 필요에 따라 사양변경이 용이한 속도검출시스템을 제공하는 것이다.Another object of the present invention is to provide a speed detection system that can be implemented in a one-chip controller to reduce costs, simplify circuit design, and thereby volume, and easily change specifications as necessary.

도 1은 종래 ASIC을 이용하여 회전속도를 검출하는 속도검출시스템의 제어블럭도,1 is a control block diagram of a speed detection system for detecting a rotation speed using a conventional ASIC,

도 2는 본 발명에 따른 원칩콘트롤러에 구현된 속도검출시스템의 주요부,2 is a main part of a speed detection system implemented in a one-chip controller according to the present invention;

도 3은 엔코더로부터 발생한 엔코더펄스와 엔코더펄스카운터 및 클럭펄스카운터의 타임블럭도,3 is a time block diagram of an encoder pulse generated from an encoder, an encoder pulse counter, and a clock pulse counter.

도 4는 연산부(20)의 속도연산과정을 나타낸 순서도,4 is a flow chart showing a speed calculation process of the calculation unit 20,

도 5는 이행시간(Δt) 내에 새로운 엔코더펄스가 수신되는 경우의 엔코더펄스카운터(12)와 클럭펄스카운터(15)의 타임블럭도이다.5 is a time block diagram of the encoder pulse counter 12 and the clock pulse counter 15 when a new encoder pulse is received within the transition time [Delta] t.

〈도면의 주요 부분에 대한 부호의 설명〉<Explanation of symbols for main parts of drawing>

1 : 엔코더 3 : ASIC1: Encoder 3: ASIC

5 : 연산부 10 : 에지검파회로5: calculation unit 10: edge detection circuit

12 : 엔코더펄스 카운터 13 : 엔코더펄스 버퍼12: encoder pulse counter 13: encoder pulse buffer

15 : 클럭펄스 카운터 16 : 인터럽트 버퍼15: Clock pulse counter 16: Interrupt buffer

18 : 제 1버퍼 19 : 제 2버퍼18: first buffer 19: second buffer

20 : 연산부 21 : 메모리20: calculator 21: memory

상기 목적은, 본 발명에 따라, 엔코더를 구비한 속도검출시스템에 있어서, 상기 엔코더로부터 발생되는 엔코더펄스의 수를 계수하는 엔코더펄스카운터와; 소정 주기로 속도검출인터럽트가 발생되면 그 시점에서의 상기 엔코더펄스카운터의 계수값을 저장하는 엔코더펄스버퍼와; 소정 클럭발생기로부터의 클럭펄스를 계수하는 클럭펄스카운터와; 상기 엔코더로부터 엔코더펄스발생신호가 수신되면 그 시점의 상기 클럭펄스카운터의 클럭계수값을 저장하는 제 1버퍼와; 상기 엔코더펄스발생신호가 수신되면 그 시점의 상기 제 1버퍼에 저장된 상기 클럭계수값을 수신받아 저장하는 제 2버퍼와; 상기 속도검출인터럽트가 발생되었을 때, 상기 인터럽트 발생주기, 상기 엔코더카운터버퍼에 저장된 엔코더펄스계수값 및 상기 제 1버퍼에 저장된 값에 기초하여 속도를 연산하는 상기 인터럽트를 실행하며, 상기 속도검출인터럽트의 발생시점에서부터 상기 속도검출인터럽트의 실행시점까지의 이행시간내에 상기 엔코더로부터 새로운 엔코더펄스가 발생되는 경우에는 상기 제 1버퍼에 저장된 클럭계수값 대신에 상기 제 2버퍼에 저장된 클럭계수값을 사용하여 속도를 연산하는 연산부를 포함하는 것을 특징으로 하는 속도검출시스템에 의하여 달성된다.According to the present invention, there is provided a speed detection system having an encoder, comprising: an encoder pulse counter for counting the number of encoder pulses generated from the encoder; An encoder pulse buffer that stores the coefficient value of the encoder pulse counter at the time when a speed detection interrupt occurs at a predetermined period; A clock pulse counter for counting clock pulses from a predetermined clock generator; A first buffer for storing a clock coefficient value of the clock pulse counter at the time when an encoder pulse generation signal is received from the encoder; A second buffer for receiving and storing the clock coefficient value stored in the first buffer at the time when the encoder pulse generation signal is received; When the speed detection interrupt occurs, the interrupt for calculating the speed is executed based on the interrupt generation period, the encoder pulse coefficient value stored in the encoder counter buffer, and the value stored in the first buffer, and the speed detection interrupt is executed. When a new encoder pulse is generated from the encoder within the transition time from the occurrence time to the execution time of the speed detection interrupt, the speed is stored using the clock coefficient value stored in the second buffer instead of the clock coefficient value stored in the first buffer. It is achieved by the speed detection system, characterized in that it comprises a calculation unit for calculating the.

여기서, 상기 클럭펄스카운터는 상기 연산부클럭발생기에 따라 동작하거나, 상기 클럭펄스카운터를 위한 클럭발생기를 더 포함하여 상기 클럭발생기에 따라 동작 하는 것이 바람직하며, 상기 엔코더로부터 발생되는 엔코더펄스는 에지감지회로를 통해 상승에지(rising edge)를 검파하여 계수하는 것이 효과적이다.Here, the clock pulse counter operates according to the operation clock generator, or further comprising a clock generator for the clock pulse counter to operate according to the clock generator, the encoder pulse generated from the encoder edge detection circuit It is effective to detect and count the rising edge through.

그리고, 상기 연산부는 다음의 수학식에 의해서 속도(V)를 계산한다.And, the calculating unit calculates the speed (V) by the following equation.

여기서, Tc는 인터럽트 발생주기, Tk-1은 k-1번째 인터럽트 발생시점 이전에 상기 엔코더로부터 발생된 마지막 펄스입력시점에서부터 k번째 인터럽트 발생시점까지의 시간, Tk는 k번째 인터럽트 발생시점 이전에 상기 엔코더로부터 발생된 마지막 펄스입력시점에서부터 k+1번째 인터럽트 발생시점까지의 시간, m은 상기 인터럽트 발생주기동안 상기 엔코더로부터 발생된 펄스의 수, k는 비례상수이다. 이하 동일한 기호는 동일한 의미를 가지므로 중복된 설명을 생략한다.Here, T c is the interrupt generation period, T k-1 is the time from the last pulse input generated from the encoder to the k-th interrupt occurrence before the k-1 th interrupt occurs, and T k is the k th interrupt generated The time from the last pulse input point previously generated from the encoder to the k + 1th interrupt occurrence point, m is the number of pulses generated from the encoder during the interrupt generation period, and k is a proportional constant. Hereinafter, the same symbols have the same meanings, and thus redundant descriptions are omitted.

또한, 상기 목적은, 본 발명에 따라, 엔코더를 구비한 속도검출시스템에 의한 속도검출방법에 있어서, 상기 엔코더로부터 발생되는 엔코더펄스의 수를 계수하는 단계; 소정 주기로 속도검출인터럽트를 발생시키는 단계; 상기 속도검출인터럽트 발생시점에서의 상기 엔코더펄스계수값을 저장하는 단계; 소정 클럭발생기로부터의 클럭펄스를 계수하는 단계; 상기 엔코더로부터 엔코더펄스발생신호가 수신되면 그 시점의 상기 클럭계수값을 저장하는 단계; 상기 엔코더펄스발생신호가 수신되면 저장된 상기 클럭계수값을 수신받아 저장하는 단계; 상기 속도검출인터럽트가 발생되었을 때, 상기 인터럽트 발생주기, 상기 엔코더카운터버퍼에 저장된 엔코더펄스계수값 및 상기 제 1버퍼에 저장된 값에 기초하여 속도를 연산하는 상기 인터럽트를 실행하며, 상기 속도검출인터럽트의 발생시점에서부터 상기 속도검출인터럽트의 실행시점까지의 이행시간내에 상기 엔코더로부터 새로운 엔코더펄스가 발생되는 경우에는 상기 제 1버퍼에 저장된 클럭계수값 대신에 상기 제 2버퍼에 저장된 클럭계수값을 사용하여 속도를 연산하는 단계를 포함하는 것을 특징으로 하는 속도검출방법에 의해서도 달성된다.In addition, the above object, according to the present invention, in the speed detection method by a speed detection system having an encoder, comprising the steps of: counting the number of encoder pulses generated from the encoder; Generating a speed detection interrupt at a predetermined period; Storing the encoder pulse coefficient value at the time of occurrence of the speed detection interrupt; Counting clock pulses from a predetermined clock generator; Storing the clock coefficient value at that time when an encoder pulse generation signal is received from the encoder; Receiving and storing the stored clock coefficient value when the encoder pulse generation signal is received; When the speed detection interrupt occurs, the interrupt for calculating the speed is executed based on the interrupt generation period, the encoder pulse coefficient value stored in the encoder counter buffer, and the value stored in the first buffer, and the speed detection interrupt is executed. When a new encoder pulse is generated from the encoder within the transition time from the occurrence time to the execution time of the speed detection interrupt, the speed is stored using the clock coefficient value stored in the second buffer instead of the clock coefficient value stored in the first buffer. It is also achieved by a speed detection method comprising the step of calculating a.

여기서, 상기 클럭발생기는 연산부클럭발생기와 상기 클럭펄스카운터를 위한 클럭발생기 중 어느 하나이다.Here, the clock generator is any one of a clock generator for the calculator and a clock generator for the clock pulse counter.

또한, 상기 엔코더로부터 발생되는 엔코더펄스를 계수하는 단계는 소정 에지감지회로를 통해 상승에지(rising edge)를 검파하여 계수하는 것이 바람직하다.In the counting of encoder pulses generated from the encoder, it is preferable to detect and count a rising edge through a predetermined edge detection circuit.

그리고, 상기 속도(V)를 연산하는 단계는 다음의 (수학식 1)에 의한다.And, the step of calculating the speed (V) is by the following equation (1).

V=k*m/(Tc+Tk-1-Tk)V = k * m / (T c + T k-1 -T k )

본 발명에 따른 속도검출시스템을 구현하기 위해서는 내부에 주변기기(peripheral device)로서 타이머와 카운터유닛이 구비된 원칩콘트롤러가 필요한 바, 최근에 널리 사용되는 원칩콘트롤러는 대부분 이러한 사양을 만족하고 있다. 본 실시예에서는 히다찌(Hitachi)사의 SH704X모델의 원칩콘트롤러를 사용하여 속도검출시스템을 구현하였다.In order to implement the speed detection system according to the present invention, a one-chip controller equipped with a timer and a counter unit as a peripheral device is required. Most recently used one-chip controllers satisfy these specifications. In this embodiment, a speed detection system was implemented using a one-chip controller of Hitachi's SH704X model.

이하에서는 첨부도면을 참조하여 본 발명에 대해 상세히 설명한다.Hereinafter, the present invention will be described in detail with reference to the accompanying drawings.

도 2는 본 발명에 따른 원칩콘트롤러에 구현된 속도검출시스템의 주요부이고 도 3은 엔코더로부터 발생한 엔코더펄스와 엔코더펄스카운터 및 클럭펄스카운터의 타임블럭도이다.2 is an essential part of a speed detection system implemented in a one-chip controller according to the present invention, and FIG. 3 is a time block diagram of an encoder pulse, an encoder pulse counter, and a clock pulse counter generated from an encoder.

본 발명에 따른 속도검출시스템은, 엔코더로부터 발생된 펄스(A,B)를 계수하고 소정신호에 기초하여 엔코더펄스계수값(m)을 저장하는 엔코더펄스카운터부(11)와, 소정 클럭펄스를 계수하고 엔코더펄스(A,B)의 입력신호에 기초하여 엔코더펄스(A,B)입력시점을 저장하며 연산부(CPU)(20)에 소정주기로 속도검출인터럽트를 발생하는 클럭카운터부(14), 소정 데이터에 기초하여 모터의 회전속도를 연산하는 연산부(20) 및 소정 데이터를 저장하는 메모리(21)를 포함한다.The speed detection system according to the present invention includes an encoder pulse counter unit 11 for counting pulses A and B generated from an encoder and storing an encoder pulse coefficient value m based on a predetermined signal, and a predetermined clock pulse. A clock counter unit 14 for counting and storing the encoder pulse (A, B) input points based on the input signals of the encoder pulses (A, B) and generating a speed detection interrupt at a predetermined period in the calculation unit (CPU) 20, It includes a calculation unit 20 for calculating the rotational speed of the motor based on the predetermined data and a memory 21 for storing the predetermined data.

엔코더펄스카운터부(11)는 엔코더로부터 발생된 펄스(A,B)를 입력받아 에지를 검파하여 입력시점을 감지하는 에지검파회로(10)와, 상기 에지검파회로(10)로부터의 펄스입력신호에 기초하여 펄스(A,B)의 수를 계수하는 엔코더펄스카운터(12)와, 소정의 명령에 따라 그 순간의 엔코더펄스카운터(12)의 펄스계수값을 저장하는 엔코더펄스버퍼(13)를 포함한다.The encoder pulse counter unit 11 receives the pulses A and B generated from the encoder and detects an edge to detect an input time point, and a pulse input signal from the edge detection circuit 10. The encoder pulse counter 12 for counting the number of pulses A and B on the basis of the encoder, and the encoder pulse buffer 13 for storing the pulse coefficient value of the encoder pulse counter 12 at that moment in accordance with a predetermined command. Include.

또한, 클럭카운터부(14)는 소정 클럭펄스를 계수하는 클럭펄스카운터(15)와, 소정인터럽트 발생주기를 저장하는 인터럽트버퍼(16)와, 에지검파회로(10)로부터의 신호에 기초하여 클럭펄스카운터(15)의 클럭계수값을 저장하는 제 1버퍼(18), 및 에지검파회로(10)로부터의 신호에 기초하여 제 1버퍼(18)의 클럭계수값을 저장하는 제 2버퍼(19)를 포함한다.The clock counter unit 14 further includes a clock pulse counter 15 that counts a predetermined clock pulse, an interrupt buffer 16 that stores a predetermined interrupt generation period, and a clock based on a signal from the edge detection circuit 10. A first buffer 18 for storing the clock coefficient value of the pulse counter 15, and a second buffer 19 for storing the clock coefficient value of the first buffer 18 based on a signal from the edge detection circuit 10; ).

이상과 같은 구성에 의하여, 모터가 회전하면 모터의 회전축에 동축적으로 결합된 엔코더(도시 않음)로부터 모터의 회전속도에 비례하여 펄스(A,B)가 발생한다. 통상 엔코더는 2개의 서로 다른 위상을 갖는 펄스(A,B)를 발생시키는데, 그 중 하나의 펄스를 통해 속도의 절대값을 검출하며, 양 펄스의 위상차를 통해 회전방향을 감지한다. 엔코더로부터 발생된 펄스(A,B)는 에지검파회로(10)로 입력된다. 에지검파회로(10)는 펄스의 상승에지를 검파하여 펄스입력시점(a)을 검파해낸다. 물론, 에지검파회로(10)는 펄스의 하강에지를 검파하여 펄스입력시점을 검파해낼 수도 있다.With the above configuration, when the motor rotates, pulses A and B are generated in proportion to the rotational speed of the motor from an encoder (not shown) coaxially coupled to the rotational axis of the motor. Normally, the encoder generates pulses A and B having two different phases, one of which detects the absolute value of the speed, and detects the rotation direction through the phase difference of both pulses. Pulses A and B generated from the encoder are input to the edge detection circuit 10. The edge detection circuit 10 detects the rising edge of the pulse to detect the pulse input time point a. Of course, the edge detection circuit 10 may detect the falling edge of the pulse to detect the point of pulse input.

에지검파회로(10)는 펄스입력시점(a)을 알리는 신호를 엔코더펄스카운터(12)와 제 1버퍼(18) 및 제 2버퍼(19)로 송신한다. 펄스입력시점(a)을 알리는 신호가 입력되면 엔코더펄스카운터(12)는 펄스입력수를 계수한다. 이 때, 펄스입력수는 모터의 회전속도에 비례하므로, 모터가 고속으로 회전하면 펄스입력수는 증가하게 되고 저속으로 회전하면 감소하게 된다.The edge detection circuit 10 transmits a signal informing the pulse input time a to the encoder pulse counter 12, the first buffer 18, and the second buffer 19. When a signal informing the pulse input time a is input, the encoder pulse counter 12 counts the number of pulse inputs. At this time, since the number of pulse inputs is proportional to the rotational speed of the motor, the number of pulse inputs increases when the motor rotates at high speed, and decreases when rotated at low speed.

한편, 엔코더펄스카운터(12)는 모터가 회전함에 따라 이에 동기하여 원칩콘트롤러에 내장된 내부클럭을 계수한다. 본 실시예에서 사용된 히다찌(Hitachi)사의 원칩콘트롤러인 SH704X는 28,636MHz의 시스템클럭을 내장하고 있다. 그러나, 내부클럭 대신 모터회전속도범위에 따라 적절한 외부클럭을 사용할 수도 있다.Meanwhile, the encoder pulse counter 12 counts the internal clock embedded in the one chip controller in synchronization with the rotation of the motor. Hitachi's one-chip controller SH704X used in this example contains a system clock of 28,636 MHz. However, an appropriate external clock may be used depending on the motor speed range instead of the internal clock.

에지검파회로(10)로부터 엔코더에서 발생된 펄스입력신호가 수신되면 펄스입력시점(a)의 클럭펄스카운터(15)에 의해 계수된 클럭계수값이 제 1버퍼(18)에 저장된다. 에지검파회로(10)로부터 다음 펄스입력신호가 수신되면 그 펄스입력시점(b)의 클럭펄스카운터(15)의 클럭계수값이 제 1버퍼(18)에 새로이 저장되고, 제 1버퍼(18)에 저장되었던 클럭값은 제 2버퍼(19)로 시프트되어 제 2버퍼(19)에 저장된다. 마찬가지로, 에지검파회로(10)로부터 다음 펄스입력신호가 수신되면 그 펄스입력시점(c)의 클럭펄스카운터(15)의 클럭계수값은 다시 제 1버퍼(18)에 저장되고, 제 1버퍼에 기저장되어 있던 클럭값은 제 2버퍼(19)로 시프트되는 과정을 반복하게 된다.When the pulse input signal generated by the encoder is received from the edge detection circuit 10, the clock coefficient value counted by the clock pulse counter 15 at the pulse input time a is stored in the first buffer 18. When the next pulse input signal is received from the edge detection circuit 10, the clock coefficient value of the clock pulse counter 15 at the pulse input time point (b) is newly stored in the first buffer 18, and the first buffer 18 The clock value that was stored in is shifted to the second buffer 19 and stored in the second buffer 19. Similarly, when the next pulse input signal is received from the edge detection circuit 10, the clock coefficient value of the clock pulse counter 15 at the pulse input time point c is stored in the first buffer 18 again and stored in the first buffer. The previously stored clock value is repeated the process of shifting to the second buffer (19).

한편, 인터럽트버퍼(16)에는 소정의 속도검출인터럽트발생주기(Tc)가 저장되어 있다. 따라서, 클럭펄스카운터(15)의 클럭계수값이 인터럽트버퍼(16)에 저장된 속도검출인터럽트 발생주기(Tc)에 이르게 되면 리셋됨과 동시에 엔코더펄스버퍼(13)에 엔코더펄스카운터(12)의 펄스계수값(m)을 저장하도록 하는 신호를 송신하고, 연산부(20)에 속도검출인터럽트를 발생한다.On the other hand, the interrupt buffer 16 stores a predetermined speed detection interrupt generation period T c . Therefore, when the clock coefficient value of the clock pulse counter 15 reaches the speed detection interrupt generation period T c stored in the interrupt buffer 16, the clock pulse counter 15 is reset and pulses of the encoder pulse counter 12 are applied to the encoder pulse buffer 13. A signal for storing the count value m is transmitted, and a speed detection interrupt is generated in the calculation unit 20.

엔코더펄스카운터의 계수값을 저장을 명령하는 신호를 수신받은 엔코더펄스버퍼(13)는 그 시점의 엔코더펄스카운터(12)의 펄스계수값(m) 을 저장하며, 속도검출인터럽트를 발생받은 연산부(20)는 정확한 모터 회전속도 연산을 위해, 엔코더펄스의 상승에지에서부터 상승에지까지의 소요시간(Tc-Tk+Tk-1)과 이시간 동안에 계수된 펄스의 수(m, 상승에지의 수)를 기초로 속도연산을 수행한다. 이를 위해 필요한 데이터는, 엔코더펄스버퍼(13)에 저장되어 있는, 속도검출인터럽트 발생주기(Tc) 동안 엔코더로부터 발생한 펄스의 수(m)와, 제 1버퍼(18)에 저장되어 있는, 속도검출인터럽트 발생시점이전에 마지막으로 발생된 엔코더펄스의 입력시점(e)의 클럭계수값(cpo), 및 인터럽트버퍼(16)에 저장되어 있는 속도검출인터럽트 발생주기(Tc)이다.The encoder pulse buffer 13 that receives the signal for commanding the count of the encoder pulse counter stores the pulse coefficient value m of the encoder pulse counter 12 at that time, and receives an operation unit that receives the speed detection interrupt ( 20) shows the time required from the rising edge of the encoder pulse to the rising edge (T c -T k + T k-1 ) and the number of pulses counted during this time (m, Perform speed calculation based on The data necessary for this are the number of pulses (m) generated from the encoder during the speed detection interrupt generation period T c stored in the encoder pulse buffer 13 and the speed stored in the first buffer 18. The clock coefficient value cpo of the input point e of the encoder pulse last generated before the detection interrupt occurrence time, and the speed detection interrupt generation period T c stored in the interrupt buffer 16.

그런데, 연산부(20)가 속도검출인터럽트 발생에 따라 속도검출인터럽트의 실행, 즉 속도연산을 하기 위해서는 현재 수행중인 작업을 중단하고 속도검출인터럽트가 지정한 지점으로 분기하여 상기 필요한 데이터를 독출하여 이에 기초하여 속도검출인터럽트를 실행하여야 한다. 따라서, 속도검출인터럽트 발생시점에서부터 실행시점까지는 수μsec 내외의 이행시간(Δt)가 필요하다.However, in order to execute the speed detection interrupt, that is, speed calculation according to the speed detection interrupt occurrence, the operation unit 20 interrupts the current work, branches to the point designated by the speed detection interrupt, and reads out the necessary data based on this. Speed detection interrupt must be executed. Therefore, a transition time [Delta] t of several μsec is required from the time of the speed detection interrupt occurrence to the execution time.

그러나, 상기 이행시간(Δt) 내에 새로운 엔코더펄스가 수신되면, 이 펄스의 입력시점이 제 1버퍼(18)에 저장되고, 제 1버퍼(18)에 기저장되었던 값은 제2버퍼(19)로 시프트되므로, 이러한 경우 연산부(20)가 독출하여야할 데이터의 위치가 상기 이행시간(Δt) 내에 새로운 엔코더펄스가 수신되지 않은 경우와 달라지게 된다.However, when a new encoder pulse is received within the transition time [Delta] t, the input point of the pulse is stored in the first buffer 18, and the value previously stored in the first buffer 18 is stored in the second buffer 19. In this case, the position of data to be read by the calculator 20 is different from the case where a new encoder pulse is not received within the transition time Δt.

따라서, 연산부(20)는 속도연산을 실행하기에 앞서 먼저 상기 이행시간(Δt) 내에 엔코더펄스가 입력되었는지 여부를 판단하여야 한다.Therefore, the calculation unit 20 must first determine whether or not the encoder pulse is input within the transition time Δt before performing the speed calculation.

도 4는 연산부(20)의 속도연산과정을 나타낸 순서도이다.4 is a flowchart illustrating a speed calculating process of the calculating unit 20.

연산부(20)는 상기 이행시간(Δt) 내에 새로운 엔코더펄스가 입력되었는지 여부를 판단하기 위해 엔코더펄스카운터(12)에 엑세스하여 엔코더펄스카운터값(12)을 첵크한다(100). 앞서 살펴본 바와 같이, 새로운 엔코더펄스가 수신되었는지 여부는 속도검출인터럽트가 발생됨과 동시에 엔코더펄스카운터(12)가 리셋된다는 사실로부터 알 수 있다. 즉, 상기 이행시간 내에 엔코더펄스가 수신되지 않으면 엔코더펄스계수값은 리셋상태를 그대로 유지하고 있으므로 0이지만, 엔코더펄스가 수신되면 엔코더펄스카운터(12)는 이를 계수하고 따라서 엔코더펄스계수값은 1이 된다.The calculation unit 20 accesses the encoder pulse counter 12 to check whether the encoder pulse counter 12 is input within the transition time Δt (100). As discussed above, whether or not a new encoder pulse has been received can be seen from the fact that the encoder pulse counter 12 is reset at the same time as the speed detection interrupt is generated. That is, if the encoder pulse is not received within the transition time, the encoder pulse coefficient value is 0 since the reset state is maintained. However, when the encoder pulse is received, the encoder pulse counter 12 counts it and thus the encoder pulse coefficient value is 1 do.

따라서, 엔코더펄스계수값이 0인 경우에는 엔코더펄스버퍼(13)에 저장된 엔코더펄스계수값(m)과, 제 1버퍼에 저장된 엔코더펄스의 클럭계수값(cpo)를 독출한다(101).Therefore, when the encoder pulse coefficient value is 0, the encoder pulse coefficient value m stored in the encoder pulse buffer 13 and the clock coefficient value cpo of the encoder pulse stored in the first buffer are read (101).

이어, 연산부(20)는 인터럽트발생주기(Tc)로부터 클럭계수값(cpo)을 빼서 Tk값을 구한 후(104), 메모리(21)에 저장되어 있는 바로 직전의 인터럽트 발생주기에서 속도연산에 사용했던 Tk-1값을 독출한다(107).Subsequently, the calculation unit 20 calculates the T k value by subtracting the clock coefficient value cpo from the interrupt generation period T c (104), and then calculates the speed in the immediately preceding interrupt generation period stored in the memory 21. Read the T k-1 value used in step 107.

다음으로, 연산부(20)는 다음의 수학식1을 이용하여 모터의 속도(V)를 연산한다(108).Next, the calculating unit 20 calculates the speed V of the motor by using Equation 1 below (108).

여기서 k는 비례상수로서, 모터의 동특성, 정특성, 및 응답특성 등에 따라 달라진다.Where k is a proportionality constant and varies depending on the dynamic, static and response characteristics of the motor.

속도 연산이 끝난 연산부(20)는 이어지는 다음단계의 인터럽트주기에서의 속도 연산을 위해 Tk값을 메모리에 저장한다(109).The speed calculating end operation unit 20 stores the T k value in the memory for speed calculation in the next interrupt cycle of the next step (109).

이행시간(Δt) 내에 새로운 엔코더펄스가 수신되는 경우, 즉, 엔코더펄스카운터의 펄스계수값이 1인 경우에 있어서 연산부의 속도연산은 다음과 같다.When a new encoder pulse is received within the transition time [Delta] t, that is, when the pulse coefficient value of the encoder pulse counter is 1, the speed calculation of the calculation unit is as follows.

도 5는 이행시간(Δt) 내에 새로운 엔코더펄스가 수신되는 경우의 엔코더펄스카운터(12)와 클럭펄스카운터(15)의 타임블럭도이다. 도시된 바와 같이, 이행시간 (Δt)내에 새로운 엔코더펄스가 수신되면 제 1버퍼(18)에는 엔코더입력시점(e')의 클럭펄스카운터(15)의 클럭계수값(cpo)이 저장되고 기저장되어 있던 클럭계수값(cp1)은 제 2버퍼(19)로 시프트된다. 그런데, 만약 Tk를 구하기 위해서 이행시간(Δt) 내에 새로운 엔코더펄스가 수신되지 않은 경우와 마찬가지로 제 1버퍼(18)에 저장된 값을 사용하면 데이터에 오류가 생기게 되고 모터의 정확한 속도를 연산해낼 수 없다. 따라서 Tk를 구하기 위해서는 제 2버퍼(19)에 저장된 값을 사용하여야 한다. 따라서, 연산부(20)는 엔코더펄스버퍼(13)에 저장된 엔코더펄스계수값(m)과, 제 2버퍼에 저장된 엔코더펄스의 클럭계수값(cp1)를 독출한다(103). 이어, 인터럽트 발생주기(Tc)에서 제 2버퍼(19)에 저장된 클럭계수값(cp1)을 감하여 Tk값을 구한다(105).5 is a time block diagram of the encoder pulse counter 12 and the clock pulse counter 15 when a new encoder pulse is received within the transition time [Delta] t. As shown, when a new encoder pulse is received within the transition time [Delta] t, the first buffer 18 stores the clock coefficient value cpo of the clock pulse counter 15 at the encoder input point e 'and stores it in advance. The clock coefficient value cp1 that has been set is shifted to the second buffer 19. However, if a new encoder pulse is not received within the transition time Δt to obtain T k , the value stored in the first buffer 18 causes errors in the data and can calculate the exact speed of the motor. none. Therefore, in order to obtain T k , the value stored in the second buffer 19 should be used. Accordingly, the calculation unit 20 reads out the encoder pulse coefficient value m stored in the encoder pulse buffer 13 and the clock coefficient value cp1 of the encoder pulse stored in the second buffer (103). Subsequently, the clock coefficient value cp1 stored in the second buffer 19 is subtracted from the interrupt generation period T c to obtain a T k value (105).

다시, 연산부(20)는 메모리(21)에 저장된 Tk-1값을 독출하고(107), 엔코더펄스 계수값 m을 소요시간 Tc­Tk+Tk-1로 나눈 값에 소정의 비례상수를 곱하여 모터의 회전속도(V)를 연산해낸다(108).Again, the calculation unit 20 reads out the T k-1 value stored in the memory 21 (107), and divides the encoder pulse coefficient value m by the required time T c T k + T k-1 to a predetermined proportional constant. Multiply by to calculate the rotational speed (V) of the motor (108).

[수학식 1][Equation 1]

속도 연산이 끝난 연산부(20)는 이어지는 다음단계의 인터럽트주기에서의 속도 연산을 위해 Tk값을 메모리(21)에 저장한다(109). 본 실시예에서 Tk값은 원칩콘트롤러에 마련되어 있는 메모리에 저장하였으나, 버퍼를 사용하여 저장할 수도 있다.The speed calculating operation unit 20 stores the T k value in the memory 21 for speed calculation in an interrupt cycle of a subsequent step (109). In the present embodiment, the T k value is stored in a memory provided in the one chip controller, but may be stored using a buffer.

본 발명에 따른 다른 실시예에 따르면, 연산부(20)는 상기 이행시간(Δt) 내에 새로운 엔코더펄스가 입력되었는지 여부를 판단하기 위해, 엔코더펄스계수값(m)에 따라, 엔코더펄스카운터(12)값을 첵크하는 것과 제 1버퍼(18)와 제 2버퍼(19)의 값을 비교하는 것을 병용할 수도 있다.According to another embodiment of the present invention, the calculation unit 20 determines the encoder pulse counter 12 according to the encoder pulse coefficient value m in order to determine whether a new encoder pulse is input within the transition time Δt. Checking the values may be used in combination with comparing the values of the first buffer 18 and the second buffer 19.

엔코더펄스버퍼에 저장된 엔코더펄스계수값(m)이 0이거나 1인 경우에는 상기 첫 번째 실시예와 동일한 방법을 취한다.When the encoder pulse coefficient value m stored in the encoder pulse buffer is 0 or 1, the same method as in the first embodiment is taken.

그러나, 엔코더펄스계수값(m)이 2보다 크거나 같은 경우를 중고속이라고 정의할 때, 상기 이행시간(Δt) 내에 새로운 엔코더펄스가 수신되면 에지검파회로(10)로부터 펄스입력신호가 제 1버퍼(18)에 수신되고 펄스입력신호를 수신한 제 1버퍼(18)는 펄스입력시점(e')의 클럭펄스카운터(15)의 클럭계수값(cpo)을 저장한다. 따라서, 제 1버퍼에 저장된 클럭계수값(cp1)은 클럭펄스카운터(15)가 리셋된 후 첫 번째 입력된 엔코더펄스의 입력시점까지의 계수값(cpo)이 되므로 제 2버퍼에 저장된 클럭계수값(cp1)보다 작게 된다.However, when defining the case where the encoder pulse coefficient value m is greater than or equal to 2, when the new encoder pulse is received within the transition time Δt, the pulse input signal is output from the edge detection circuit 10. The first buffer 18 received in the buffer 18 and receiving the pulse input signal stores the clock coefficient value cpo of the clock pulse counter 15 at the pulse input time e '. Therefore, the clock coefficient value cp1 stored in the first buffer becomes the coefficient value cpo until the input point of the first input encoder pulse after the clock pulse counter 15 is reset, and thus the clock coefficient value stored in the second buffer. It becomes smaller than (cp1).

그러나, 상기 이행시간(Δt) 내에 새로운 엔코더펄스가 수신되지 않으면 제 1버퍼(18)에는 엔코더펄스입력시점 d에서의 클럭계수값이 저장되어 있고, 제 2버퍼(19)에는 엔코더펄스입력시점 c에서의 클럭계수값이 저장되어 있으므로 제 1버퍼(18)에 저장된 클럭계수값이 제 2버퍼(19)에 저장된 클럭계수값보다 크다.However, if a new encoder pulse is not received within the transition time [Delta] t, the clock coefficient value at encoder pulse input time d is stored in the first buffer 18, and the encoder pulse input time c is stored in the second buffer 19. The clock coefficient value stored in the first buffer 18 is larger than the clock coefficient value stored in the second buffer 19 because the clock coefficient value in E is stored.

따라서 제 1버퍼(18)에 저장된 값과 제 2버퍼(19)에 저장된 값을 비교하면 이행시간(Δt) 내에 새로운 엔코더펄스가 수신되었는지 여부를 판단할 수 있다.Accordingly, by comparing the value stored in the first buffer 18 with the value stored in the second buffer 19, it is possible to determine whether a new encoder pulse is received within the transition time Δt.

상기 두 실시예에서는 속도검출인터럽트 발생시점에서부터 실행시점까지의 이행시간(Δt) 내에 1개의 엔코더펄스가 입력되는 경우만을 가정하여 속도검출시스템을 구성하였다. 실제로, 통상 사용되는 엔코더는 600ppr(pulse per revolution), 1024ppr, 2048ppr의 펄스를 발생하며, 인터럽트 실행에 필요한 이행시간은 수μsec 내외이므로 모터를 고속으로 회전시킨다고 하더라도 2개 이상의 엔코더펄스가 입력되는 경우는 현시점의 통상적인 기술수준에 있어서 거의 없다. 그러나, 모터의 회전속도가 더욱 커지고 엔코더의 펄스발생 수가 증가하여 2개 이상의 엔코더펄스가 입력될 수 있다면, 예상 입력 수 많큼 엔코더펄스입력시점을 저장하는 버퍼의 수를 늘리고, 상술한 바와 마찬가지로 적절한 버퍼저장값을 사용하여 데이터의 오차를 보정할 수 있다.In the above two embodiments, the speed detection system is constructed on the assumption that only one encoder pulse is input within the transition time Δt from the time of occurrence of the speed detection interrupt to the execution time. In practice, encoders commonly used generate pulses of 600ppr (pulse per revolution), 1024ppr, and 2048ppr, and the transition time required for interrupt execution is about several microseconds. Therefore, even if the motor is rotated at high speed, two or more encoder pulses are input. Is hardly present at the normal level of technology at this time. However, if the rotational speed of the motor becomes larger and the number of encoder pulses can be inputted so that two or more encoder pulses can be input, the number of buffers storing the encoder pulse input time is increased by the expected number of inputs. The stored value can be used to correct errors in the data.

만약, 엔코더펄스입력시점을 저장하는 버퍼의 수를 증가함으로 인해 하드웨어적 구성이 복잡해진다면, 속도인터럽트실행시점 직전에 마지막으로 입력된 엔코더펄스의 입력시점을 저장하는 하나의 버퍼만을 사용하여 속도검출시스템을 구성할 수도 있다. 이 경우, 버퍼에 저장된 클럭펄스카운터의 클럭계수값은 인터럽트 발생시점에서부터 마지막으로 입력된 엔코더펄스의 입력시점까지의 소요시간을 나타내므로 이 값에 인터럽트발생주기(Tc)를 더한 값을 구한 후, 엔코더펄스버퍼에 저장된 엔코더펄스계수값과, 인터럽트실행시점의 엔코더펄스카운터의 펄스계수값을 독출하여 더한 값을 총 엔코더펄스값을 사용하여 속도를 연산하면 된다. 여기서 인터럽트실행시점의 엔코더펄스카운터의 펄스계수값은 이행시간 내에 입력된 엔코더펄스의 수를 나타한다.If the hardware configuration is complicated by increasing the number of buffers storing the encoder pulse input time, the speed detection system uses only one buffer to store the input time of the encoder pulse last input just before the speed interrupt execution. It can also be configured. In this case, the clock count value of the clock pulse counter stored in the buffer indicates the time required from the point of interrupt occurrence to the point of time of the last encoder pulse input. Therefore, the value obtained by adding the interrupt generation period (T c ) to this value is obtained. The speed is calculated using the total encoder pulse value by reading the encoder pulse coefficient value stored in the encoder pulse buffer and the pulse coefficient value of the encoder pulse counter when the interrupt is executed. Here, the pulse count value of the encoder pulse counter at the time of interrupt execution represents the number of encoder pulses input within the transition time.

이상에서 설명한 바와 같이, 본 발명에 따르면, 원칩콘트롤러에 구현되어 비용절감과 회로설계의 단순화 및 이에 따른 부피감소를 도모할 수 있으며 필요에 따라 사양변경이 용이할 뿐 아니라, 속도검출인터럽트 발생시점에서부터 실제 실행시점 사이에 엔코더로부터 펄스가 입력되어 속도검출을 위한 데이터에 오류가 발생되는 경우 이를 보상할 수 있는 알고리즘이 마련되어 있음으로써 높은 정밀도의 회전속도를 검출할 수 있는 속도검출시스템이 제공된다.As described above, according to the present invention, it can be implemented in a one-chip controller to reduce costs, simplify circuit design, and reduce volume, and to easily change specifications as necessary, and from the time of occurrence of a speed detection interrupt When a pulse is input from the encoder between actual execution points and an error occurs in the data for speed detection, an algorithm is provided to compensate for this, thereby providing a speed detection system capable of detecting a high speed rotation speed.

Claims (10)

엔코더를 구비한 속도검출시스템에 있어서,In a speed detection system with an encoder, 상기 엔코더로부터 발생되는 엔코더펄스의 수를 계수하는 엔코더펄스카운터와;An encoder pulse counter for counting the number of encoder pulses generated from the encoder; 소정 주기로 속도검출인터럽트가 발생되면 그 시점에서의 상기 엔코더펄스카운터의 계수값을 저장하는 엔코더펄스버퍼와;An encoder pulse buffer that stores the coefficient value of the encoder pulse counter at the time when a speed detection interrupt occurs at a predetermined period; 소정 클럭펄스발생기로부터의 클럭펄스를 계수하는 클럭펄스카운터와;A clock pulse counter for counting clock pulses from a predetermined clock pulse generator; 상기 엔코더로부터 엔코더펄스발생신호가 수신되면 그 시점의 상기 클럭펄스카운터의 클럭계수값을 저장하는 제 1버퍼와;A first buffer for storing a clock coefficient value of the clock pulse counter at the time when an encoder pulse generation signal is received from the encoder; 상기 엔코더펄스발생신호가 수신되면 그 시점의 상기 제 1버퍼에 저장된 상기 클럭계수값을 수신받아 저장하는 제 2버퍼와;A second buffer for receiving and storing the clock coefficient value stored in the first buffer at the time when the encoder pulse generation signal is received; 상기 속도검출인터럽트가 발생되었을 때, 상기 인터럽트 발생주기, 상기 엔코더카운터버퍼에 저장된 엔코더펄스계수값 및 상기 제 1버퍼에 저장된 값에 기초하여 속도를 연산하는 상기 인터럽트를 실행하며, 상기 속도검출인터럽트의 발생시점에서부터 상기 속도검출인터럽트의 실행시점까지의 이행시간내에 상기 엔코더로부터 새로운 엔코더펄스가 발생되는 경우에는 상기 제 1버퍼에 저장된 클럭계수값 대신에 상기 제 2버퍼에 저장된 클럭계수값을 사용하여 속도를 연산하는 연산부를 포함하는 것을 특징으로 하는 속도검출시스템.When the speed detection interrupt occurs, the interrupt for calculating the speed is executed based on the interrupt generation period, the encoder pulse coefficient value stored in the encoder counter buffer, and the value stored in the first buffer, and the speed detection interrupt is executed. When a new encoder pulse is generated from the encoder within the transition time from the occurrence time to the execution time of the speed detection interrupt, the speed is stored using the clock coefficient value stored in the second buffer instead of the clock coefficient value stored in the first buffer. Speed detection system comprising a calculation unit for calculating the. 제 1 항에 있어서,The method of claim 1, 상기 클럭펄스카운터는 상기 연산부클럭발생기에 따라 동작하는 것을 특징으로 하는 속도검출시스템.The clock pulse counter operates in accordance with the operation clock generator. 제 1 항에 있어서,The method of claim 1, 상기 클럭펄스카운터의 동작을 위한 클럭발생기를 더 포함하는 것을 특징으로 하는 속도검출시스템.Speed detection system further comprises a clock generator for the operation of the clock pulse counter. 제 1 항 내지 제 3 항 중 어느 한 항에 있어서,The method according to any one of claims 1 to 3, 상기 엔코더로부터 발생되는 엔코더펄스는 에지감지회로를 통해 상승에지(rising edge)를 검파하여 계수하는 것을 특징으로 하는 속도검출시스템.The encoder pulse generated from the encoder detects and counts a rising edge through an edge detection circuit. 제 1 항 내지 제 3 항 중 어느 한 항에 있어서,The method according to any one of claims 1 to 3, 상기 연산부는 다음의 수학식에 의해서 속도(V)를 계산하는 것을 특징으로 하는 속도검출시스템.The calculating unit calculates the speed (V) by the following equation. V=k*m/(Tc+Tk-1-Tk)V = k * m / (T c + T k-1 -T k ) 여기서, Tc는 인터럽트 발생주기, Tk-1은 k-1번째 인터럽트 발생시점 이전에 상기 엔코더로부터 발생된 마지막 펄스입력시점에서부터 k번째 인터럽트 발생시점까지의 시간, Tk는 k번째 인터럽트 발생시점 이전에 상기 엔코더로부터 발생된 마지막 펄스입력시점에서부터 k+1번째 인터럽트 발생시점까지의 시간, m은 상기 인터럽트 발생주기동안 상기 엔코더로부터 발생된 펄스의 수, k는 비례상수이다.Here, T c is the interrupt generation period, T k-1 is the time from the last pulse input generated from the encoder to the k-th interrupt occurrence before the k-1 th interrupt occurs, and T k is the k th interrupt generated The time from the last pulse input point previously generated from the encoder to the k + 1th interrupt occurrence point, m is the number of pulses generated from the encoder during the interrupt generation period, and k is a proportional constant. 엔코더를 구비한 속도검출시스템에 의한 속도검출방법에 있어서,In the speed detection method by the speed detection system provided with an encoder, 상기 엔코더로부터 발생되는 엔코더펄스의 수를 계수하는 단계;Counting the number of encoder pulses generated from the encoder; 소정 주기로 속도검출인터럽트를 발생시키는 단계;Generating a speed detection interrupt at a predetermined period; 상기 속도검출인터럽트 발생시점에서의 상기 엔코더펄스계수값을 저장하는 단계;Storing the encoder pulse coefficient value at the time of occurrence of the speed detection interrupt; 소정 클럭펄스를 계수하는 단계;Counting a predetermined clock pulse; 상기 엔코더로부터 엔코더펄스발생신호가 수신되면 그 시점의 상기 클럭계수값을 저장하는 단계;Storing the clock coefficient value at that time when an encoder pulse generation signal is received from the encoder; 상기 엔코더펄스발생신호가 수신되면 저장된 상기 클럭계수값을 수신받아 저장하는 단계;Receiving and storing the stored clock coefficient value when the encoder pulse generation signal is received; 상기 속도검출인터럽트가 발생되었을 때, 상기 인터럽트 발생주기, 상기 엔코더카운터버퍼에 저장된 엔코더펄스계수값 및 상기 제 1버퍼에 저장된 값에 기초하여 속도를 연산하는 상기 인터럽트를 실행하며, 상기 속도검출인터럽트의 발생시점에서부터 상기 속도검출인터럽트의 실행시점까지의 이행시간내에 상기 엔코더로부터 새로운 엔코더펄스가 발생되는 경우에는 상기 제 1버퍼에 저장된 클럭계수값 대신에 상기 제 2버퍼에 저장된 클럭계수값을 사용하여 속도를 연산하는 단계를 포함하는 것을 특징으로 하는 속도검출방법.When the speed detection interrupt occurs, the interrupt for calculating the speed is executed based on the interrupt generation period, the encoder pulse coefficient value stored in the encoder counter buffer, and the value stored in the first buffer, and the speed detection interrupt is executed. When a new encoder pulse is generated from the encoder within the transition time from the occurrence time to the execution time of the speed detection interrupt, the speed is stored using the clock coefficient value stored in the second buffer instead of the clock coefficient value stored in the first buffer. Speed detection method comprising the step of calculating the. 제 6 항에 있어서,The method of claim 6, 상기 클럭펄스를 계수하는 단계는 연산부클럭에 따라 계수하는 것을 특징으로 하는 속도검출방법.And counting the clock pulses according to the operation unit clock. 제 6 항에 있어서,The method of claim 6, 상기 클럭펄스를 계수하는 단계는 소정 외부 클럭에 따라 계수하는 것을 특징으로 하는 속도검출방법.And counting the clock pulses according to a predetermined external clock. 제 6 항 내지 제 8 항 중 어느 한 항에 있어서,The method according to any one of claims 6 to 8, 상기 엔코더로부터 발생되는 엔코더펄스를 계수하는 단계는 소정 에지감지회로를 통해 상승에지(rising edge)를 검파하여 계수하는 것을 특징으로 하는 속도검출방법.And counting the encoder pulses generated from the encoder comprises detecting and counting rising edges through a predetermined edge sensing circuit. 제 6 항 내지 제 8 항 중 어느 한 항에 있어서,The method according to any one of claims 6 to 8, 상기 속도(V)를 연산하는 단계는 다음의 수학식에 의하는 것을 특징으로 하는 속도검출방법.Computing the speed (V) is based on the following equation. V=k*m/(Tc+Tk-1-Tk)V = k * m / (T c + T k-1 -T k ) 여기서, Tc는 인터럽트 발생주기, Tk-1은 k-1번째 인터럽트 발생시점 이전에 상기 엔코더로부터 발생된 마지막 펄스입력시점에서부터 k번째 인터럽트 발생시점까지의 시간, Tk는 k번째 인터럽트 발생시점 이전에 상기 엔코더로부터 발생된 마지막 펄스입력시점에서부터 k+1번째 인터럽트 발생시점까지의 시간, m은 상기 인터럽트 발생주기동안 상기 엔코더로부터 발생된 펄스의 수, k는 비례상수이다.Here, T c is the interrupt generation period, T k-1 is the time from the last pulse input generated from the encoder to the k-th interrupt occurrence before the k-1 th interrupt occurs, and T k is the k th interrupt generated The time from the last pulse input point previously generated from the encoder to the k + 1th interrupt occurrence point, m is the number of pulses generated from the encoder during the interrupt generation period, and k is a proportional constant.
KR1019990006538A 1999-02-26 1999-02-26 speed detecting system and method thereof KR100286043B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1019990006538A KR100286043B1 (en) 1999-02-26 1999-02-26 speed detecting system and method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1019990006538A KR100286043B1 (en) 1999-02-26 1999-02-26 speed detecting system and method thereof

Publications (2)

Publication Number Publication Date
KR20000056840A true KR20000056840A (en) 2000-09-15
KR100286043B1 KR100286043B1 (en) 2001-03-15

Family

ID=19575190

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1019990006538A KR100286043B1 (en) 1999-02-26 1999-02-26 speed detecting system and method thereof

Country Status (1)

Country Link
KR (1) KR100286043B1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114527832A (en) * 2022-01-02 2022-05-24 深圳市禾望电气股份有限公司 Pulse signal edge measuring method and device, storage medium and micro control unit

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114527832A (en) * 2022-01-02 2022-05-24 深圳市禾望电气股份有限公司 Pulse signal edge measuring method and device, storage medium and micro control unit
CN114527832B (en) * 2022-01-02 2024-04-02 深圳市禾望电气股份有限公司 Pulse signal edge measuring method and device, storage medium and micro-control unit

Also Published As

Publication number Publication date
KR100286043B1 (en) 2001-03-15

Similar Documents

Publication Publication Date Title
US5051688A (en) Crossed coil meter driving device having a plurality of input parameters
KR20050053863A (en) The automatic calibration methods of the electronic compass
JPH0291513A (en) Method and device for correcting zero point of gyro
EP2177917B1 (en) Velocity detection method and motor control device using the method
JPS5913957A (en) Speed detecting circuit
KR100286043B1 (en) speed detecting system and method thereof
JPH04344466A (en) Detecting device for velocity of elevator
JP3173174B2 (en) Speed detector
JPH07229910A (en) Pulse counter circuit
EP0401757A2 (en) Method of detecting the number of revolutions
JP3339214B2 (en) Servo motor control device
JPH04346069A (en) Speed signal generating circuit
JPH03289567A (en) Apparatus for detecting rotational speed
JP2002311040A (en) Speed detector
KR100314445B1 (en) vehicle speed measureing method and device by use of measuring method for variable reference clock
KR100233990B1 (en) Vehicle rotating speed measuring method for electric car
JPH04233467A (en) Method and apparatus for measuring speed of motor
JPH05188067A (en) Servo motor speed detecting device
JP2523207Y2 (en) Speed detector
CN117191076A (en) Motion sensor correction method, motion sensor correction device, electronic equipment and storage medium
KR19990001541A (en) Speed detection method and device
JP2744880B2 (en) Pulse width measurement device and rotation speed measurement device
JPH07154990A (en) Motor speed controller
JP3310716B2 (en) Encoder moving speed detector
JPH0351764A (en) Apparatus for detecting speed and acceleration

Legal Events

Date Code Title Description
A201 Request for examination
E701 Decision to grant or registration of patent right
GRNT Written decision to grant
FPAY Annual fee payment

Payment date: 20090102

Year of fee payment: 9

LAPS Lapse due to unpaid annual fee