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

Encoder and communication control method for encoder Download PDF

Info

Publication number
CN114362879B
CN114362879B CN202111121786.9A CN202111121786A CN114362879B CN 114362879 B CN114362879 B CN 114362879B CN 202111121786 A CN202111121786 A CN 202111121786A CN 114362879 B CN114362879 B CN 114362879B
Authority
CN
China
Prior art keywords
speed
communication
count value
encoder
period
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111121786.9A
Other languages
Chinese (zh)
Other versions
CN114362879A (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

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 can perform communication 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 every time an inquiry command (O1) from the control device is received in a first cycle (T1). The communication unit includes a communication speed setting unit (16) that switches the communication speed to the second speed when the predetermined control signal (S1) is received a plurality of times in a second period (T2) longer than the first period when the communication speed of the communication is set to the first speed, and when the control signal (S1) is not received at a first time when the second period and the predetermined time have elapsed after the last reception of the control signal (S1).

Description

Encoder and communication control method for encoder
Technical Field
The present invention relates to an encoder and a communication control method of the encoder for communicating with an external device via a communication line for transmitting position information.
Background
The encoder is mounted on a device for driving the drive source to actuate the movable portion. The position information output from the encoder is transmitted to the control device via a communication line. The control device performs drive control on the drive source based on the received position information. The driving 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 to match the use environment and use. Further, it is sometimes necessary to set an origin position as a reference of position information for the encoder after the encoder is mounted. Patent document 1 describes an encoder capable of changing settings according to a signal input from an external device to the encoder.
Prior art literature
Patent literature
Patent document 1: japanese patent laid-open No. 11-178303
Disclosure of Invention
Technical problem to be solved by the invention
When setting an encoder, if a computer that operates the application software for setting the encoder is connected to the encoder, a setting command issued by the application software is transmitted to the encoder, and the setting operation becomes easy. In addition, if the encoder is provided in this manner, 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, connection of the encoder to the computer becomes easy. However, in this case, the number of communication lines increases, and thus the diameter of the cables in which they are collected increases, which may prevent downsizing of the device in which the encoder is mounted.
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. In general, however, 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 an external device. Therefore, even if the encoder and the computer are connected via the communication line and a setting command is transmitted from the computer, information loss or the like due to the communication speed may occur, and the control command may not be recognized on the encoder side.
The present invention provides an encoder and a communication controller of the encoder, which can communicate with an external device such as a computer by using a communication line connecting the encoder and a control device.
Technical proposal adopted for solving the technical problems
In order to solve the above-described problems, an encoder according to the present invention includes a communication unit that can perform communication at a first speed or a second speed slower than the first speed via a communication line, and performs bidirectional communication at the first speed with a control device connected via the communication line, and transmits position information to the control device every time an inquiry command from the control device is received at a first period, the encoder includes a communication speed setting unit that switches 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 at the first speed, and 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 a first time point at which the second period and the predetermined time have elapsed after the control signal is received a plurality of times in the second period longer than the first period 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, a control signal is transmitted from an external device connected to the communication line to the encoder. The second period of the control signal is longer than the first period of the interrogation command transmitted from the control device to the encoder in order to acquire the position information. Therefore, even in the case where the communication speed at which the external device performs communication is the second speed slower than the first speed, the external device is liable to transmit the control signal in the second period. Further, since the second period of the control signal is longer than the first period 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 the control signal is received. 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 environment in which the encoder is installed, 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. When the unexpected signal matches or is similar to the control signal from the external device, an error may occur when the encoder is connected to the control device and the control device controls the drive of the device, and the communication speed setting unit may malfunction to switch the communication speed from the first speed to the second speed. For the above-described problems, in the present invention, the switching of the communication speed requires that the control signal be received a plurality of times in a predetermined second period. Further, 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. In this way, the communication speed setting unit can distinguish between a signal due to magnetic noise and the like and a reception mode of a control signal for switching the communication speed. Therefore, malfunction of the communication speed setting unit can be prevented or suppressed.
In the present invention, the communication speed setting unit may include: a timer that sets a count value to 0 to start counting when the control signal is received; a first judgment unit that judges that the count value reaches a first count value longer than the first period and shorter than the second period; a second judgment unit that judges that the count value reaches a second count value longer than the second period 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 setting value; and a setting unit that sets the communication speed to the second speed, wherein the register control unit sets all bits (bits) of the shift register to 0 when the control signal is initially received, the register control unit shifts the bits of the shift register to input 1 each time the count value reaches the first count value, the register control unit shifts the bits of the shift register to input 0 when the count value reaches the second count value, and the setting unit compares the set value and the value of the shift register when the value of the shift register matches the set value, and sets the communication speed to the second speed when the value of the shift register matches the set value. In this way, the reception mode of the signal due to magnetic noise or the like and the control signal for switching the communication speed can be discriminated by using the timer, the shift register, and the set value stored in the storage unit.
In another aspect of the present invention, an encoder includes a communication unit that can perform communication at a first speed or a second speed slower than the first speed via a communication line, and performs bidirectional communication at the first speed with a control device connected via the communication line, and transmits position information to the control device every time an inquiry command from the control device is received at a first period, wherein the encoder includes a communication speed setting unit that switches 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 at the first speed, and 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, the communication speed setting unit switches the communication speed to the second speed.
According to the present invention, if the control signal is not received at the first timing after the second period and the predetermined time elapses after the control signal is received a plurality of times in the second period longer than the first period 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 if the interval between the two control signals received thereafter is the second period. Here, when the encoder is set, a control signal is transmitted from an external device connected to the communication line to the encoder. The second period of the control signal is longer than the first period of the interrogation command transmitted from the control device to the encoder in order to acquire the position information. Therefore, even in the case where the communication speed at which the external device performs communication is the second speed slower than the first speed, the external device is liable to transmit the control signal in the second period. Further, since the second period of the control signal is longer than the first period 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 the control signal is received. 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 environment in which the encoder is installed, 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. When the unexpected signal matches or is similar to the control signal from the external device, an error may occur when the encoder is connected to the control device and the control device controls the drive of the device, and the communication speed setting unit may malfunction to switch the communication speed from the first speed to the second speed. For the above-described problems, in the present invention, the switching of the communication speed requires that the control signal be received a plurality of times in a predetermined second period. Further, 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. In this way, the communication speed setting unit can distinguish between a signal due to magnetic noise and the like and a reception mode of a control signal for switching the communication speed. Therefore, malfunction of the communication speed setting unit can be prevented or suppressed.
In the present invention, the communication speed setting unit may include: a timer that sets a count value to 0 to start counting when the control signal is received; a first judgment unit that judges that the count value reaches a first count value longer than the first period and shorter than the second period; a second judgment unit that judges that the count value reaches a second count value longer than the second period 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 setting value; and a setting unit that sets the communication speed to the second speed, wherein the register control unit sets all bits of the shift register to 0 when the control signal is initially received, the register control unit shifts the bits of the shift register to input 1 each time the count value reaches the first count value, the register control unit shifts the bits of the shift register to input 0 when the count value reaches the second count value, and 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 period 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, the reception mode of the signal due to magnetic noise or the like and the control signal for switching the communication speed can be discriminated by using the timer, the shift register, and the set value stored in the 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 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 supply of the encoder is turned off after the communication with the external device at the second speed is performed and the power supply is turned on again, the communication speed can be returned to the first speed.
In the communication control method of the encoder according to the present invention, the encoder includes a communication unit that can perform communication at a first speed or a second speed slower than the first speed via a communication line, and the two-way communication at the first speed is performed with a control device connected via the communication line, and position information is transmitted to the control device each time an inquiry command from the control device is received at a first period, and the communication control method of the encoder includes a communication speed setting step of 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 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 a timing when the second period and the prescribed time have elapsed after the control signal is received in the encoder a plurality of times in the second period when the control signal is transmitted from the external device 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 instruction 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 to identify the control signal. In order for the communication speed setting unit to switch the communication speed to the second speed, it is necessary to receive the control signal in a predetermined reception mode, and therefore, 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, the encoder can be prevented or suppressed from switching the communication speed due to malfunction.
In the present invention, the communication unit may include: a timer that sets a count value to 0 to start counting when the control signal is received; a first judgment unit that judges that the count value reaches a first count value longer than the first period and shorter than the second period; a second judgment unit that judges that the count value reaches a second count value longer than the second period by a predetermined time; a shift register; and a storage unit that stores and holds a preset setting 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 initially received, shifting bits of the shift register to 1 each time the count value reaches the first count value, and shifting bits of the shift register to 0 each time 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, the reception mode of the signal due to magnetic noise or the like and the control signal for switching the communication speed can be discriminated by using the timer, the shift register, and the set value stored in the storage unit.
In the communication control method of the encoder according to another aspect of the present invention, the encoder includes a communication unit that can perform communication at a first speed or a second speed slower than the first speed via a communication line, and the communication unit is configured to perform bidirectional communication at the first speed with a control device connected via the communication line, and to transmit position information to the control device each time an inquiry command from the control device is received at a first period, and the communication control method of the encoder includes a communication speed setting step of switching the communication speed to the second speed if a predetermined control signal is received at a second period longer than the first period when the communication speed of the communication is set at the first speed, and if the control signal is not received at a first time point when the second period and the predetermined time have elapsed after the control signal is finally received, and the interval between the two control signals received thereafter is the second period.
According to the present invention, if the control signal is not received at a timing at which the second period and the prescribed time have elapsed after the control signal is received a plurality of times in the second period in the encoder when the control signal is transmitted from the external device connected to the encoder via the communication line, the communication speed is switched from the first speed to the second speed if the interval between the two control signals received thereafter is the second period. Therefore, after the communication speed is set to the second speed, a reception setting instruction 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 to identify the control signal. In order for the communication speed setting unit to switch the communication speed to the second speed, it is necessary to receive the control signal in a predetermined reception mode, and therefore, 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, the encoder can be prevented or suppressed from switching the communication speed due to malfunction.
In the present invention, the communication unit may include: a timer that sets a count value to 0 to start counting when the control signal is received; a first judgment unit that judges that the count value reaches a first count value longer than the first period and shorter than the second period; a second judgment unit that judges that the count value reaches a second count value longer than the second period by a predetermined time; a shift register; and a storage unit that stores and holds a preset setting 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 initially received, shifting bits of the shift register to 1 each time the count value reaches the first count value, and shifting bits of the shift register to 0 each time the count value reaches the second count value; and if the count value becomes 0 when the count value reaches a third count value that matches the length of the second period after 0 is input to the shift register, comparing the set value with the value of 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, the reception mode of the signal due to magnetic noise or the like and the control signal for switching the communication speed can be discriminated by using the timer, the shift register, and the set value stored in the storage unit.
In the present invention, the communication device may further include an initial setting step of setting the communication speed to the first speed when the power 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 after the communication with the external device at the second speed is performed and the power is turned on again, the communication speed can be returned to the first speed.
Effects of the invention
According to the present invention, when a control signal is transmitted from an external device connected to an encoder via a 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 be a second speed suitable for the external device, various setting instructions such as a setting instruction can be received by the encoder side without missing information included in the setting instruction when the setting instruction is transmitted from the external device. Therefore, the encoder can update its own setting and control program based on the setting instruction.
Drawings
Fig. 1 is a schematic explanatory diagram of a control system to which an encoder of the present invention is applied.
Fig. 2 is an explanatory diagram of communication between the encoder and the control device.
Fig. 3 is an explanatory diagram of a reception mode of a control signal for changing a 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 a control signal when the communication speed setting unit of the modification changes the communication speed.
(Symbol description)
1 An encoder; 2, a communication line; 3a control device; 5 a sensor; a control unit; 7, setting a storage part; 11 a position information generation unit; a 12 communication unit; 15 an initial setting unit; 16 a communication speed setting unit; 17 timer; 18 a first judgment part; a second judgment unit 19; a 20 shift register; a 21 register control unit; 22 storage unit; a 23 setting unit; 100 computers; an O1 query instruction; an O2 setting instruction; s1, a control signal; t1 is a first period; t2 second period.
Detailed Description
An embodiment of an encoder to which the present invention is applied is described below with reference to the drawings.
(Encoder)
Fig. 1 is a schematic explanatory diagram of a control system to which an encoder of the present invention is applied. Fig. 2 is an explanatory diagram of communication 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 mounted on a device for driving a drive 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 controlling the driving of 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 driving source is a motor, and the apparatus is an industrial robot. The control device 3 is a dedicated device for controlling the industrial robot. The control device 3 controls driving of the motor based on the positional information from the encoder 1, thereby controlling the operation of the industrial robot.
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 the magnetic flux of a magnet fixed to the motor shaft. The magnet is provided separately from a driving magnet of the motor for detecting the rotation angle position of the rotation 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 the rotational angle position of the shaft based on the output from the sensor 5. The setting storage unit 7 stores various setting information of the encoder 1, such as the resolution of the position information generated by the position information generation unit 11 and the origin position serving 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 further 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 can perform bidirectional communication between an external device and the control unit 6 via the communication line 2. In this example, the communication section 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 4Mbps. The second speed is 38400bps.
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 a 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 for inquiring the rotational angle position of the rotor is sent from the control device 3 in a first period T1. The control unit 6 transmits the position information P to the control device 3 via the communication unit 12 every time the inquiry command O1 is received in the first period T1. In this example, the first period T1 is 50 μs.
If the predetermined control signal S1 is received a plurality of times in the second period T2 longer than the first period T1 when the communication speed is set to the first speed, 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 last reception of the control signal S1, the communication speed setting unit 16 performs a speed setting operation of switching the communication speed from the first speed to the second speed. As shown in fig. 3, in the present example, when the communication speed is set to the second speed, the control signal S1 is received twice in the second period T2. The second period T2 is 0.5s.
More specifically, as shown in fig. 1, the communication speed setting unit 16 includes: a timer 17; a first judgment unit 18, wherein the first judgment unit 18 judges that the count value of the timer 17 reaches a predetermined first count value; and a second judgment unit 19, wherein the second judgment unit 19 judges that the count value of the timer 17 reaches a predetermined second count value. 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 that stores and holds a preset setting value in the storage unit 22; and a setting unit 23, wherein the setting unit 23 sets the communication speed to the second speed.
The timer 17 monitors the command and control signal S1 received by the communication unit 12 via the communication line 2, and resets the count value to 0 to restart the counting when the communication unit 12 receives the inquiry command O1 and control signal S1. The first judgment unit 18 judges that the count value of the timer 17 reaches a 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 in the case where the timer 17 counts for a period shorter than the second period T2 by a predetermined time. The predetermined time is equal to or less than the first period T1 and the timer 17 counts from 0 to 50. Thus, the first count value is 1000000. The second determination unit 19 determines that the count value of the timer 17 reaches a second count value counted for a period longer than the second period T2 by a predetermined time. The second count value is 1000100.
The register control unit 21 controls the shift register 20 based on the control signal S1, the determination results of the first determination unit 18 and the second determination unit 19. The register control section 21 sets all bits of the shift register 20 to 0 when the control signal S1 is initially received. Then, each time the count value reaches the first count value, the register control section 21 shifts the bit of the shift register 20 to the left to input 1. When the count value reaches the second count value, the register control section 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 refers to the storage unit 22 and compares the set value with the value of the shift register 20. In other words, when the second determination unit 19 determines that the count value of the timer 17 reaches 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 between encoder and control device)
Here, communication between the encoder and the control device will be described with reference to fig. 2. When the encoder 1 communicates with the control device 3 during communication, the encoder 1 is connected to the control device 3 via the communication line 2. Then, the power supply of the encoder 1 is turned on. When the power is turned on, the initial setting section 15 sets the communication speed of the encoder 1 to the first speed.
When the encoder 1 is connected to the control device 3, an inquiry command O1 is transmitted from the control device 3 to the encoder 1 in a first cycle T1. In contrast, the control unit 6 of the encoder 1 transmits the position information P to the control device 3 every time the inquiry command O1 is received. Here, the timer 17 resets its count value to 0 every time the communication section 12 receives the inquiry command O1. The register control section 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 indicated by a broken line in fig. 1. Then, the computer 100 operates the encoder setting application software, and transmits a setting instruction 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 (4 Mbps) of communication between the encoder 1 and the control apparatus 3 is significantly faster than the second speed (38400 bps) of communication 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 the information contained in the setting command O2 is lost due to a difference between the second speed of communication by the computer 100 and the first speed of communication 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, a communication speed setting step (step ST 1) is first performed in which the communication speed of the communication between the encoder 1 and the computer 100 is switched from the first speed to the second speed. Next, a setting information rewriting process (step ST 2) is performed in which the computer 100 transmits a setting command O2 to the encoder 1, and rewrites the setting information of the encoder 1 to change its own setting.
In the communication speed setting step (ST 1), the encoder 1 monitors the control signal S1 received via the communication line 2. When the encoder 1 receives the control signal S1 in a 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. Then, each time the count value reaches the first count value, the encoder 1 shifts the bit of the shift register 20 to input 1, and when the count value reaches the second count value, the encoder 1 shifts the bit of the shift register 20 to input 0. 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, in the case where 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 process (step ST 2), 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, on the encoder 1 side, the reception can be performed without deleting information or the like included in the setting command O2. 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, in the encoder 1, the communication speed of the communication via the communication line 2 is set 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 query 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.
(Effects of action)
According to the present invention, if the control signal S1 is not received at the first time point when the second period T2 and the predetermined time have elapsed after the control signal S1 is received a plurality of times in the second period T2 longer than the first period T1 when the communication speed of the communication via the communication line 2 is set to the first speed, the communication unit 12 switches the communication speed from the first speed to the second speed. Here, the second period T2 of the control signal S1 is longer than the first period T1 of the query 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 in 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 unit 16 can distinguish the control signal S1 from the inquiry command O1 and recognize the control signal S1. Accordingly, the communication speed setting unit 16 can set the communication speed to the second speed suitable for the external device upon receiving the control signal S1. Thus, the reception setting command O2 and the like can be transmitted between the external device and the encoder 1 without missing 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. When the unexpected signal matches or is similar to the control signal S1 from the external device, the communication speed setting unit 16 may malfunction when the encoder 1 is connected to the control device 3 and the control device 3 performs drive control of the device, and the communication speed may be switched from the first speed to the second speed. For the above-described problem, in the present example, the switching of the communication speed requires the control signal S1 to be received a plurality of times in the predetermined second period T2. Further, it is necessary 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. In this way, the communication speed setting unit 16 can distinguish between the signal due to magnetic noise and the like and the reception mode of the control signal S1 for switching the communication speed, and thus, the occurrence of malfunction of the communication speed setting unit 16 can be prevented or suppressed.
Further, according to the present 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 discriminated using the timer 17, the shift register 20, and the set value stored and held in the storage section 22.
In this 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 in the storage unit 22. Thereby, the reception mode of the control signal S1 becomes complicated. Therefore, the signal due to magnetic noise or the like can be more reliably distinguished from the reception mode of the control signal S1 for switching the communication speed.
(Another example of the communication speed setting section)
Next, the communication speed setting unit 16 according to a 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, as with the communication speed setting unit 16 described above: a timer 17; a first judgment unit 18, wherein the first judgment unit 18 judges that the count value reaches a first count value; and a second judging unit 19, wherein the second judging unit 19 judges that the count value reaches the second count value. The communication speed setting unit 16 of the present example includes, as with 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, wherein the setting unit 23 sets 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 in the storage unit 22 is different from the set value stored 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, the determination results of the first determination unit 18 and the second determination unit 19.
The communication speed setting section 16 of the present example switches the communication speed to the second speed if the control signal S1 is received a plurality of times in the second period T2 when the communication speed is set to the first speed, and 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 last reception of the control signal S1, the interval between the two control signals S1 received thereafter is the second period T2.
More specifically, the register control section 21 sets all bits of the shift register 20 to 0 when the control signal S1 is initially received. Then, each time the count value reaches the first count value, the register control section 21 shifts the bit of the shift register 20 to the left to input 1. When the count value reaches the second count value, the register control section 21 shifts the bit of the shift register 20 to the left and inputs 0. When the count value reaches the third count value corresponding to 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 (ST 1), the encoder 1 sets all bits of the shift register 20 to 0 when the control signal S1 is initially received. Then, each time the count value reaches the first count value, the encoder 1 shifts the bit of the shift register 20 to input 1, and when the count value reaches the second count value, the encoder 1 shifts the bit of the shift register 20 to input 0. If the count value becomes 0 after the count value reaches the third count value corresponding to the length of the second period T2 after 0 is input to the shift register 20, 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 corresponds to the set value.
In the setting information rewriting process (step ST 2), 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, on the encoder 1 side, the reception can be performed without deleting information or the like included in the setting command O2. 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, in the encoder 1, the communication speed of the communication via the communication line 2 is set 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. Accordingly, the encoder 1 receives the query 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.
Even when the communication speed setting unit 16 of the present example is included, the encoder 1 can obtain the same operational effects as the encoder 1 described above.
Here, in the reception mode of the control signal S1 of the present example, a case where the control signal S1 is received in the second period and a case where the control signal S1 is received in the third period longer than the second period are included. As a result, the reception mode of the control signal S1 becomes complex, and thus the signal due to magnetic noise or the like can be more reliably distinguished from the reception mode of the control signal S1 for switching the communication speed. Therefore, the communication speed setting unit 16 is easily prevented or suppressed from malfunctioning.

Claims (8)

1. An encoder comprising a communication unit capable of communicating at a first speed or a second speed slower than the first speed via a communication line, and a control device connected via the communication line, wherein the encoder is configured to perform bidirectional communication at the first speed, and to transmit position information to the control device every time an inquiry command from the control device is received at a first cycle,
The second speed is a communication speed of communication between the encoder and a device connected to the outside of the encoder via the communication line,
The communication section includes a communication speed setting section that switches the communication speed to the second speed if a predetermined control signal from the external device is received a plurality of times in 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 timing when the second period and the predetermined time have elapsed after the control signal was last received,
The communication speed setting section includes: a timer that sets a count value to 0 to start counting when the control signal is received; a first judgment unit that judges that the count value reaches a first count value longer than the first period and shorter than the second period; a second judgment unit that judges that the count value reaches a second count value longer than the second period 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 setting value; and a setting unit that sets the communication speed to the second speed,
When the control signal is initially received, the register control section sets all bits of the shift register to 0, and when the count value reaches the first count value, the register control section shifts the bits of the shift register to input 1, and when the count value reaches the second count value, the register control section shifts the bits of the shift register to input 0,
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.
2. The encoder of claim 1, wherein the encoder further comprises a decoder,
The communication unit includes an initial setting unit that sets the communication speed to the first speed when the power is turned on.
3. An encoder comprising a communication unit capable of communicating at a first speed or a second speed slower than the first speed via a communication line, and a control device connected via the communication line, wherein the encoder is configured to perform bidirectional communication at the first speed, and to transmit position information to the control device every time an inquiry command from the control device is received at a first cycle,
The second speed is a communication speed of communication between the encoder and a device connected to the outside of the encoder via the communication line,
The communication section includes a communication speed setting section that switches the communication speed to the second speed if a predetermined control signal from the external device is received a plurality of times in 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 timing at which the second period and the predetermined time have elapsed after the control signal was last received, the interval between the two control signals received thereafter being the second period,
The communication speed setting section includes: a timer that sets a count value to 0 to start counting when the control signal is received; a first judgment unit that judges that the count value reaches a first count value longer than the first period and shorter than the second period; a second judgment unit that judges that the count value reaches a second count value longer than the second period 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 setting value; and a setting unit that sets the communication speed to the second speed,
When the control signal is initially received, the register control section sets all bits of the shift register to 0, and when the count value reaches the first count value, the register control section shifts the bits of the shift register to input 1, and when the count value reaches the second count value, the register control section shifts the bits of the shift register to input 0,
When the count value reaches a third count value corresponding to the length of the second period after 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 corresponds to the set value.
4. The encoder of claim 3, wherein,
The communication unit includes an initial setting unit that sets the communication speed to the first speed when the power is turned on.
5. 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, and a control device connected via the communication line, the communication unit performing bidirectional communication at the first speed, the method being characterized in that, when an inquiry command from the control device is received at a first cycle, position information is transmitted to the control device,
The second speed is a communication speed of communication between the encoder and a device connected to the outside of the encoder via the communication line,
Comprises a communication speed setting step of switching the communication speed to the second speed if a predetermined control signal from the external device is received a plurality of times in 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 the predetermined time have elapsed after the control signal is finally received,
The communication section includes: a timer that sets a count value to 0 to start counting when the control signal is received; a first judgment unit that judges that the count value reaches a first count value longer than the first period and shorter than the second period; a second judgment unit that judges that the count value reaches a second count value longer than the second period 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 initially received, 1 is input by shifting bits of the shift register every time the count value reaches the first count value, 0 is input by shifting bits of the shift register when the count value reaches the second count value, and when 0 is input to the shift register, the set value and the value of the shift register are compared, and when the value of the shift register matches the set value, the communication speed is set to the second speed.
6. The communication control method of an encoder according to claim 5, wherein,
When the power is turned on, the communication speed is set to the first speed.
7. 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, and a control device connected via the communication line, the communication unit performing bidirectional communication at the first speed, the method being characterized in that, when an inquiry command from the control device is received at a first cycle, position information is transmitted to the control device,
The second speed is a communication speed of communication between the encoder and a device connected to the outside of the encoder via the communication line,
Comprising a communication speed setting step of switching the communication speed to the second speed if a predetermined control signal from the external device is received a plurality of times in 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 timing when the second period and the predetermined time have elapsed after the control signal is finally received, the interval between the two control signals received thereafter being the second period,
The communication section includes: a timer that sets a count value to 0 to start counting when the control signal is received; a first judgment unit that judges that the count value reaches a first count value longer than the first period and shorter than the second period; a second judgment unit that judges that the count value reaches a second count value longer than the second period 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 initially received, 1 is input by shifting bits of the shift register every time the count value reaches the first count value, 0 is input by shifting bits of the shift register when the count value reaches the second count value, and the communication speed is set to the second speed when the count value becomes 0 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.
8. The method for communication control of an encoder according to claim 7, wherein,
When the power is turned on, the communication speed is set to the first speed.
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 CN114362879A (en) 2022-04-15
CN114362879B true 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
CN114362879A (en) 2022-04-15
JP2022054536A (en) 2022-04-07

Similar Documents

Publication Publication Date Title
JP6680270B2 (en) Motor control system and communication method of motor control system
US9304958B2 (en) Device for transmitting sensor data
US20050174086A1 (en) Machine controller
EP2424103B1 (en) Stepping Motor Controller and Image-reading Device
JP5215906B2 (en) Wireless communication system for tools
CN114362879B (en) Encoder and communication control method for encoder
KR100846177B1 (en) Network structure based actuator module
JP2004317261A (en) Encoder device and robot system
KR101290563B1 (en) Controller for motor
JP4548613B2 (en) Servo system
JP5472865B2 (en) Driver setting operation method for stepping motor
JP6629817B2 (en) Control system and motor control method
JP2008051490A (en) Air conditioner
KR101302566B1 (en) System and method for controlling roof for vehicle
WO2023195178A1 (en) Motor drive device and servo drive system
US7342377B2 (en) Stepping-motor control apparatus and method of controlling the apparatus
CN109753020B (en) Motor control device, control system, and motor control method
JP3705937B2 (en) Positioning control device
JP4499233B2 (en) Distributed control system
JP4219298B2 (en) Positioning control device
KR20170012081A (en) Motor control device
KR101181129B1 (en) System and method for controlling a car wiper using a Local Interconnect Network communication
JP2022168498A (en) Electric gripper device
CN116016709A (en) Motor unit and fan
JP2006146377A (en) Programmable controller

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