Background
With the development of economy in China, the improvement of the living standard of people, the vigorous development of industrial automation in China, and the increasing of industrial automatic production based on the multi-axis robot, however, with the increasing of the requirement on the production precision, the traditional multi-axis robot control system is more and more difficult to meet the requirement on the production precision.
The traditional multi-axis robot control system adopts a serial or parallel communication mode to control each axis of the multi-axis robot: the communication mode saves transmission lines and is easy to maintain in use of the multi-axis robot compared with parallel communication, but signals among all axes are difficult to synchronize due to the low transmission speed of the communication mode; the transmission speed is high due to the fact that transmission is carried out between the control switchboard and the motor according to bytes through parallel communication, but the cost is relatively high due to the fact that more communication wires are used compared with serial communication, and the control switchboard and the motor are difficult to maintain in the use of the multi-axis robot.
In order to solve the synchronization problem of the serial bus, data frames are generally transmitted by using the serial bus, each data frame includes a synchronization character, a data character and a check character, and the synchronization character is located at the beginning of the frame and is used for confirming the start of the data character. The number of the data characters behind the synchronous characters is not limited and is determined by the length of the data block to be transmitted; the number of the check characters is 1 to 2, which is used for the receiving end to check the correctness of the received character sequence, but the method needs to keep strict synchronization between the sending clock and the receiving clock, and if the clock synchronization is to be realized, the frequency synchronization must be realized first, and the clock signal inevitably causes frequency error due to phase error in the transmission process, so that the frequency is difficult to synchronize, and further, the synchronization cannot be always realized.
Therefore, a synchronous serial communication system and method for realizing synchronous communication between devices without keeping the clock frequency between the sending device and the receiving device the same is urgently needed in the market.
Disclosure of Invention
In order to solve the technical problem, the invention discloses a synchronous serial control method, and the technical scheme of the invention is implemented as follows:
a synchronous serial control system is characterized by comprising a synchronous signal line, a serial data line, a controller and a plurality of actors; the controller comprises a frame counter and a synchronization module; the counting initial value of the frame counter is 0; the actor comprises a cycle counter and an operation module; the controller is connected with the operation module through the serial data line; the controller is connected with the cycle counter through the synchronous signal line; the count initial value of the cycle counter is 0.
Preferably, the actor is selected from one or more of a motor, an I/O device, a sensing device, and a display device.
Preferably, the number of actors is not less than two.
Preferably, the actor further comprises a synchronization signal monitoring module; the synchronous signal monitoring module is connected with the operation module and the cycle counter.
A synchronous serial control method using a synchronous serial control system, comprising: s1: the controller initializes the frame counter and sends an initialization signal to the plurality of actors; s2: the plurality of actors accept the initialization signal and initialize the corresponding cycle counters; s3: the controller transmits control instructions to the plurality of actors through the serial data line, and transmits synchronization signals to the plurality of actors through the synchronization signal line; s4: the actor receives the control instruction according to the serial number of the actor and stores the control instruction in the operation module, the cycle counter counts and adds one, and a response signal is transmitted to the controller; s5: after the controller receives the response signal, the frame counter counts and increases by one; s6: checking a frame counter, and entering the next step if the count value of the frame counter is not less than the number of the plurality of actors; if the count value of the frame counter is less than the number of the plurality of actors, returning to S1; s7: the controller sends synchronous execution signals to the operation modules of the plurality of actors through the serial data line; s8: the plurality of actors execute the control instructions and return to S1.
Preferably, the synchronization signal is in a square wave shape after being continuously transmitted; the synchronous signal of one frame is a square wave signal of half period.
Preferably, the control instruction comprises a frame count; the frame count is the same as the count of the frame counter.
Preferably, it further comprises S4 a: the synchronous signal monitoring module monitors whether synchronous signals are consistent or not; s4a is performed after S3, before S5; s4a includes: s4 a-1: the synchronous signal monitoring module compares the value of the period counter with the frame count; s4 a-2: if the value of the period counter is consistent with the frame count, entering S4 a-3-a; if the frame counter is smaller than the period counter, S4a-3-b is carried out; if the period counter is smaller than the frame counter, S4a-3-c is carried out; s4 a-3-a: proceeding to S4; s4 a-3-b: the actor requests the controller to resend data through the serial data line, the controller resends a control instruction to the actor, and after the actor receives the control instruction sent again, the cycle counter counts up and transmits the response signal to the controller and the process goes to S5; s4 a-3-c: the cycle counter is incremented and transmits an acknowledgement signal to the controller, and then the process proceeds to S5.
The technical scheme of the invention can solve the technical problem that synchronous communication can be realized only on the premise of keeping the clock frequency between the sending equipment and the receiving equipment the same in the prior art; by implementing the technical scheme of the invention, the technical effect of synchronous communication between the equipment can be realized on the premise of not keeping the same clock frequency between the sending equipment and the receiving equipment.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In a particular embodiment, a synchronous serial control system includes a synchronization signal line, a serial data line, a controller, and a plurality of actors; the controller comprises a frame counter and a synchronization module; the counting initial value of the frame counter is 0; the actor comprises a cycle counter and an operation module; the controller is connected with the operation module through the serial data line; the controller is connected with the cycle counter through the synchronous signal line; the count initial value of the cycle counter is 0.
In this specific embodiment, the synchronization signal line is used to send a synchronization signal of the controller, the serial data line is used to send a control instruction of the controller to each actor, the control instruction is used to provide behavior basis for the behaviors of the actors, the frame counter is used to count how many frames of control instructions have been successfully sent at present, each time a frame of control instruction is successfully sent, the control instruction corresponds to a frame of synchronization signal, the control instruction contains the address of the actor to which the control instruction is received, the address of the actor points to which the actor, the control instruction is executed by which actor, the control instruction is repeatedly sent until all actors receive the corresponding control instructions, and then a synchronization execution signal is sent to instruct all actors to execute the action; the behavior device is used for operating according to the control instruction in the operation module; the cycle counter is used for counting cycles according to the synchronous signals, the operation module is used for storing control instructions, and after execution instructions sent by the controller are transmitted to each behavior device, the behavior devices operate according to the control instructions stored in the operation module and delete the corresponding control instructions and the synchronous signals in sequence; through the interaction between the modules, the synchronous communication between the equipment can be realized on the premise of not keeping the same clock frequency between the sending equipment and the receiving equipment.
In a preferred embodiment, the actor is selected from one or more of a motor, an I/O device, a sensing device, and a display device.
In the preferred embodiment, the actor can be a motor, an I/O device, a sensing device or a display device, and can also be other types of products which need to be synchronously operated, and the actor can be suitable for all devices which need to be synchronously operated.
In a preferred embodiment, the number of actors is no less than two.
In the preferred embodiment, the number of the actors is not less than two, and the number of the actors can be selected according to actual needs.
In a preferred embodiment, the actor further comprises a synchronization signal monitoring module; the synchronous signal monitoring module is connected with the operation module and the cycle counter.
In this preferred embodiment, the synchronization signal monitoring module is configured to monitor whether a packet loss phenomenon occurs, the controller performs data transmission once, the synchronization signal monitoring module detects the contents of the operation module and the period counter once, and determines whether the packet loss phenomenon occurs according to the contents of the period counter and the operation module, where in a normal case, the number of the synchronization signals and the frame count of the control instruction in the operation module should be in a one-to-one relationship, and if the frame count of the synchronization signals or the frame count of the control instruction is inconsistent, the packet loss phenomenon occurs in the operation process, and in this case, the synchronization signal monitoring module can correct the packet loss
In a specific embodiment, a synchronous serial control method uses a synchronous serial control system, comprising: s1: the controller initializes the frame counter and sends an initialization signal to the plurality of actors; s2: the plurality of actors accept the initialization signal and initialize the corresponding cycle counters; s3: the controller transmits control instructions to the plurality of actors through the serial data line, and transmits synchronization signals to the plurality of actors through the synchronization signal line; s4: the actor receives the control instruction according to the serial number of the actor and stores the control instruction in the operation module, the cycle counter counts and adds one, and a response signal is transmitted to the controller; s5: after the controller receives the response signal, the frame counter counts and increases by one; s6: checking a frame counter, and entering the next step if the count value of the frame counter is not less than the number of the plurality of actors; if the count value of the frame counter is less than the number of the plurality of actors, returning to S1; s7: the controller sends synchronous execution signals to the operation modules of the plurality of actors through the serial data line; s8: the plurality of actors execute the control instructions and return to S1.
In the specific embodiment, the controller reads the count of the frame counter and integrates the count into a control instruction, the controller transmits a synchronization signal to the period counter through a synchronization signal line, transmits the control instruction to the behavior device through a serial data line, and judges whether the control instruction belongs to the controller according to an instruction address in the control instruction, if the address in the control instruction points to the behavior device 0, the behavior device 0 executes the signal in the future, and if the address points to the behavior device 1, the behavior device 1 executes the signal in the future, and so on until all the behavior devices store the corresponding control instructions; when the behavior device receives a corresponding control instruction, a response signal is sent to the controller to inform the controller that the control signal is received, and the controller adds one to the value of the frame counter according to the response signal; when all the actors receive corresponding control instructions, the instructions carried by the control instructions sent by the controllers are marked as execution signals, all the controllers should operate according to the executed contents, when the control instructions are execution instructions, all the actors are instructed to operate the control instructions stored in the operation module, and the actors act according to the control instructions stored in the operation module and sequentially empty the signals stored in the operation module and the cycle counter; after the foregoing steps are completed, the process returns to S1 and is repeated; through the steps, synchronous control of the behavior device under the serial condition is realized, and synchronous communication between the devices can be realized on the premise of not keeping the same clock frequency between the sending device and the receiving device.
In a preferred embodiment, the synchronization signal is in a square wave shape after being continuously transmitted; the synchronous signal of one frame is a square wave signal of half period.
In the preferred embodiment, the synchronization signal is a digital signal, the high level is 1, the low level is 0, and the synchronization signal is statistically square-wave after being continuously transmitted; traditionally, one square wave period is needed for signal transmission, one data frame is transmitted at one time, and if the signal transmission is changed into one square wave period and is transmitted twice, namely, the signal transmission is transmitted once in a half square wave period, so that the signal transmission rate is improved, and the operation efficiency of equipment is greatly improved.
In a preferred embodiment, the control instruction includes a frame count; the frame count is the same as the count of the frame counter.
In the preferred embodiment, the control command includes a frame count, the value of the frame count is the same as that of the frame counter, during the operation process, a phenomenon that a synchronization signal and the control command are lost simultaneously may exist, once the phenomenon occurs, whether the phenomenon occurs or not can be known through the frame count, when the phenomenon occurs, the phenomenon that the frame count is discontinuous digitally occurs, when the phenomenon occurs is found by the synchronization signal monitoring module, the control command and the synchronization signal which have a packet loss phenomenon are complemented by using an empty frame of control command and an empty frame of synchronization signal, and a request for resending the signal is sent to the controller.
In a preferred embodiment, further comprising S4 a: the synchronous signal monitoring module monitors whether synchronous signals are consistent or not; s4a is performed after S3, before S5; s4a includes: s4 a-1: the synchronous signal monitoring module compares the value of the period counter with the frame count; s4 a-2: if the value of the period counter is consistent with the frame count, entering S4 a-3-a; if the frame counter is smaller than the period counter, S4a-3-b is carried out; if the period counter is smaller than the frame counter, S4a-3-c is carried out; s4 a-3-a: proceeding to S4; s4 a-3-b: the actor requests the controller to resend data through the serial data line, the controller resends a control instruction to the actor, and after the actor receives the control instruction sent again, the cycle counter counts up and transmits the response signal to the controller and the process goes to S5; s4 a-3-c: the cycle counter is incremented and transmits an acknowledgement signal to the controller, and then the process proceeds to S5.
In this preferred embodiment, S4a is configured to detect whether there is a packet loss phenomenon, where in the operation process, the packet loss may be a packet loss occurring in the synchronization signal or a packet loss occurring in the control instruction; when the packet loss of the synchronous signal occurs, the value of the period counter is smaller than that of the frame counter, so the bit of the period counter needs to be complemented, and the value is increased by one; if the value of the frame counter is smaller than the period counter, which indicates that the control instruction is lost, the controller needs to request to resend the control instruction to fill the gap.
It should be understood that the above-described embodiments are merely exemplary of the present invention, and are not intended to limit the present invention, and that any modification, equivalent replacement, or improvement made without departing from the spirit and principle of the present invention shall fall within the protection scope of the present invention.