CN114362879A - Encoder and communication control method for encoder - Google Patents

Encoder and communication control method for encoder Download PDF

Info

Publication number
CN114362879A
CN114362879A CN202111121786.9A CN202111121786A CN114362879A CN 114362879 A CN114362879 A CN 114362879A CN 202111121786 A CN202111121786 A CN 202111121786A CN 114362879 A CN114362879 A CN 114362879A
Authority
CN
China
Prior art keywords
speed
communication
count value
shift register
control signal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111121786.9A
Other languages
Chinese (zh)
Other versions
CN114362879B (en
Inventor
百濑正吾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nidec Sankyo Corp
Original Assignee
Nidec Sankyo Corp
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 Nidec Sankyo Corp filed Critical Nidec Sankyo Corp
Publication of CN114362879A publication Critical patent/CN114362879A/en
Application granted granted Critical
Publication of CN114362879B publication Critical patent/CN114362879B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Communication Control (AREA)
  • Transmission And Conversion Of Sensor Element Output (AREA)
  • Arrangements For Transmission Of Measured Signals (AREA)

Abstract

An encoder and a communication control method thereof, which can communicate with an external device such as a computer by using a communication line connecting the encoder and a control device. The encoder (1) includes a communication unit (12) capable of communicating at a first speed or a second speed via a communication line (2). The encoder performs bidirectional communication at a first speed with a control device (3) connected via a communication line, and transmits position information (P) to the control device each time an inquiry command (O1) from the control device is received at a first cycle (T1). The communication unit includes a communication speed setting unit (16) which switches the communication speed to a second speed if the communication speed is set to the first speed and if a predetermined control signal is received a plurality of times at a second period (T2) longer than the first period (S1) and if the control signal is not received at the first time (S1) after the second period and the predetermined time have elapsed after the control signal is received last (S1).

Description

Encoder and communication control method for encoder
Technical Field
The present invention relates to an encoder that communicates with an external device via a communication line that transmits position information, and a communication control method for the encoder.
Background
The encoder is attached to a drive driving source and operates the movable portion. The position information output from the encoder is transmitted to the control device via the communication line. The control device performs drive control of the drive source based on the received position information. The drive source is, for example, a motor. The device is, for example, an industrial robot.
It is sometimes necessary to set the resolution of the encoder after the encoder is installed, matching the use environment and use. Further, it is sometimes necessary to set an origin position as a reference of the position information to the encoder after the encoder is attached. Patent document 1 describes an encoder that can change settings in accordance with a signal input to the encoder from an external device.
Documents of the prior art
Patent document
Patent document 1: japanese laid-open patent publication No. 11-178303
Disclosure of Invention
Technical problem to be solved by the invention
When setting an encoder, if a computer operating an application software for encoder setting is connected to the encoder and a setting command issued by the application software is transmitted to the encoder, the setting operation becomes easy. In addition, in this case, the encoder can be set before the encoder is connected to the control device.
Here, when the encoder is connected to the computer, if a dedicated communication line is prepared separately from the communication line connecting the encoder and the control device, the connection between the encoder and the computer becomes easy. However, in this case, the number of communication lines increases, and therefore the diameter of the cable that collects them increases, which may hinder downsizing of the device to which the encoder is attached.
On the other hand, if the encoder is connected to the computer by a communication line connecting the encoder and the control device, the number of communication lines does not increase. However, in general, the communication speed of communication between the encoder and the control device is significantly faster than the communication speed of communication between the computer and the external device. Therefore, even if the encoder and the computer are connected via the communication line and the setting command is transmitted from the computer, information loss due to the communication speed or the like occurs, and the control command may not be recognized on the encoder side.
The technical problem of the present invention is to provide an encoder and a communication controller of the encoder, which can communicate with an external device such as a computer using a communication line connecting the encoder and a control device.
Technical scheme for solving technical problem
In order to solve the above-mentioned problems, an encoder according to the present invention includes a communication unit capable of performing communication at a first speed or a second speed slower than the first speed via a communication line, performing the bidirectional communication at the first speed with a control device connected via the communication line, each time an inquiry command is received from the control device at a first cycle, and an encoder for transmitting position information to the control device, wherein the communication unit includes a communication speed setting unit, if a prescribed control signal is received a plurality of times at a second period longer than the first period while the communication speed of the communication is set to the first speed, and the communication speed setting unit switches the communication speed to the second speed if the control signal is not received at a first time when the second period and the predetermined time have elapsed after the control signal is finally received.
According to the present invention, if the control signal is not received at the first time when the second cycle and the predetermined time have elapsed after the control signal is received a plurality of times at the second cycle longer than the first cycle when the communication speed of the communication via the communication line is set to the first speed, the communication unit switches the communication speed from the first speed to the second speed. Here, when the encoder is set, the control signal is transmitted from an external device connected to the communication line to the encoder. The second cycle of the control signal is longer than the first cycle of the interrogation command transmitted from the control device to the encoder in order to acquire the position information. Therefore, even when the communication speed at which the external device performs communication is the second speed slower than the first speed, the external device can easily transmit the control signal at the second cycle. Further, since the second cycle of the control signal is longer than the first cycle of the inquiry command, the communication speed setting unit can distinguish the control signal from the inquiry command and recognize the control signal. Therefore, the communication speed setting unit can set the communication speed to the second speed suitable for the external device when receiving the control signal. After the communication speed is set to the second speed lower than the first speed, a reception setting command or the like can be transmitted between the external device and the encoder without losing information.
Here, depending on the installation environment of the encoder, an unexpected signal may be carried on the communication line due to magnetic noise, static electricity, or the like, and the signal may be input to the encoder. If the unexpected signal matches or closely resembles a control signal from an external device, an error may occur when the encoder is connected to the control device and the control device controls the driving of the device, causing the communication speed setting unit to malfunction and switch the communication speed from the first speed to the second speed. With respect to the above problem, in the present invention, the switching of the communication speed requires the control signal to be received a plurality of times at the predetermined second cycle. Furthermore, it is necessary that the control signal is not received in the next second period after the control signal is received a plurality of times. Thus, the communication speed setting unit can distinguish between the reception modes of the signal due to the magnetic noise or the like and the control signal for switching the communication speed. Therefore, it is possible to prevent or suppress the occurrence of malfunction in the communication speed setting unit.
In the present invention, the communication speed setting unit may include: a timer which sets a count value to 0 and starts counting when receiving the control signal; a first determination unit that determines that the count value has reached a first count value longer than the first period and shorter than the second period; a second determination unit that determines that the count value has reached a second count value that is longer than the second cycle by a predetermined time; a shift register; a register control unit that controls the shift register; a storage unit that stores and holds a preset set value; and a setting unit that sets the communication speed to the second speed, wherein when the control signal is first received, the register control unit sets all bits (bit) of the shift register to 0, wherein each time the count value reaches the first count value, the register control unit shifts the bits of the shift register to input 1, wherein when the count value reaches the second count value, the register control unit shifts the bits of the shift register to input 0, wherein when 0 is input to the shift register, the setting unit compares the setting value with the value of the shift register, and sets the communication speed to the second speed when the value of the shift register matches the setting value. In this way, it is possible to distinguish between reception modes of a signal due to magnetic noise or the like and a control signal for switching a communication speed, using a timer, a shift register, and a setting value stored and held in a storage unit.
An encoder according to another aspect of the present invention includes a communication unit capable of performing communication at a first speed or a second speed slower than the first speed via a communication line, the encoder performing bidirectional communication at the first speed with a control device connected via the communication line, and transmitting position information to the control device each time an inquiry command from the control device is received at a first cycle, wherein the communication unit includes a communication speed setting unit configured to, if a predetermined control signal is received a plurality of times at a second cycle longer than the first cycle when the communication speed of the communication is set at the first speed, and the control signal is not received at a first time when the second cycle and a predetermined time have elapsed after the control signal was last received, set an interval between two control signals received after the first cycle, the communication speed setting section switches the communication speed to the second speed.
According to the present invention, if the communication speed of communication via the communication line is set to the first speed, and if the control signal is not received at the first time when the second cycle and the predetermined time have elapsed after the control signal is received a plurality of times at the second cycle longer than the first cycle, the communication unit switches the communication speed from the first speed to the second speed if the interval between the two control signals received thereafter is the second cycle. Here, when the encoder is set, the control signal is transmitted from an external device connected to the communication line to the encoder. The second cycle of the control signal is longer than the first cycle of the interrogation command transmitted from the control device to the encoder in order to acquire the position information. Therefore, even when the communication speed at which the external device performs communication is the second speed slower than the first speed, the external device can easily transmit the control signal at the second cycle. Further, since the second cycle of the control signal is longer than the first cycle of the inquiry command, the communication speed setting unit can distinguish the control signal from the inquiry command and recognize the control signal. Therefore, the communication speed setting unit can set the communication speed to the second speed suitable for the external device when receiving the control signal. After the communication speed is set to the second speed lower than the first speed, a reception setting command or the like can be transmitted between the external device and the encoder without losing information.
Here, depending on the installation environment of the encoder, an unexpected signal may be carried on the communication line due to magnetic noise, static electricity, or the like, and the signal may be input to the encoder. If the unexpected signal matches or closely resembles a control signal from an external device, an error may occur when the encoder is connected to the control device and the control device controls the driving of the device, causing the communication speed setting unit to malfunction and switch the communication speed from the first speed to the second speed. With respect to the above problem, in the present invention, the switching of the communication speed requires the control signal to be received a plurality of times at the predetermined second cycle. Furthermore, it is necessary that the control signal is not received in the next second period after the control signal is received a plurality of times, and two control signals are received at intervals of the second period thereafter. Thus, the communication speed setting unit can distinguish between the reception modes of the signal due to the magnetic noise or the like and the control signal for switching the communication speed. Therefore, it is possible to prevent or suppress the occurrence of malfunction in the communication speed setting unit.
In the present invention, the communication speed setting unit may include: a timer which sets a count value to 0 and starts counting when receiving the control signal; a first determination unit that determines that the count value has reached a first count value longer than the first period and shorter than the second period; a second determination unit that determines that the count value has reached a second count value that is longer than the second cycle by a predetermined time; a shift register; a register control unit that controls the shift register; a storage unit that stores and holds a preset set value; and a setting unit that sets the communication speed to the second speed, and when the control signal is first received, the register control unit sets all bits of the shift register to 0, shifts the bits of the shift register to input 1 whenever the count value reaches the first count value, when the count value reaches the second count value, the register control section shifts the bits of the shift register to input 0, the setting unit compares the setting value with the value of the shift register when the count value reaches a third count value that matches the length of the second cycle after 0 is input to the shift register, and sets the communication speed to the second speed when the value of the shift register matches the set value. In this way, it is possible to distinguish between reception modes of a signal due to magnetic noise or the like and a control signal for switching a communication speed, using a timer, a shift register, and a setting value stored and held in a storage unit.
In the present invention, the communication unit may include an initial setting unit that sets the communication speed to the first speed when the power supply is turned on. In this way, the communication speed of communication via the communication line can be set to the first speed when the encoder is powered on. Therefore, when the power of the encoder is turned off and the power is turned on again after the communication at the second speed with the external device is performed, the communication speed can be returned to the first speed.
Next, a communication control method of an encoder according to the present invention is a communication control method of an encoder including a communication unit capable of performing communication at a first speed or a second speed slower than the first speed via a communication line, the encoder performing bidirectional communication at the first speed with a control device connected via the communication line, and transmitting position information to the control device each time an inquiry command from the control device is received at a first cycle, the communication control method including a communication speed setting step of, if a predetermined control signal is received a plurality of times at a second cycle longer than the first cycle when a communication speed of the communication is set at the first speed, and the control signal is not received at a first time when the second cycle and a predetermined time have elapsed after the control signal was last received, the communication speed is switched to the second speed.
According to the present invention, if the control signal is not received at a time when the second cycle and the predetermined time have elapsed after the control signal is received in the encoder a plurality of times at the second cycle when the control signal is transmitted from the external apparatus connected to the encoder via the communication line, the communication speed is switched from the first speed to the second speed. Therefore, after the communication speed is set to the second speed, a reception setting command or the like can be transmitted between the external device and the encoder without losing information. Here, since the second period of the control signal is longer than the first period of the command, the communication speed setting unit can distinguish the control signal from the inquiry command and recognize the control signal. Further, since the communication speed setting unit needs to receive the control signal in a predetermined reception mode in order to switch the communication speed to the second speed, it is possible to distinguish between a signal due to magnetic noise or the like and a reception mode of the control signal for switching the communication speed. Therefore, switching of the communication speed by the encoder due to malfunction can be prevented or suppressed.
In the present invention, the communication unit may include: a timer which sets a count value to 0 and starts counting when receiving the control signal; a first determination unit that determines that the count value has reached a first count value longer than the first period and shorter than the second period; a second determination unit that determines that the count value has reached a second count value that is longer than the second cycle by a predetermined time; a shift register; and a storage unit that stores and holds a preset set value, wherein the communication speed setting step includes: a register control step of setting all bits of the shift register to 0 when the control signal is first received, shifting the bits of the shift register to input 1 each time the count value reaches the first count value, and shifting the bits of the shift register to input 0 when the count value reaches the second count value; and a setting step of comparing the set value with the value of the shift register when 0 is input to the shift register, and setting the communication speed to the second speed when the value of the shift register matches the set value. In this way, it is possible to distinguish between reception modes of a signal due to magnetic noise or the like and a control signal for switching a communication speed, using a timer, a shift register, and a setting value stored and held in a storage unit.
Next, a communication control method of an encoder according to another aspect of the present invention is a communication control method of an encoder including a communication unit capable of performing communication at a first speed or a second speed slower than the first speed via a communication line, the encoder performing bidirectional communication at the first speed with a control device connected via the communication line, and transmitting position information to the control device each time an inquiry command from the control device is received in a first cycle, the communication control method including a communication speed setting step of, if a predetermined control signal is received a plurality of times in a second cycle longer than the first cycle when a communication speed of the communication is set to the first speed, and if the control signal is not received at a first time when the second cycle and a predetermined time have elapsed after the control signal was last received, and switching the communication speed to the second speed if the interval between the two received control signals is the second period.
According to the present invention, if, when a control signal is transmitted from an external device connected to an encoder via a communication line, the control signal is not received at a time when a predetermined time and a second period have elapsed after the control signal is received at the encoder a plurality of times at the second period, and the interval between the two control signals received thereafter is the second period, the communication speed is switched from the first speed to the second speed. Therefore, after the communication speed is set to the second speed, a reception setting command or the like can be transmitted between the external device and the encoder without losing information. Here, since the second period of the control signal is longer than the first period of the command, the communication speed setting unit can distinguish the control signal from the inquiry command and recognize the control signal. Further, since the communication speed setting unit needs to receive the control signal in a predetermined reception mode in order to switch the communication speed to the second speed, it is possible to distinguish between a signal due to magnetic noise or the like and a reception mode of the control signal for switching the communication speed. Therefore, switching of the communication speed by the encoder due to malfunction can be prevented or suppressed.
In the present invention, the communication unit may include: a timer which sets a count value to 0 and starts counting when receiving the control signal; a first determination unit that determines that the count value has reached a first count value longer than the first period and shorter than the second period; a second determination unit that determines that the count value has reached a second count value that is longer than the second cycle by a predetermined time; a shift register; and a storage unit that stores and holds a preset set value, wherein the communication speed setting step includes: a register control step of setting all bits of the shift register to 0 when the control signal is first received, shifting the bits of the shift register to input 1 each time the count value reaches the first count value, and shifting the bits of the shift register to input 0 when the count value reaches the second count value; and comparing the set value with the value of the shift register when the count value becomes 0 when the count value reaches a third count value that coincides with the length of the second period after 0 is input to the shift register, and setting the communication speed to the second speed when the value of the shift register coincides with the set value. In this way, it is possible to distinguish between reception modes of a signal due to magnetic noise or the like and a control signal for switching a communication speed, using a timer, a shift register, and a setting value stored and held in a storage unit.
In the present invention, the communication apparatus may further include an initial setting step of setting the communication speed to the first speed when the power supply is turned on. In this way, the communication speed of communication via the communication line can be set to the first speed when the encoder is powered on. Therefore, if the power of the encoder is turned off and the power is turned on again after the communication at the second speed is performed with the external device, the communication speed can be returned to the first speed.
Effects of the invention
According to the present invention, when the control signal is transmitted from the external device connected to the encoder via the communication line, the communication speed is set to the second speed based on the reception mode of the control signal. If the communication speed is set to a second speed suitable for an external device, the encoder side can receive information without losing information included in a setting command when various setting commands such as a setting command are transmitted from the external device thereafter. Therefore, the encoder can update its own setting and control program based on the setting instruction.
Drawings
Fig. 1 is a schematic explanatory view of a control system of an encoder to which the present invention is applied.
Fig. 2 is an explanatory diagram of communication performed between the encoder and the control device.
Fig. 3 is an explanatory diagram of a reception mode of a control signal for changing the communication speed.
Fig. 4 is an explanatory diagram of a setting operation for setting the encoder.
Fig. 5 is an explanatory diagram of a reception mode of the control signal when the communication speed setting unit of the modification changes the communication speed.
(symbol description)
1, an encoder; 2 a communication line; 3 a control device; 5, a sensor; 6 a control unit; 7 setting storage part; 11 a position information generating unit; 12 a communication unit; 15 an initial setting unit; 16 a communication speed setting unit; 17 a timer; 18 a first judgment unit; 19 a second judgment section; 20 shift registers; 21 a register control unit; 22 a storage section; 23 a setting unit; 100 computers; an O1 Inquiry instruction; o2 set command; s1 control signals; t1 first period; t2 second cycle.
Detailed Description
Hereinafter, an embodiment of an encoder to which the present invention is applied will be described with reference to the drawings.
(encoder)
Fig. 1 is a schematic explanatory view of a control system of an encoder to which the present invention is applied. Fig. 2 is an explanatory diagram of communication performed between the encoder and the control device. Fig. 3 is an explanatory diagram of a reception mode of a control signal for changing the communication speed of the encoder. Fig. 4 is an explanatory diagram of a setting operation for setting the encoder.
The encoder 1 is attached to a device that drives a driving source to operate a movable portion. As shown in fig. 1, the position information output from the encoder 1 is transmitted to a control device 3 for driving and controlling the device via a communication line 2. The control device 3 performs drive control of the drive source based on the received position information. In the following description, the drive source is a motor, and the device is an industrial robot. The control device 3 is a dedicated device for controlling the industrial robot. The control device 3 controls the operation of the industrial robot by controlling the driving of the motor based on the position information from the encoder 1.
The encoder 1 includes a sensor 5, a control unit 6 connected to an output side of the sensor 5, and a setting storage unit 7 connected to the control unit 6. The sensor 5 is a magnetic sensor and detects magnetic flux of a magnet fixed to the motor shaft. The magnet is provided separately from the driving magnet of the motor in order to detect the rotational angle position of the rotary shaft.
The control section 6 includes a CPU and a memory. The control unit 6 includes a position information generating unit 11, and the position information generating unit 11 generates position information indicating a rotational angle position of the rotating shaft based on an output from the sensor 5. The setting storage unit 7 stores and holds various kinds of setting information of the encoder 1 such as the resolution of the position information generated by the position information generating unit 11 and the origin position as a reference of the position information. The position information generating unit 11 generates position information based on the setting information. The setting storage unit 7 is a rewritable nonvolatile memory. The setting of the encoder 1 can be changed by rewriting the setting information of the setting storage section 7.
The encoder 1 includes a communication unit 12 connected to the control unit 6. The communication line 2 is connected to the communication unit 12. The communication unit 12 is capable of bidirectional communication between an external device and the control unit 6 via the communication line 2. In this example, the communication unit 12 can perform half-duplex communication with an external device. The communication unit 12 communicates with an external device at a first speed or a second speed slower than the first speed. In this example, the first speed is 4 Mbps. The second speed is 38400 bps.
The communication unit 12 includes an initial setting unit 15, and the initial setting unit 15 sets the communication speed to a first speed when the encoder 1 is powered on. The communication unit 12 includes a communication speed setting unit 16, and when the predetermined control signal S1 is received in a predetermined reception mode when the communication speed is set to the first speed, the communication speed setting unit 16 switches the communication speed from the first speed to the second speed.
Here, as shown in fig. 2, communication between the encoder 1 and the control device 3 is performed at a first speed (4 Mbps). An inquiry command O1 inquiring about the rotational angle position of the rotor is transmitted from the control device 3 at the first cycle T1. Each time the inquiry command O1 is received at the first cycle T1, the control unit 6 transmits the position information P to the control device 3 via the communication unit 12. In this example, the first period T1 is 50 μ s.
When the communication speed is set to the first speed, if the predetermined control signal S1 is received a plurality of times at the second period T2 longer than the first period T1 and the control signal S1 is not received at the first time when the second period T2 and the predetermined time have elapsed after the control signal S1 was last received, the communication speed setting unit 16 performs a speed setting operation for switching the communication speed from the first speed to the second speed. As shown in fig. 3, in the present example, the control signal S1 is received twice in the second period T2 while the communication speed is set to the second speed. The second period T2 was 0.5 s.
More specifically, as shown in fig. 1, the communication speed setting unit 16 includes: a timer 17; a first determination unit 18, wherein the first determination unit 18 determines that the count value of the timer 17 reaches a predetermined first count value; and a second determination unit 19, wherein the second determination unit 19 determines that the count value of the timer 17 reaches a predetermined second count value. Further, the communication speed setting unit 16 includes: a shift register 20; a register control unit 21, the register control unit 21 controlling the shift register 20; a storage unit 22 for storing and holding a preset set value in the storage unit 22; and a setting unit 23, the setting unit 23 setting the communication speed to the second speed.
The timer 17 monitors the command and the control signal S1 received by the communication unit 12 via the communication line 2, and when the communication unit 12 receives the inquiry command O1 and the control signal S1, resets the count value to 0 to restart the counting. The first determination unit 18 determines that the count value of the timer 17 has reached the first count value longer than the first period T1 and shorter than the second period T2. The timer 17 of the present example counts from 0 to 1000050 in the second period T2. The first count value is a value obtained when the timer 17 counts for a period shorter than the second period T2 by a predetermined time. The prescribed time is a time below the first period T1 and the timer 17 counts from 0 to 50. Therefore, the first count value is 1000000. The second determination unit 19 determines that the count value of the timer 17 has reached a second count value counted for a predetermined time period longer than the second period T2. The second count value is 1000100.
The register control unit 21 controls the shift register 20 based on the control signal S1 and the determination results of the first determination unit 18 and the second determination unit 19. Upon first receiving the control signal S1, the register control unit 21 sets all bits of the shift register 20 to 0. Each time the count value reaches the first count value, the register control unit 21 shifts the bit of the shift register 20 to the left and inputs 1. When the count value reaches the second count value, the register control unit 21 shifts the bit of the shift register 20 to the left and inputs 0.
When 0 is input to the shift register 20, the setting unit 23 compares the set value with the value of the shift register 20 with reference to the storage unit 22. In other words, when the second determination unit 19 determines that the count value of the timer 17 has reached the second count value, the setting unit 23 compares the values of the shift register 20. When the value of the shift register 20 matches the set value, the setting unit 23 sets the communication speed to the second speed. In this example, in the case where the value of the shift register 20 coincides with the set value "00001110", the communication speed is set to the second speed.
(communication of encoder and control device)
Here, communication between the encoder and the control device will be described with reference to fig. 2. When communication is performed during communication between the encoder 1 and the control device 3, the encoder 1 and the control device 3 are connected via the communication line 2. Then, the power of the encoder 1 is turned on. When the power is turned on, the initial setting unit 15 sets the communication speed of the encoder 1 to the first speed.
When the encoder 1 is connected to the control device 3, the control device 3 transmits an inquiry command O1 to the encoder 1 at a first cycle T1. On the other hand, each time the inquiry command O1 is received, the control unit 6 of the encoder 1 transmits the position information P to the control device 3. Here, each time the communication unit 12 receives the inquiry command O1, the timer 17 resets its count value to 0. The register control unit 21 sets all bits of the shift register 20 to 0 when the encoder 1 is powered on.
(communication of encoder with computer)
Next, when the encoder 1 needs to be set, the encoder 1 and the computer 100 are connected via the communication line 2 as shown by the broken line in fig. 1. Then, the computer 100 operates the application software for encoder setting, and transmits a setting command O2 issued by the application software to the encoder 1. The setting command O2 is a command for operating the control unit 6 of the encoder 1 to rewrite the setting information of the setting storage unit 7 to a desired value.
Here, the first speed (4Mbps) of communication performed between the encoder 1 and the control apparatus 3 is significantly faster than the second speed (38400bps) of communication performed between the computer 100 and an external device. Therefore, when the communication speed of the encoder 1 is set to the first speed, even if the setting command O2 is transmitted from the computer 100 to the encoder 1 via the communication line 2, the setting command O2 may not be recognized on the encoder 1 side, and the setting information may not be rewritten to a desired value. That is, there is a case where information included in the setting command O2 is missing due to a difference between the second speed of communication performed by the computer 100 and the first speed of communication performed by the encoder 1, and the setting command O2 cannot be recognized on the encoder 1 side.
Therefore, as shown in fig. 4, in the setting operation for setting the encoder 1, first, a communication speed setting step of switching the communication speed of the communication performed between the encoder 1 and the computer 100 from the first speed to the second speed is performed (step ST 1). Next, a setting information rewriting step is performed in which the computer 100 transmits a setting command O2 to the encoder 1 to rewrite the setting information of the encoder 1 to change its setting (step ST 2).
In the communication speed setting step (ST1), the encoder 1 monitors the control signal S1 received via the communication line 2. When the encoder 1 receives the control signal S1 in the predetermined reception mode, the communication speed is set to the second speed. More specifically, as shown in fig. 3, the encoder 1 sets all bits of the shift register 20 to 0 when initially receiving the control signal S1. The encoder 1 shifts the bits of the shift register 20 to input 1 each time the count value reaches the first count value, and the encoder 1 shifts the bits of the shift register 20 to input 0 each time the count value reaches the second count value. When 0 is input to the shift register 20, the encoder 1 refers to the storage unit 22 and compares the set value with the value of the shift register 20. Here, when the value of the shift register 20 matches the set value, the encoder 1 sets the communication speed to the second speed.
In the setting information rewriting step (step ST2), the encoder 1 receives the setting command O2 transmitted at the second speed from the computer 100. Upon receiving the setting command O2, the encoder 1 rewrites the setting information recorded in the setting storage unit 7 based on the setting command O2. Thereby, the setting of the encoder 1 is changed.
Here, the transmission and reception of the setting command O2 are performed at the second speed. Therefore, the encoder 1 can receive the setting command O2 without losing information and the like contained therein. Therefore, the encoder 1 can set itself based on the setting instruction O2. In the encoder 1, the firmware operated by the control unit 6 may be updated by the setting command O2.
After the setting of the encoder 1 is changed by the setting instruction O2, the power supply of the encoder 1 is temporarily turned off, and then the power supply is turned on again. Thus, the encoder 1 sets the communication speed of communication via the communication line 2 to the first speed. Therefore, if the encoder 1 and the control device 3 are connected via the communication line 2, bidirectional communication at the first speed can be performed between the control device 3 and the encoder 1. Therefore, after the encoder 1 and the control device 3 are connected, the encoder 1 receives the inquiry command O1 from the control device 3 at the first speed, and transmits the position information P to the control device 3 at the first speed.
(Effect)
According to the present invention, if the control signal S1 is not received at the first timing when the second period T2 and the prescribed time have elapsed after the control signal S1 is received a plurality of times at the second period T2 longer than the first period T1 while the communication speed of the communication via the communication line 2 is set to the first speed, the communication section 12 switches the communication speed from the first speed to the second speed. Here, the second cycle T2 of the control signal S1 is longer than the first cycle T1 of the inquiry command O1 sent from the control device 3 to the encoder 1 in order to acquire the position information P. Therefore, even when the communication speed at which the external device performs communication is the second speed slower than the first speed, the control signal S1 is easily transmitted from the external device at the second period T2. Further, since the second period T2 of the control signal S1 is longer than the first period T1 of the inquiry command O1, the communication speed setting portion 16 can distinguish the control signal S1 from the inquiry command O1 and recognize the control signal S1. Therefore, upon receiving the control signal S1, the communication speed setting unit 16 can set the communication speed to the second speed suitable for the external device. This makes it possible to transmit and receive the setting command O2 and the like between the external device and the encoder 1 without losing information.
Here, depending on the installation environment of the encoder 1, an unexpected signal may be carried on the communication line 2 due to magnetic noise, static electricity, or the like, and the signal may be input to the encoder 1. If the unexpected signal matches or closely resembles the control signal S1 from the external device, the communication speed setting unit 16 may malfunction and switch the communication speed from the first speed to the second speed when the encoder 1 is connected to the control device 3 and the control device 3 performs drive control of the device. For the above problem, in the present example, the switching of the communication speed requires the control signal S1 to be received a plurality of times at the predetermined second period T2. Also, it is required that the control signal S1 is not received in the next second period T2 after the control signal S1 is received a plurality of times. Thus, the communication speed setting unit 16 can distinguish between the reception modes of the signal due to magnetic noise or the like and the control signal S1 for switching the communication speed, and therefore, malfunction of the communication speed setting unit 16 can be prevented or suppressed.
Further, according to this example, the reception mode of the signal due to magnetic noise or the like and the control signal S1 for switching the communication speed can be distinguished using the timer 17, the shift register 20, and the setting value stored and held in the storage unit 22.
In addition, in the present example, the number of times the control signal S1 is received in the second period T2 may be set to three or more times by changing the set value stored and held in the storage unit 22. This complicates the reception mode of the control signal S1. Therefore, it is possible to more reliably distinguish between the reception patterns of the signal due to magnetic noise or the like and the control signal S1 for switching the communication speed.
(Another example of the communication speed setting section)
Next, the communication speed setting unit 16 of the modification will be described with reference to fig. 5. Fig. 5 is an explanatory diagram of a reception mode of the control signal when the communication speed setting unit 16 of the modification changes the communication speed. The communication speed setting unit 16 of the present example includes, similarly to the communication speed setting unit 16: a timer 17; a first determination unit 18 for determining that the count value has reached a first count value by the first determination unit 18; and a second determination unit 19 for determining that the count value has reached the second count value 19. Further, the communication speed setting unit 16 of the present example includes, similarly to the communication speed setting unit 16 described above: a shift register 20; a register control unit 21, the register control unit 21 controlling the shift register 20; a storage unit 22; and a setting unit 23, the setting unit 23 setting the communication speed to the second speed. The first count value and the second count value are the same as the first count value and the second count value of the communication speed setting unit 16. The set value stored and held in the storage unit 22 is different from the set value stored and held in the storage unit 22 of the communication speed setting unit 16. The register control unit 21 controls the shift register 20 based on the control signal S1 and the determination results of the first determination unit 18 and the second determination unit 19.
If the control signal S1 is received a plurality of times in the second period T2 while the communication speed is set to the first speed, and if the control signal S1 is not received at the first time when the second period T2 and the prescribed time have elapsed after the control signal S1 was last received, the interval between the two control signals S1 received thereafter is the second period T2, the communication speed setting portion 16 of the present example switches the communication speed to the second speed.
More specifically, the register control section 21 sets all bits of the shift register 20 to 0 when it first receives the control signal S1. Each time the count value reaches the first count value, the register control unit 21 shifts the bit of the shift register 20 to the left and inputs 1. When the count value reaches the second count value, the register control unit 21 shifts the bit of the shift register 20 to the left and inputs 0. When the count value reaches the third count value that matches the length of the second period T2 after 0 is input to the shift register 20, the setting unit 23 compares the set value with the value of the shift register 20. When the value of the shift register 20 matches the set value, the setting unit 23 sets the communication speed to the second speed.
Thus, in the communication speed setting step (ST1), the encoder 1 sets all bits of the shift register 20 to 0 when it first receives the control signal S1. The encoder 1 shifts the bits of the shift register 20 to input 1 each time the count value reaches the first count value, and the encoder 1 shifts the bits of the shift register 20 to input 0 each time the count value reaches the second count value. When the count value reaches the third count value that matches the length of the second period T2 after 0 is input to the shift register 20 and the count value becomes 0, the encoder 1 compares the set value with the value of the shift register 20 and sets the communication speed to the second speed when the value of the shift register 20 matches the set value.
In the setting information rewriting step (step ST2), the encoder 1 receives the setting command O2 transmitted at the second speed from the computer 100. Upon receiving the setting command O2, the encoder 1 rewrites the setting information recorded in the setting storage unit 7 based on the setting command O2. Thereby, the setting of the encoder 1 is changed. Here, the transmission and reception of the setting command O2 are performed at the second speed. Therefore, the encoder 1 can receive the setting command O2 without losing information and the like contained therein. Therefore, the encoder 1 can set itself based on the setting instruction O2.
After the setting of the encoder 1 is changed by the setting instruction O2, the power supply of the encoder 1 is temporarily turned off, and then the power supply is turned on again. Thus, the encoder 1 sets the communication speed of communication via the communication line 2 to the first speed. Therefore, if the encoder 1 and the control device 3 are connected via the communication line 2, bidirectional communication at the first speed can be performed between the control device 3 and the encoder 1. Therefore, the encoder 1 receives the inquiry command O1 from the control device 3 at the first speed, and transmits the position information P to the control device 3 at the first speed.
When the communication speed setting unit 16 of the present example is included, the encoder 1 can also obtain the same operational effects as the above-described encoder 1.
Here, in the reception mode of the control signal S1 of the present example, a case of receiving the control signal S1 at the second cycle and a case of receiving the control signal S1 at the third cycle that is longer than the second cycle are included. This makes the reception pattern of the control signal S1 complicated, and thus it is possible to more reliably distinguish between a signal due to magnetic noise or the like and the reception pattern of the control signal S1 for switching the communication speed. Therefore, it is easy to prevent or suppress the malfunction of the communication speed setting unit 16.

Claims (10)

1. An encoder including a communication unit capable of performing communication at a first speed or a second speed slower than the first speed via a communication line, performing bidirectional communication at the first speed with a control device connected via the communication line, and transmitting position information to the control device each time an inquiry command from the control device is received at a first cycle,
the communication unit includes a communication speed setting unit configured to switch the communication speed to the second speed if a predetermined control signal is received a plurality of times at a second period longer than the first period when the communication speed of the communication is set to the first speed, and the control signal is not received at a first time when the second period and a predetermined time have elapsed after the control signal was last received.
2. The encoder of claim 1,
the communication speed setting unit includes: a timer which sets a count value to 0 and starts counting when receiving the control signal; a first determination unit that determines that the count value has reached a first count value longer than the first period and shorter than the second period; a second determination unit that determines that the count value has reached a second count value that is longer than the second cycle by a predetermined time; a shift register; a register control unit that controls the shift register; a storage unit that stores and holds a preset set value; and a setting unit that sets the communication speed to the second speed,
the register control unit sets all bits of the shift register to 0 when the control signal is first received, shifts the bits of the shift register to input 1 each time the count value reaches the first count value, and shifts the bits of the shift register to input 0 when the count value reaches the second count value,
when 0 is input to the shift register, the setting unit compares the set value with the value of the shift register, and sets the communication speed to the second speed when the value of the shift register matches the set value.
3. An encoder including a communication unit capable of performing communication at a first speed or a second speed slower than the first speed via a communication line, performing bidirectional communication at the first speed with a control device connected via the communication line, and transmitting position information to the control device each time an inquiry command from the control device is received at a first cycle,
the communication unit includes a communication speed setting unit configured to switch the communication speed to the second speed if a predetermined control signal is received a plurality of times at a second period longer than the first period when the communication speed of the communication is set to the first speed, and if the control signal is not received at a first time when the second period and a predetermined time have elapsed after the control signal was last received, and an interval between the two control signals received thereafter is the second period.
4. The encoder according to claim 3,
the communication speed setting unit includes: a timer which sets a count value to 0 and starts counting when receiving the control signal; a first determination unit that determines that the count value has reached a first count value longer than the first period and shorter than the second period; a second determination unit that determines that the count value has reached a second count value that is longer than the second cycle by a predetermined time; a shift register; a register control unit that controls the shift register; a storage unit that stores and holds a preset set value; and a setting unit that sets the communication speed to the second speed,
the register control unit sets all bits of the shift register to 0 when the control signal is first received, shifts the bits of the shift register to input 1 each time the count value reaches the first count value, and shifts the bits of the shift register to input 0 when the count value reaches the second count value,
the setting unit compares the set value with the value of the shift register when the count value reaches a third count value that matches the length of the second cycle after 0 is input to the shift register, and sets the communication speed to the second speed when the value of the shift register matches the set value.
5. The encoder according to any of claims 1 to 4,
the communication unit includes an initial setting unit that sets the communication speed to the first speed when a power supply is turned on.
6. A communication control method for an encoder including a communication unit capable of performing communication at a first speed or a second speed slower than the first speed via a communication line, performing bidirectional communication at the first speed with a control device connected via the communication line, and transmitting position information to the control device each time an inquiry command from the control device is received at a first cycle,
the communication speed setting step includes switching the communication speed to the second speed if a predetermined control signal is received a plurality of times at a second period longer than the first period when the communication speed of the communication is set to the first speed, and the control signal is not received at a first time when the second period and a predetermined time have elapsed after the control signal was last received.
7. The communication control method of an encoder according to claim 6,
the communication unit includes: a timer which sets a count value to 0 and starts counting when receiving the control signal; a first determination unit that determines that the count value has reached a first count value longer than the first period and shorter than the second period; a second determination unit that determines that the count value has reached a second count value that is longer than the second cycle by a predetermined time; a shift register; and a storage unit for storing and holding a preset setting value,
in the communication speed setting step, all bits of the shift register are set to 0 when the control signal is first received, the bits of the shift register are shifted and input to 1 every time the count value reaches the first count value, the bits of the shift register are shifted and input to 0 when the count value reaches the second count value, the set value and the value of the shift register are compared when 0 is input to the shift register, and the communication speed is set to the second speed when the value of the shift register matches the set value.
8. A communication control method for an encoder including a communication unit capable of performing communication at a first speed or a second speed slower than the first speed via a communication line, performing bidirectional communication at the first speed with a control device connected via the communication line, and transmitting position information to the control device each time an inquiry command from the control device is received at a first cycle,
the communication speed setting step includes switching the communication speed to the second speed if a predetermined control signal is received a plurality of times at a second period longer than the first period when the communication speed of the communication is set to the first speed, and if the control signal is not received at a first time when the second period and a predetermined time have elapsed after the control signal was last received, and if an interval between the two control signals received thereafter is the second period.
9. The communication control method of an encoder according to claim 8,
the communication unit includes: a timer which sets a count value to 0 and starts counting when receiving the control signal; a first determination unit that determines that the count value has reached a first count value longer than the first period and shorter than the second period; a second determination unit that determines that the count value has reached a second count value that is longer than the second cycle by a predetermined time; a shift register; and a storage unit for storing and holding a preset setting value,
in the communication speed setting step, all bits of the shift register are set to 0 when the control signal is first received, the bits of the shift register are shifted and input to 1 every time the count value reaches the first count value, the bits of the shift register are shifted and input to 0 when the count value reaches the second count value, and the set value and the value of the shift register are compared when the count value becomes 0 when the count value reaches a third count value that coincides with the length of the second period after 0 is input to the shift register, and the communication speed is set to the second speed when the value of the shift register coincides with the set value.
10. The communication control method of an encoder according to any one of claims 6 to 9,
the communication speed is set to the first speed when the power is turned on.
CN202111121786.9A 2020-09-28 2021-09-24 Encoder and communication control method for encoder Active CN114362879B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2020-161637 2020-09-28
JP2020161637A JP2022054536A (en) 2020-09-28 2020-09-28 Encoder and communication control method of encoder

Publications (2)

Publication Number Publication Date
CN114362879A true CN114362879A (en) 2022-04-15
CN114362879B CN114362879B (en) 2024-04-16

Family

ID=80998208

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111121786.9A Active CN114362879B (en) 2020-09-28 2021-09-24 Encoder and communication control method for encoder

Country Status (2)

Country Link
JP (1) JP2022054536A (en)
CN (1) CN114362879B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001074503A (en) * 1999-09-07 2001-03-23 Hitachi Ltd Encoder and motor driving device
JP2003186544A (en) * 2001-12-20 2003-07-04 Brother Ind Ltd Speed control method and speed control device
JP2010051149A (en) * 2008-08-25 2010-03-04 Kyocera Mita Corp Motor control apparatus
CN105683851A (en) * 2013-11-05 2016-06-15 株式会社安川电机 Servo system, and encoder
CN110941231A (en) * 2018-09-25 2020-03-31 发那科株式会社 Encoder and control system of encoder

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001074503A (en) * 1999-09-07 2001-03-23 Hitachi Ltd Encoder and motor driving device
JP2003186544A (en) * 2001-12-20 2003-07-04 Brother Ind Ltd Speed control method and speed control device
JP2010051149A (en) * 2008-08-25 2010-03-04 Kyocera Mita Corp Motor control apparatus
CN105683851A (en) * 2013-11-05 2016-06-15 株式会社安川电机 Servo system, and encoder
CN110941231A (en) * 2018-09-25 2020-03-31 发那科株式会社 Encoder and control system of encoder

Also Published As

Publication number Publication date
CN114362879B (en) 2024-04-16
JP2022054536A (en) 2022-04-07

Similar Documents

Publication Publication Date Title
US7327114B2 (en) Fan control utilizing bi-directional communications
US20050174086A1 (en) Machine controller
EP2424103B1 (en) Stepping Motor Controller and Image-reading Device
US10036872B2 (en) Camera apparatus, camera body, interchangeable lens, and method of controlling operation of camera body
JP5215906B2 (en) Wireless communication system for tools
CN114362879B (en) Encoder and communication control method for encoder
CN113825596A (en) Method for detecting a slip clutch release event and power tool
KR101290563B1 (en) Controller for motor
JP4548613B2 (en) Servo system
US10416663B2 (en) Motor control apparatus, motor control method, information processing program, and recording medium
JP5472865B2 (en) Driver setting operation method for stepping motor
CN112106292A (en) Intelligent servo motor and driving device using a plurality of intelligent servo motors
EP1081844B1 (en) Motor control circuit and control system using the same
JP5215905B2 (en) Wireless communication system for tools
CN109768738B (en) Motor control device, control system, and motor control method
JP7186569B2 (en) MOTOR DRIVE CONTROL DEVICE, FAN DEVICE, AND MOTOR DRIVE CONTROL METHOD
JP7087845B2 (en) Shift range controller
JP2008051490A (en) Air conditioner
US7342377B2 (en) Stepping-motor control apparatus and method of controlling the apparatus
KR102495125B1 (en) Motor control device
CN111491764B (en) Tool, control circuit of tool and control method
CN109753020B (en) Motor control device, control system, and motor control method
WO2023195178A1 (en) Motor drive device and servo drive system
JP4499233B2 (en) Distributed control system
CN116016709A (en) Motor unit and fan

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant