Signal processing method and signal processing circuit
By acquiring sampled data after the encoder is powered on, determining the type, and performing signal modulation, the positive and negative power supply pins are identified, thus solving the problem of incorrect encoder interface insertion and achieving effective encoder protection and simplified operation.
Patent Information
- Application Number
- CN202211415258.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-11
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2042-11-11
AI Technical Summary
In the existing technology, different types of encoders require different interface circuits, which is troublesome to operate, and incorrect insertion of the 24V signal will burn out the encoder, resulting in economic losses.
By detecting the sampling data of the interface signal after the encoder is powered on, the encoder type is determined, and the signal is modulated according to the type. The positive and negative power supply pins are identified, and a power-on signal is output to prevent incorrect interface insertion.
It effectively prevents encoder damage due to incorrect interface insertion, protects the encoder, and simplifies the operation process.
Smart Images

Figure CN115616966B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of encoder, in particular to a signal processing method and a signal processing circuit. BACKGROUND
[0002] With the rapid improvement of industrial automation level, the application of encoder is increasingly widespread. According to the reading mode, the encoder can be divided into contact type and non-contact type; according to the working principle, the encoder can be divided into incremental type and absolute type. The incremental encoder converts displacement into periodic electrical signals, and then converts the electrical signals into counting pulses, and uses the number of pulses to represent the size of displacement. The absolute encoder corresponds to a certain digital code for each position, so its indication is only related to the starting and ending positions of measurement, and is independent of the intermediate process of measurement. For the encoder signal, there are digital and analog quantities, and the general signal amplitude does not exceed 5V.
[0003] At present, different types of encoders need to be matched with different interface circuits. In the prior art, some drivers can only adapt to one type of encoder, and some drivers need to be matched with external expansion I / O cards to adapt to different types of encoders, which is very troublesome to operate. Moreover, some drivers generally have a 24V signal socket, and when the socket with 24V is inserted into the encoder due to human factors, the encoder will be burned out. Since the encoder is expensive, burning out the encoder will not only delay the work progress, but also cause great economic loss. SUMMARY
[0004] The main purpose of the present application is to provide a signal processing method and a signal processing circuit to solve the problem of damage caused by incorrect insertion of the interface of the encoder in the prior art.
[0005] According to an aspect of an embodiment of the present application, a signal processing method is provided, comprising: detecting whether a target encoder is powered on; in the case that the target encoder is detected to be powered on, acquiring sampling data of an interface signal of the target encoder, wherein the sampling data comprises a plurality of output signal amplitudes corresponding to a plurality of pins of the interface; determining a type of the target encoder according to the sampling data; and performing signal modulation on an output signal of the target encoder according to the type of the target encoder.
[0006] Optionally, the above method further comprises: detecting the number of pins of the target encoder to obtain a detection result; determining a pin serial number corresponding to each pin of the target encoder according to the detection result; determining a positive power supply pin and a negative power supply pin in the plurality of pins according to the pin serial number; and outputting a power-on signal to a power supply module according to the positive power supply pin and the negative power supply pin, so that the power supply module powers on the encoder according to the power-on signal.
[0007] Optionally, the positive power pin in the plurality of pins is determined according to the pin number, comprising: a first power supply step of outputting a first power supply signal corresponding to the pin of the current pin number to the power supply module, so that the power supply module supplies power to the pin of the current pin number according to the first power supply signal, and controls the remaining pins to be grounded; a first detection step of detecting whether the target encoder is in a powered-on state, and in the case of being in the powered-on state, determining that the pin of the current pin number is the positive power pin; in the case of not being in the powered-on state, repeatedly executing the first power supply step and the first detection step at least once in the order of increasing pin number, until a pin is determined as the positive power pin.
[0008] Optionally, the negative power pin in the plurality of pins is determined, comprising: a second power supply step of outputting a second power supply signal corresponding to the pin of the current pin number to the power supply module, so that the power supply module controls the pin of the current pin number to be grounded according to the second power supply signal, and supplies power to the remaining pins; a second detection step of detecting whether the target encoder is in a powered-on state, and in the case of being in the powered-on state, determining that the pin of the current pin number is the negative power pin; in the case of not being in the powered-on state, repeatedly executing the second power supply step and the second detection step at least once in the order of increasing pin number, until a pin is determined as the negative power pin.
[0009] Optionally, the first power supply step comprises: obtaining a preset power supply amplitude of the target encoder; obtaining a preset power supply amplitude of the target encoder;
[0010] Optionally, the second power supply step comprises: obtaining a preset power supply amplitude of the target encoder; outputting a second power supply signal to the power supply module according to the preset power supply amplitude, wherein the voltage amplitude of the second power supply signal is equal to or lower than the preset power supply amplitude.
[0011] Optionally, the type of the target encoder is determined according to the sampling data, comprising: determining the waveform of the output signal of the plurality of pins according to the plurality of output signal amplitudes; determining the waveform of the output signal of the plurality of pins according to the plurality of output signal amplitudes;
[0012] Optionally, the output signal of the target encoder is signal-modulated according to the type of the target encoder, comprising: obtaining a preset signal amplitude and a preset error parameter of the target encoder according to the type of the target encoder; signal-modulating the output signal of the target encoder according to the preset signal amplitude, the preset error parameter, and the amplitudes of the output signals of the plurality of pins.
[0013] Optionally, the output signal of the target encoder is signal-modulated according to the preset signal amplitude, the preset error parameter and the amplitude of the output signal of the plurality of pins, including: calculating the absolute value of the difference between the amplitude of the output signal of each pin and the preset signal amplitude; determining whether the absolute value of the difference is greater than the preset error parameter, and outputting a first determination result; in the case that the first determination result indicates yes, determining whether the amplitude of the output signal of the pin is greater than the preset signal amplitude, and outputting a second determination result; in the case that the second determination result indicates yes, outputting a first adjustment signal to the target encoder, so that the target encoder reduces the amplitude of the output signal of the pin according to the first adjustment signal, until the absolute value of the difference between the output signal of the pin and the preset signal amplitude is equal to the preset error parameter; in the case that the second determination result indicates no, outputting a second adjustment signal to the target encoder, so that the target encoder increases the amplitude of the output signal of the pin according to the second adjustment signal, until the absolute value of the difference between the output signal of the pin and the preset signal amplitude is equal to the preset error parameter.
[0014] Optionally, the target encoder is arranged on the motor, and the method further includes: identifying a target signal type of the output signal of each pin; in the case that the target signal type is an analog signal, outputting a control signal to an analog signal modulation module, so that the analog signal modulation module modulates the control signal into an analog control signal and outputs the analog control signal to the target encoder; in the case that the target signal type is a digital signal, outputting a control signal to a digital signal modulation module, so that the digital signal modulation module modulates the control signal into a digital control signal and outputs the digital control signal to the target encoder.
[0015] Optionally, the above method further includes: obtaining a preset interface position corresponding to the type of the target encoder; determining an output interface position of the target encoder, wherein the output interface position is used to output an interface signal of the target encoder; and adjusting the output interface position to the preset interface position.
[0016] Optionally, the above method further includes: outputting a cut-off signal to a power supply control module, so that the power supply control module stops supplying power to a functional interface according to the cut-off signal, wherein the functional interface includes at least one of the following: a communication interface, a brake interface and an emergency stop interface.
[0017] According to another aspect of the embodiment of the present application, the signal processing circuit is also provided, comprising: an encoder interface, configured to access a target encoder; a sampling module, electrically connected to the encoder interface, configured to output sampling data of an interface signal of the target encoder, wherein the sampling data comprises a plurality of output signal amplitudes corresponding to a plurality of pins of the target encoder; a processor, electrically connected to the sampling module, configured to identify whether the target encoder is powered on, acquire the sampling data in the case that the target encoder is identified to be powered on, determine a type of the target encoder according to the sampling data, and perform signal modulation on an output signal of the target encoder according to the type of the target encoder.
[0018] Optionally, the signal processing circuit further comprises: a power supply control module, electrically connected to the processor and the functional interface respectively, configured to receive a cut-off signal sent by the processor, and stop supplying power to the functional interface according to the cut-off signal, wherein the functional interface comprises at least one of the following: a communication interface, a brake interface, and an emergency stop interface.
[0019] Optionally, the signal processing circuit further comprises: an interface conversion module, electrically connected to the processor and the encoder interface respectively, configured to adjust an output interface position of the target encoder to a preset interface position corresponding to the type of the target encoder, the output interface position being configured to output the interface signal of the target encoder.
[0020] Optionally, the signal processing circuit further comprises: an analog signal modulation module, electrically connected to the processor and the mode selection switch module respectively, configured to modulate a control signal output by the processor into an analog control signal and output to the target encoder; a digital signal modulation module, electrically connected to the processor and the mode selection switch module respectively, configured to modulate a control signal output by the processor into a digital control signal and output to the target encoder; and a mode selection switch module, electrically connected to the interface conversion module, configured to turn on the analog signal modulation module or the digital signal modulation module according to a signal type of the output signal.
[0021] In the embodiment of the present application, the signal processing method is provided, by acquiring the sampling data of the interface signal of the target encoder in the case that the target encoder is identified to be powered on, determining the type of the target encoder according to the sampling data, and then performing signal modulation on the output signal of the target encoder according to the determined type of the encoder, the configuration of the encoder is realized, the encoder is effectively prevented from being burnt out due to wrong interface insertion, and the effect of effectively protecting the encoder is realized. BRIEF DESCRIPTION OF DRAWINGS
[0022] The accompanying drawings, which form a part of the present application, are used to provide further understanding of the present application, and serve as an appositive explanation of the illustrative embodiments of the present application, and do not constitute improper limitations to the present application. In the drawings:
[0023] Figure 1 a flow chart of a signal processing method according to an embodiment of the present application is shown; and
[0024] Figure 2 a flow chart of determining a positive power pin and a negative power pin in a signal processing method according to an embodiment of the present application is shown;
[0025] Figure 3 a circuit diagram of a power control module employed in a signal processing method according to an embodiment of the present application is shown;
[0026] Figure 4 a circuit diagram of a sampling circuit employed in a signal processing method according to an embodiment of the present application is shown;
[0027] Figure 5 a circuit diagram of an interface conversion circuit employed in a signal processing method according to an embodiment of the present application is shown;
[0028] Figure 6 a flow chart of processing an output signal of an encoder according to an embodiment of the present application is shown;
[0029] Figure 7 a structural block diagram of a signal processing circuit employed in a signal processing method according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0030] It should be noted that the embodiments and features in the present application can be combined with each other without conflict. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0031] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should fall within the scope of protection of the present application.
[0032] It should be noted that the terms "first", "second", and the like in the description and claims of the application and the above drawings are used to distinguish between similar objects and are not necessarily used to describe a particular sequential or chronological order. It should be understood that the data thus used can be interchanged, where appropriate, so that the embodiments of the application described herein can be implemented in any desired order. Furthermore, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, processes, methods, systems, products, or devices that include a series of steps or units are not necessarily limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0033] It should be understood that when an element (such as a layer, film, region, or substrate) is referred to as being "on" another element, it can be directly on the other element, or intervening elements can also be present. In addition, when an element is referred to as being "connected" to or "coupled" to another element, it can be "directly connected" to or "directly coupled" to the other element, or be "connected" to or "coupled" to the other element through a third element.
[0034] As mentioned in the background, in the prior art, some drives can only adapt to one type of encoder, and some drives need to be matched with an external expansion I / O card to adapt to different types of encoders, which is very troublesome to operate. Moreover, some drives generally have a 24V signal socket, and when the socket with 24V is inserted into the encoder due to human factors, the encoder will be burned out. Since the encoder is expensive, burning out the encoder will not only delay the work progress, but also cause great economic loss. In order to solve the above problems, according to the embodiments of the application, a signal processing method is provided.
[0035] Figure 1 is a flowchart of the signal processing method according to the embodiments of the application. As shown in Figure 1 the method comprises the following steps:
[0036] Step S101, detecting whether a target encoder is powered on;
[0037] Step S102, in the case where it is detected that the target encoder is powered on, acquiring sampling data of an interface signal of the target encoder, wherein the sampling data comprises a plurality of output signal amplitudes corresponding to a plurality of pins of the interface;
[0038] Step S103, determining a type of the target encoder according to the sampling data;
[0039] Step S104, performing signal modulation on an output signal of the target encoder according to the type of the target encoder.
[0040] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown.
[0041] By using the above steps, by acquiring the sampling data of the interface signal of the target encoder when it is identified that the target encoder is powered on, and determining the type of the target encoder according to the sampling data, and then modulating the output signal of the target encoder according to the determined type of the encoder, the configuration of the encoder is realized, which effectively prevents the encoder from being burned due to incorrect interface insertion, and further realizes the effect of effectively protecting the encoder.
[0042] In some optional embodiments, the signal processing method in the embodiment further includes: detecting the pin number of the target encoder to obtain a detection result; determining the pin sequence number corresponding to each pin of the target encoder according to the detection result; determining the positive power supply pin and the negative power supply pin in the plurality of pins according to the pin sequence number; and outputting a power-on signal to the power supply module according to the positive power supply pin and the negative power supply pin, so that the power supply module powers on the encoder according to the power-on signal.
[0043] In the above embodiment, the pins of the target encoder are numbered first, and then according to the numbering order, the positive power supply pin of the target encoder can be effectively determined by powering one pin while grounding the other pins, and then judging whether the target encoder is in a powered-on state; and the negative power supply pin of the target encoder can also be effectively determined by grounding one pin while powering the other pins, and then judging whether the target encoder is in a powered-on state.
[0044] Specifically, determining the positive power supply pin in the plurality of pins according to the pin sequence number includes: a first power supply step of outputting a first power supply signal corresponding to the pin of the current pin sequence number to the power supply module, so that the power supply module powers the pin of the current pin sequence number according to the first power supply signal, and controls the remaining pins to be grounded; a first detection step of detecting whether the target encoder is in a powered-on state, and in the case of being in a powered-on state, determining that the pin of the current pin sequence number is the positive power supply pin; and in the case of not being in a powered-on state, repeatedly executing the first power supply step and the first detection step at least once in the order of increasing sequence number, until a pin is determined to be the positive power supply pin.
[0045] In the above embodiment, the first power supply step can comprise: obtaining a preset power supply amplitude of the target encoder; and outputting a first power supply signal to the power supply module according to the preset power supply amplitude, wherein a voltage amplitude of the first power supply signal is equal to or lower than the preset power supply amplitude. By using the preset power supply amplitude, the encoder damage caused by the voltage overload output by the power supply module to the pin after receiving the first power supply signal can be effectively avoided.
[0046] Specifically, according to the pin number, the negative power pin in the plurality of pins is determined, comprising: a second power supply step of outputting a second power supply signal corresponding to the pin of the current pin number to the power supply module, so that the power supply module controls the pin of the current pin number to ground and supplies power to the remaining pins according to the second power supply signal; a second detection step of detecting whether the target encoder is in a power-on state, and in the case of being in the power-on state, determining that the pin of the current pin number is the negative power pin; and in the case of not being in the power-on state, repeatedly executing the second power supply step and the second detection step at least once in the order of increasing the pin number until a pin is determined as the negative power pin.
[0047] In the above embodiment, the second power supply step can comprise: obtaining a preset power supply amplitude of the target encoder; and outputting a second power supply signal to the power supply module according to the preset power supply amplitude, wherein a voltage amplitude of the second power supply signal is equal to or lower than the preset power supply amplitude. By using the preset power supply amplitude, the encoder damage caused by the voltage overload output by the power supply module to the pin can be effectively avoided.
[0048] An exemplary encoder power supply identification workflow diagram is shown in FIG. 1, comprising the following steps: Figure 2
[0049] Access the encoder through the interface, set the encoder power supply amplitude, detect the number of pins of the encoder, and number the pins;
[0050] Set a constant a = 1 and b = 1, where a is an encoder power supply detection variable; b is an encoder ground detection variable; a = 1 and b = 1 indicate that the detection starts from the first pin;
[0051] The pin corresponding to a is connected to the power supply. If the encoder is identified, the pin corresponding to a is the power pin. Otherwise, a = a + 1, and the next pin is detected.
[0052] The detection of the encoder power supply is completed, the a pin is recorded as the positive power pin of the encoder, the negative power pin of the encoder is detected, and the detection starts from the first pin. When a = 1, the first pin is the positive power pin of the encoder, and the first pin does not need to be detected, and the detection starts from the second pin, i.e. b = b + 1.
[0053] If it is determined that the encoder is recognized, it is determined that the encoder is powered on, and b is the negative power supply pin of the encoder, so that the power supply recognition of the encoder is completed; otherwise, the pin corresponding to b is not the ground terminal (GND), and the next pin is continuously detected;
[0054] Before the next pin is detected, it is determined whether b is the same as a, that is, whether the next pin is the positive power supply pin, and if yes, b is set to b+1 again, and the next pin is continuously detected; otherwise, it is continuously determined whether b is the negative power supply pin until the negative power supply pin of the encoder is detected, and the power supply recognition is completed.
[0055] In some optional embodiments, the signal processing method in the embodiment further includes: outputting a cut-off signal to a power supply control module, so that the power supply control module stops supplying power to a function interface according to the cut-off signal, and the function interface includes at least one of the following: a communication interface, a brake interface, and an emergency stop interface. Before the encoder is recognized, the power supply of other interfaces is cut off to prevent the encoder from being burned out due to misplug, so that the encoder can be effectively protected.
[0056] For example, the power supply control module used is composed of controllable switching devices, as shown in Figure 3 , and is used to control the power supply output of other interfaces. Each controllable switching device includes: a pull-up resistor (R1), a driving resistor (R q2 , R q1 , …R qn ), and a switching diode (Q1, Q2, …Q n ). The pull-up resistor (R1) is connected to a power supply (VCC1, VCC2…VCCN), the collector of an NPN triode is electrically connected to a first resistor and a power supply interface (power supply 1 interface, power supply 2 interface…power supply N interface), the emitter of the switching diode is connected to the ground (GND), and the base of the switching diode is electrically connected to the driving resistor. The power supply interface can include: a communication interface, a brake interface, and an emergency stop interface. When the encoder is not detected, the processor outputs a high-level signal, Q1~Q n are turned on, and the power supply 1~power supply N interfaces are connected to GND, so that the encoder can be effectively protected even if it is misplugged into other interfaces; otherwise, when the encoder is detected, the processor outputs a low-level signal, Q1~Q n are turned off, and the power supply 1~power supply N interfaces are connected to their respective VCC power supplies, so that the driver interface function can be normally used.
[0057] In the step S102, when it is detected that the target encoder is powered on, the sampling data of the interface signal of the target encoder is acquired. For example, a voltage sampling module is controlled to collect the sampling data of the interface signal, and the voltage sampling module collects the sampling data as Figure 4As shown, N is the maximum value of the interface signal. During signal acquisition, sampling resistors Rf1 and Rf2 divide the interface signals 1 to N, controlling the voltage of the interface signals within the voltage range that the processor can withstand, and then the processor acquires the voltage signals.
[0058] In some optional implementations, determining the type of the target encoder based on the sampled data includes: determining the waveforms of the output signals of multiple pins based on the amplitudes of multiple output signals; and determining the type of the target encoder based on the waveforms of the output signals and a waveform database, wherein the waveform database includes: multiple historical waveform data and multiple encoder types corresponding one-to-one with the multiple historical waveform data.
[0059] In the above implementation, by collecting historical waveform data corresponding to different encoder types and establishing a database, when the waveform of the output signal of the pin of the target encoder is obtained, the encoder type corresponding to the waveform can be directly searched from the database, thereby determining the type of the target encoder and improving the efficiency of determining the target encoder type.
[0060] In some optional implementations, the signal processing method in this embodiment further includes: obtaining a preset interface position corresponding to the type of the target encoder; determining the output interface position of the target encoder, wherein the output interface position is used to output the interface signal of the target encoder; and adjusting the output interface position to the preset interface position.
[0061] For example, control such as Figure 5 The interface conversion module shown performs interface conversion. The programmable switches in the interface conversion module are connected to conversion signals 1 to N and interface signals 1 to n respectively. Assuming that the encoder is identified as a sine and cosine encoder, and the interface signal 1 (the first output interface) is detected as sin+, and the defined conversion signal 3 (the third preset interface) is sin+, then the processor controls the programmable switches to connect the interface of interface signal 1 and the interface of conversion signal 3.
[0062] In some optional implementations, the output signal of the target encoder is modulated according to the type of the target encoder, including: obtaining a preset signal amplitude and a preset error parameter of the target encoder according to the type of the target encoder; and modulating the output signal of the target encoder according to the preset signal amplitude, the preset error parameter and the amplitude of the output signals of multiple pins.
[0063] Specifically, the signal modulation on the output signal of the target encoder according to the preset signal amplitude, the preset error parameter and the amplitudes of the output signals of the plurality of pins can include: calculating the absolute value of the difference between the amplitude of the output signal of each pin and the preset signal amplitude; determining whether the absolute value of the difference is greater than the preset error parameter, and outputting a first determination result; in the case where the first determination result indicates yes, determining whether the amplitude of the output signal of the pin is greater than the preset signal amplitude, and outputting a second determination result; in the case where the second determination result indicates yes, outputting a first adjustment signal to the target encoder, so that the target encoder reduces the amplitude of the output signal of the pin according to the first adjustment signal, until the absolute value of the difference between the output signal of the pin and the preset signal amplitude is equal to the preset error parameter; in the case where the second determination result indicates no, outputting a second adjustment signal to the target encoder, so that the target encoder increases the amplitude of the output signal of the pin according to the second adjustment signal, until the absolute value of the difference between the output signal of the pin and the preset signal amplitude is equal to the preset error parameter.
[0064] In some optional embodiments, the signal processing method in the present embodiment further includes: identifying a target signal type of the output signal of each pin; in the case where the target signal type is an analog signal, outputting a control signal to an analog signal modulation module, so that the analog signal modulation module modulates the control signal into an analog control signal and outputs the analog control signal to the target encoder; in the case where the target signal type is a digital signal, outputting a control signal to a digital signal modulation module, so that the digital signal modulation module modulates the control signal into a digital control signal and outputs the digital control signal to the target encoder.
[0065] Exemplarily, Figure 6 A flowchart for processing the output signal of an encoder is shown in the following table, which can include the following steps:
[0066] The target encoder is arranged on the motor, the motor is operated in an open loop, a set error parameter x is set, an actual detection amplitude X of the encoder is detected, and an optimal amplitude y of the encoder is detected, wherein the error parameter x should be within a fluctuation range that can be borne by the encoder when receiving a signal.
[0067] During the open loop operation of the motor, the encoder signals of all the connected encoder pins are collected, and the type of the encoder is determined according to the collected waveforms; if a plurality of sine and cosine signals are collected, the type of the encoder is a sine-cosine encoder.
[0068] After the detection is completed, the output signal of the encoder is corresponded to the signal pin defined by the processor through the interface conversion module. For example, if the processor sets 2 pins as sin signals, the sin signals are transmitted to the 2 pins of the processor.
[0069] The encoder signal modulation is performed, whether the encoder amplitude exceeds the error range is judged by judging |X-y|>x, if exceeding the error range, then judging X>y, that is, judging whether the actual encoder amplitude is too large or too small; the increasing amplitude or the decreasing amplitude is determined according to the judging result;
[0070] After the amplitude modulation is completed, whether the output signal of the encoder is a digital quantity or an analog quantity is judged, then the signal is modulated in digital and analog quantity, and the motor is operated in closed loop after the signal is modulated finally.
[0071] According to another embodiment of the application, a signal processing circuit is provided.
[0072] Figure 7 It is a structural block diagram of the signal processing circuit according to the embodiment of the application. As shown in the figure, Figure 7 the signal processing circuit comprises: an encoder interface for accessing a target encoder; a sampling module electrically connected with the encoder interface, for outputting sampling data of the interface signal of the target encoder, wherein the sampling data comprises a plurality of output signal amplitudes corresponding to a plurality of pins of the target encoder; a processor electrically connected with the sampling module, for identifying whether the target encoder is powered on, in the case of identifying that the target encoder is powered on, acquiring the sampling data, and according to the sampling data, determining the type of the target encoder, and according to the type of the target encoder, performing signal modulation on the output signal of the target encoder.
[0073] By using the above signal processing circuit, in the case of identifying that the target encoder is powered on by the processor, the sampling module is used to acquire the sampling data of the interface signal of the target encoder, and the processor is used to determine the type of the target encoder according to the sampling data, and then the output signal of the target encoder is modulated according to the determined type of the encoder, so as to realize the configuration of the encoder, effectively prevent the encoder from being burned due to wrong interface insertion, and further realize the effect of effectively protecting the encoder.
[0074] The above encoder interface is an interface for connecting the encoder, generally 7-25 pins, each pin can transmit 1 signal, and an N-pin encoder interface can transmit at most N encoder output signals (including power supply).
[0075] The above voltage sampling module can be composed of a sampling resistor and a sampling chip, for collecting the encoder signal and feeding back to the processor. As shown in the figure, Figure 4 wherein N is the maximum value of the interface signal. When collecting the signal, the sampling resistor Rf1 and the sampling resistor Rf2 divide the voltage of the interface signal to control the voltage of the interface signal within the voltage range that the processor can withstand, and then the voltage signal is collected by the processor.
[0076] In some optional embodiments, the signal processing circuit further comprises a power control module, as shown in Figure 7 The power control module is electrically connected with the processor and the function interface, respectively, for receiving the cut-off signal sent by the processor and stopping power supply to the function interface according to the cut-off signal, wherein the function interface comprises at least one of the communication interface, the brake interface and the emergency stop interface. Before the encoder is identified, the power supply of other interfaces is cut off to prevent the encoder from being burnt out due to misplug, thereby effectively protecting the encoder.
[0077] For example, the power control module comprises controllable switching devices, as shown in Figure 3 The controllable switching devices are used to control the power output of other interfaces, each of which comprises a pull-up resistor (R1), a driving resistor (R q2 , R q1 …R qn ), a switching diode (Q1, Q2…Q n ), wherein the pull-up resistor (R1) is connected with the power supply (VCC1, VCC2…VCCN), the collector of the NPN triode is electrically connected with the first resistor and the power interface (power 1 interface, power 2 interface…power N interface), the emitter of the switching diode is grounded (GND), and the base of the switching diode is electrically connected with the driving resistor. The power interface can comprise the communication interface, the brake interface and the emergency stop interface. When the encoder is not detected, the processor gives a high-level signal, Q1~Q n are turned on, and the power 1~power N interfaces are connected with GND, so that the encoder can be effectively protected even if it is mispluged into other interfaces; conversely, when the encoder is detected, the processor gives a low-level signal, Q1~Q n are turned off, and the power 1~power N interfaces are connected with the respective VCC power supply, and the driver interface function can be normally used.
[0078] In some optional embodiments, the signal processing circuit further comprises an interface conversion module, as shown in Figure 7 The interface conversion module is electrically connected with the processor and the encoder interface, respectively, for adjusting the output interface position of the target encoder to a preset interface position corresponding to the type of the target encoder, and the output interface position is used to output the interface signal of the target encoder.
[0079] For example, the interface conversion module comprises programmable switches, as shown in Figure 5 The programmable switches in the interface conversion module are connected with conversion signals 1~N and interface signals 1~n, respectively. Assuming that the encoder is identified as a sine-cosine encoder, the interface signal 1 (the first output interface) is detected as sin+, and the conversion signal 3 (the third preset interface) is defined as sin+, then the interface of the interface signal 1 and the interface of the conversion signal 3 are turned on through the programmable switch.
[0080] In some optional embodiments, as shown in Figure 7 The signal processing circuit further comprises: an analog signal modulation module electrically connected with the processor and the mode selection switch module, for modulating the control signal output by the processor into an analog control signal and outputting to the target encoder; a digital signal modulation module electrically connected with the processor and the mode selection switch module, for modulating the control signal output by the processor into a digital control signal and outputting to the target encoder; and the mode selection switch module is electrically connected with the interface conversion module, for turning on the analog signal modulation module or the digital signal modulation module according to the signal type of the output signal.
[0081] In the above embodiments, the mode selection switch module selects the modulation circuit according to the received signal; the analog signal modulation module can be composed of a differential operational amplifier, an A / D conversion chip and peripheral circuits; and the digital signal modulation module can be composed of some filter devices and signal processing chips.
[0082] The embodiment of the present application provides a storage medium having a program stored thereon, and the program is executed by a processor to implement the above-mentioned signal processing method.
[0083] The embodiment of the present application provides a processor for running a program, wherein the program is executed to implement the above-mentioned signal processing method.
[0084] In the above embodiments of the present application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0085] In several embodiments provided in the present application, it should be understood that the disclosed technical contents can be implemented by other ways. Among them, the above-mentioned device embodiments are only schematic, for example, the division of the units can be a logical function division, and actual implementation can have another division way, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or modules shown or discussed can be indirect coupling or communication connection through some interfaces, units or modules, which can be electrical or other forms.
[0086] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place or distributed on multiple units. According to actual needs, part or all of the units can be selected to achieve the purpose of the present embodiment scheme.
[0087] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0088] When the integrated unit is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application, essentially or in part, or all or part of the technical solutions, can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various other media that can store program codes.
[0089] From the above description, it can be seen that the above-mentioned embodiments of the present application achieve the following technical effects:
[0090] By acquiring the sampling data of the interface signal of the target encoder when it is identified that the target encoder is powered on, and determining the type of the target encoder according to the sampling data, and then modulating the output signal of the target encoder according to the determined type of the encoder, the configuration of the encoder is realized, the encoder is effectively prevented from being burned due to wrong interface insertion, and the effect of effectively protecting the encoder is realized.
[0091] The above only describes the preferred embodiments of the present application and is not used to limit the present application. For those skilled in the art, the present application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A signal processing method, characterized in that, include: Detect whether the target encoder is powered on; When the target encoder is detected to be powered on, sampling data of the interface signal of the target encoder is acquired, wherein the sampling data includes multiple output signal amplitudes corresponding to multiple pins of the interface; Based on the sampled data, determine the type of the target encoder; Based on the type of the target encoder, the output signal of the target encoder is modulated. Determining the type of the target encoder based on the sampled data includes: Based on the amplitudes of the multiple output signals, determine the waveforms of the output signals of the multiple pins; The type of the target encoder is determined based on the waveform of the output signal and the waveform database, wherein the waveform database includes: multiple historical waveform data and multiple encoder types corresponding one-to-one with the multiple historical waveform data.
2. The method according to claim 1, characterized in that, Also includes: The number of pins of the target encoder is detected to obtain the detection result; Based on the detection results, determine the pin number corresponding to each pin of the target encoder; Based on the pin numbers, determine the positive power supply pin and the negative power supply pin among the plurality of pins; Based on the positive power supply pin and the negative power supply pin, a power-on signal is output to the power supply module so that the power supply module powers on the encoder according to the power-on signal.
3. The method according to claim 2, characterized in that, The step of determining the positive power supply pin among the plurality of pins based on the pin number includes: In the first power supply step, the first power supply signal corresponding to the pin with the current pin number is output to the power supply module, so that the power supply module supplies power to the pin with the current pin number according to the first power supply signal, and controls the other pins to be grounded. The first detection step is to detect whether the target encoder is in a powered-on state. If it is in a powered-on state, the pin with the current pin number is determined to be the positive power supply pin. When not in a powered-on state, the first power supply step and the first detection step are repeated at least once in ascending order of sequence number until one of the pins is identified as the positive power supply pin.
4. The method according to claim 2, characterized in that, The step of determining the negative power supply pin among the plurality of pins based on the pin number includes: The second power supply step involves outputting the second power supply signal corresponding to the pin with the current pin number to the power supply module, so that the power supply module controls the pin with the current pin number to be grounded and supplies power to the other pins according to the second power supply signal. The second detection step is to detect whether the target encoder is in a powered-on state. If it is in a powered-on state, the pin with the current pin number is determined to be the negative power supply pin. When the device is not powered on, the second power supply step and the second detection step are repeated at least once in ascending order of sequence number until one of the pins is identified as the negative power supply pin.
5. The method according to claim 3, characterized in that, The first power supply step includes: Obtain the preset power supply amplitude of the target encoder; According to the preset power amplitude, a first power supply signal is output to the power supply module, wherein the voltage amplitude of the first power supply signal is equal to or lower than the preset power amplitude.
6. The method according to claim 4, characterized in that, The second power supply step includes: Obtain the preset power supply amplitude of the target encoder; According to the preset power amplitude, a second power supply signal is output to the power supply module, wherein the voltage amplitude of the second power supply signal is equal to or lower than the preset power amplitude.
7. The method according to claim 1, characterized in that, The step of modulating the output signal of the target encoder according to the type of the target encoder includes: Based on the type of the target encoder, obtain the preset signal amplitude and preset error parameters of the target encoder; The output signal of the target encoder is modulated based on the preset signal amplitude, the preset error parameter, and the amplitude of the output signals of the multiple pins.
8. The method according to claim 7, characterized in that, The step of modulating the output signal of the target encoder based on the preset signal amplitude, the preset error parameter, and the amplitudes of the output signals of the plurality of pins includes: Calculate the absolute value of the difference between the amplitude of the output signal of each pin and the amplitude of the preset signal; Determine whether the absolute value of the difference is greater than the preset error parameter, and output the first determination result; If the first judgment result indicates yes, determine whether the amplitude of the output signal of the pin is greater than the preset signal amplitude, and output the second judgment result; If the second judgment result indicates yes, a first adjustment signal is output to the target encoder, so that the target encoder reduces the amplitude of the output signal of the pin according to the first adjustment signal until the absolute value of the difference between the output signal of the pin and the amplitude of the preset signal is equal to the preset error parameter. If the second judgment result indicates no, a second adjustment signal is output to the target encoder, so that the target encoder increases the amplitude of the output signal of the pin according to the second adjustment signal until the absolute value of the difference between the output signal of the pin and the preset signal amplitude is equal to the preset error parameter.
9. The method according to claim 8, characterized in that, The target encoder is mounted on the motor, and the method further includes: Identify the target signal type of the output signal for each of the pins; When the target signal type is an analog signal, a control signal is output to the analog signal modulation module, so that the analog signal modulation module modulates the control signal into an analog control signal and outputs it to the target encoder; When the target signal type is a digital signal, a control signal is output to the digital signal modulation module, so that the digital signal modulation module modulates the control signal into a digital control signal and outputs it to the target encoder.
10. The method according to claim 9, characterized in that, Also includes: Obtain the preset interface position corresponding to the type of the target encoder; Determine the output interface position of the target encoder, wherein the output interface position is used to output the interface signal of the target encoder; Adjust the output interface position to the preset interface position.
11. The method according to any one of claims 1 to 6, characterized in that, Also includes: A cut-off signal is output to the power control module so that the power control module stops supplying power to the functional interface according to the cut-off signal, wherein the functional interface includes at least one of the following: a communication interface, a brake interface, and an emergency stop interface.
12. A signal processing circuit, characterized in that, include: Encoder interface, used to connect to the target encoder; A sampling module, electrically connected to the encoder interface, is used to output sampled data of the interface signal of the target encoder, wherein the sampled data includes multiple output signal amplitudes corresponding to multiple pins of the target encoder; The processor, electrically connected to the sampling module, is used to identify whether the target encoder is powered on. When the target encoder is detected to be powered on, the processor acquires the sampling data, determines the type of the target encoder based on the sampling data, and modulates the output signal of the target encoder based on the type of the target encoder. Determining the type of the target encoder based on the sampling data includes: determining the waveform of the output signal of the multiple pins based on the amplitude of the multiple output signals; and determining the type of the target encoder based on the waveform of the output signal and a waveform database, wherein the waveform database includes: multiple historical waveform data and multiple encoder types corresponding one-to-one with the multiple historical waveform data.
13. The signal processing circuit according to claim 12, characterized in that, Also includes: The power control module is electrically connected to the processor and the function interface respectively, and is used to receive the cut-off signal sent by the processor and stop supplying power to the function interface according to the cut-off signal. The function interface includes at least one of the following: a communication interface, a brake interface, and an emergency stop interface.
14. The signal processing circuit according to claim 12, characterized in that, Also includes: An interface conversion module is electrically connected to the processor and the encoder interface, respectively, and is used to adjust the output interface position of the target encoder to a preset interface position corresponding to the type of the target encoder. The output interface position is used to output the interface signal of the target encoder.
15. The signal processing circuit according to claim 14, characterized in that, Also includes: An analog signal modulation module is electrically connected to the processor and the mode selection switch module, respectively, and is used to modulate the control signal output by the processor into an analog control signal and output it to the target encoder; A digital signal modulation module is electrically connected to the processor and the mode selection switch module, respectively, and is used to modulate the control signal output by the processor into a digital control signal and output it to the target encoder; The mode selection switch module is electrically connected to the interface conversion module and is used to turn on the analog signal modulation module or the digital signal modulation module according to the signal type of the output signal.
Citation Information
Patent Citations
Incremental magnetic induction bus type encoder for high-speed high-precision machine tool main shaft and electric main shaft
CN106625020A
Encoder signal detection circuit compatible with different types of encoders
CN110260906A
Encoder and control apparatus for motor
CN1658492A
Encoder processing circuit and converter
CN206531513U