Based on time slot calibration steps and the time slot calibrating installation of radio communication
Technical field
The invention belongs to wireless communication field, specifically, relate to the time slot calibration steps based on radio communication and time slot calibrating installation.
Background technology
Wireless communication technology is ripe to be applied in the every field of people's life, such as: wireless lighting, wireless remote control household electrical appliances etc.The keyboard more for daily use and mouse, compared with traditional wire key mouse, the demand of cordless key mouse to PC hardware port is few, and physical connection is few, good looking appearance, and is easy to carry.At present, the wireless communication technology that cordless key mouse uses has 27M, 2.4G, bluetooth etc., wherein the advantage such as 2.4G wireless communication technology, easy realization low with cost adopt by most of cordless key mouse product.
In order to control cost, 2.4G cordless key mouse many employings low side MCU (Micro Control Unit, micro-control unit) on the market adds the assembled scheme of 2.4G Transceiver (wireless transceiver) at present.Because the precision of crystal or crystal oscillator is relatively high, the plug-in crystal of current system clock many employings MCU or crystal oscillator, relatively stable to ensure the length of data packet transceive both sides time slot, drift is few; In communication process, the alignment of receiving-transmitting sides time slot once just can accomplish long-time stable work.
But the plug-in crystal of MCU or crystal oscillator are as system clock, while guarantee degree of precision, add components and parts cost and production cost.Because general MCU can integrated inner RC clock oscillator, if inner RC can be used to replace external crystal or crystal oscillator as system clock, the cost of the Wireless Telecom Equipment comprising cordless key mouse will be reduced further.But RC clock accuracy is low, data packet transceive both sides time slot will be caused to align through the short period, thus cause the problem of transceiving data bag failure.
The RC clock oscillator that MCU how can be used inner integrated obtains the calibration of high accuracy time slot, and stable radio communication is problem demanding prompt solution in prior art.
Summary of the invention
The invention provides a kind of time slot calibration steps that the plug-in crystal of MCU or crystal oscillator can not be adopted can to realize stable radio communication and the time slot calibrating installation using the method.
According to an aspect of the present invention, provide a kind of time slot calibration steps based on radio communication, it is characterized in that, described time slot calibration steps comprises the steps:
A) in a time slot calibration cycle, the packet that at least two carry continuous No. ID is received;
B) by No. ID of two bag data calculate receive above-mentioned two packets the timeslot number of process, calculate the total duration receiving above-mentioned two packets and experience simultaneously;
C) slot timer loading values is obtained according to following formula:
Slot timer loading values=total duration/timeslot number
D) according to described slot timer loading values, slot timer is reset.
According to a specific embodiment of the present invention, obtain described total duration by timer.
According to another embodiment of the present invention, describedly obtain described total duration by timer and be specially:
In response to the reception to first packet, start timer;
In response to the reception to second packet, close described timer;
Record the count value of described timer, this numerical value is described total duration.
According to another embodiment of the present invention, described time slot calibration steps is calibrated for the time slot of wireless mouse, Wireless Keyboard, wireless model plane, wireless lighting and/or radio-control toy.
According to another embodiment of the present invention, described radio communication is the wireless communication technology based on 2.4G/5G.
According to another aspect of the present invention, described time slot calibrating installation comprises transmitting terminal and receiving terminal;
Described transmitting terminal, in a time slot calibration cycle, sends the packet including No. ID continuously to described receiving terminal; The length of described packet is fixed, and No. ID of send in succession two packets continuous;
Described receiving terminal, for receiving described packet; No. ID of Record ID continuous print two packets, calculate above-mentioned two packets the timeslot number of process, and receive total duration that above-mentioned two packets experience; Slot timer loading values is obtained according to following formula:
Slot timer loading values=total duration/timeslot number
And according to described slot timer loading values, slot timer is reset.
According to another embodiment of the present invention, described transmitting terminal comprises: ID generation unit, group bag unit, time slot maintenance unit and transmitting element;
Described ID generation unit, for generating independently ID for each packet, and manages described ID;
Described group of bag unit, for data and ID being combined, to form complete packet;
Described first time slot maintenance unit, for ensureing that the slot length of described transmitting terminal is fixed;
Described transmitting element, in a time slot calibration cycle, sends packet described in described ID continuous print to described receiving terminal order.
According to another embodiment of the present invention, described receiving terminal comprises: receiving element, timer, resolution unit, processing unit and the second time slot maintenance unit;
Described receiving element, for receiving the packet coming from described transmitting terminal;
Described timer, for recording the total duration receiving above-mentioned two packets and experience;
Described resolution unit, for resolving described packet, records the ID of described packet, by No. ID of two bag data calculate receive above-mentioned two packets the timeslot number of process, and described timer to be controlled;
Described processing unit, for obtaining slot timer loading values according to following formula:
Slot timer loading values=total duration/timeslot number;
Second time slot maintenance unit, for resetting described slot timer according to described slot timer loading values, and safeguards the time slot of described receiving terminal.
According to another embodiment of the present invention, described resolution unit is carried out control to described timer and is:
When described receiving element receives the first packet, No. ID that records described first packet, and start described timer;
When described receiving element receives the second packet, No. ID that records described second packet, and close described timer.
According to another embodiment of the present invention, wherein, receiving terminal estimates transmitting terminal time slot starting position, and the slot timer of described receiving terminal starts the time slot being not later than described transmitting terminal and starts.
According to another embodiment of the present invention, described time slot calibration cycle is less than or equal to packet ID cycle duration.
According to another embodiment of the present invention, some start-up time of described timer is put with the time span of the time slot starting point of described transmitting terminal consistent with the time span of the time slot starting point of described transmitting terminal and the shut-in time of described timer.
According to another embodiment of the present invention, the wireless communication technology based on 2.4G/5G between described receiving terminal and described transmitting terminal, is adopted to carry out radio communication.
The present invention utilizes the RC oscillator of MCU inside as clock source, is sent the packet carrying ID by transmitting terminal; Receiving terminal calculates the slot length of transmitting terminal by two packets successively received, and by resetting slot timer loading values, slot length is adjusted to identical with transmitting terminal.The present invention reduces as peripheral components such as plug-in crystal or crystal oscillators, reduce components and parts cost and production cost; Manufacture simple, be beneficial to large-scale production; Can effectively enhance productivity.
Accompanying drawing explanation
By reading the detailed description done non-limiting example done with reference to the following drawings, other features, objects and advantages of the present invention will become more obvious:
Figure 1 shows that the schematic flow sheet of an embodiment according to a kind of time slot calibration steps based on radio communication of the present invention;
Figure 2 shows that the structural representation of an embodiment according to a kind of time slot calibrating installation based on radio communication of the present invention;
Figure 3 shows that the structural representation of an embodiment of the transmitting terminal of time slot calibrating installation provided by the invention;
Figure 4 shows that the structural representation of an embodiment of the receiving terminal of time slot calibrating installation provided by the invention.
In accompanying drawing, same or analogous Reference numeral represents same or analogous parts.
Embodiment
Disclosing hereafter provides many different embodiments or example is used for realizing different structure of the present invention.Of the present invention open in order to simplify, hereinafter the parts of specific examples and setting are described.In addition, the present invention can in different example repeat reference numerals and/or letter.This repetition is to simplify and clearly object, itself does not indicate the relation between discussed various embodiment and/or setting.It should be noted that parts illustrated in the accompanying drawings are not necessarily drawn in proportion.Present invention omits the description of known assemblies and treatment technology and process to avoid unnecessarily limiting the present invention.
With reference to being the schematic flow sheet of an embodiment according to a kind of time slot calibration steps based on radio communication of the present invention shown in figure 1, Fig. 1.The method comprising the steps of:
Step S101, in a time slot calibration cycle, receives the packet that at least two carry continuous No. ID.In order to ensure that the time span that each time slot of transmitting terminal starts really to send to the data of packet is fixed, and ensure that the time point time span that the Time interval transmitting terminal time slot that receiving terminal receives packet starts is fixed further, need the length ensureing these packets to fix.Such as, each packet is made up of 10 bytes, and wherein 9 bytes are data messages, and 1 byte is used for No. ID of characterization data bag.The arrangement of No. ID can increase progressively, can successively decrease also can loop cycle, as long as ensure that it continuously.Preferably, time slot calibration cycle is equal to or less than packet ID cycle time.
Step S102, record No. ID of described two packets, calculate receive above-mentioned two packets the timeslot number of process, and receive total duration that above-mentioned two packets experience.
Receiving terminal receives packet, No. ID that will record this packet, and calculate two packets successively received the timeslot number of process.Preferably, the total duration receiving above-mentioned two packets and experience is obtained by timer.Concrete, in response to the reception to first packet, start timer; In response to the reception to second packet, close described timer; Record the count value of described timer, this numerical value is described total duration.
In addition, due to the communication interference that may exist, if receiving terminal only have received a packet in a time slot calibration cycle, then need to abandon the calibration of this time slot, the timer that closedown has started also re-executes time slot calibration.
It should be noted that the time span of closing the starting point of the Time interval sending time slots of timer after opening timer after receiving first packet or receiving second packet is fixing.
Step S103, substitutes into following formula by the parameter obtained in step S102, can obtain slot timer loading values:
Slot timer loading values=total duration/timeslot number.
After obtaining slot timer loading values, continue to perform step S104, slot timer is reset, before replacement according to described slot timer loading values, receiving terminal estimates transmitting terminal time slot starting position, and the slot timer of receiving terminal starts the time slot being not later than described transmitting terminal and starts.
Time slot calibration steps provided by the present invention can be widely used in the time slot calibration of wireless mouse, Wireless Keyboard, wireless model plane, wireless lighting and/or radio-control toy.And above-mentioned time slot calibration steps can based on various wireless communication technical work.Preferably, described radio communication is mainly the wireless communication technology based on 2.4G/5G.
With reference to figure 2, Figure 2 shows that the structural representation of an embodiment according to a kind of time slot calibrating installation based on radio communication of the present invention.Described time slot calibrating installation comprises transmitting terminal 10 and receiving terminal 20.Various wireless communication technology can be adopted to communicate between described receiving terminal 20 with described transmitting terminal 10.Preferably, the wireless communication technology based on 2.4G/5G is adopted to carry out radio communication between described receiving terminal 20 and described transmitting terminal 10.
Described transmitting terminal 10, in a time slot calibration cycle, sends the packet including No. ID continuously to described receiving terminal; The length of described packet is fixed, and No. ID of send in succession two packets continuous.Preferably, described transmitting terminal 10 comprises: ID generation unit 11, group bag unit 12, time slot maintenance unit 13 and transmitting element 14, as shown in Figure 3.
Described ID generation unit 11, for generating independently ID for each packet, and manages described ID.The length of packet is fixed, and each packet is by the data of identical bytes.In order to receiving terminal 20 can accurately resolve and analyze after receiving packet, ID generation unit 11 will generate independently No. ID for each packet.It should be noted that No. ID needs generate continuously, namely No. ID can increase progressively, successively decreases or circulate.
Need afterwards, by group bag unit 12, data and ID to be combined, to form complete packet.Except there being the data of same word joint number in each packet, one No. ID also to be carried.For the packet of 10 byte, wherein comprise the data of 9 Byte and No. ID of 1 Byte.
Described first time slot maintenance unit 13, for ensureing that the slot length of described transmitting terminal is fixed.
Described transmitting element 14, in a time slot calibration cycle, sends packet described in described ID continuous print to described receiving terminal order.Whenever time slot starts, transmitting element 14 starts to send packet.Because data packet length is identical, and instruction performed in process of transmitting is identical with flow process, can ensure that the time point that each packet sends is fixed relative to the time slot starting point of transmitting terminal 10, can ensure that the time point that receiving terminal 20 receives packet at every turn is also fixing relative to the time slot starting point of transmitting terminal 10.
Such as, the slot length of transmitting terminal 10 is set to 1ms; No. ID is arranged to increase progressively form, and each time slot numerical value adds 1, and the zero setting when numerical value fills it up with 200, namely the packet ID cycle is 200ms.Meanwhile, in this example, time slot calibration cycle duration equals receipt bag ID duration is 200ms.Preferably, be less than or equal to the prerequisite of packet ID cycle duration at time slot calibration cycle under, described time slot calibration cycle can be selected according to actual conditions.
Described receiving terminal 20, for receiving described packet; No. ID of Record ID continuous print two packets, receive above-mentioned two packets the timeslot number of process, and receive total duration that above-mentioned two packets experience; Slot timer loading values is obtained according to following formula:
Slot timer loading values=total duration/timeslot number
And according to described slot timer loading values, slot timer is reset.
Preferably, described receiving terminal 20 comprises: receiving element 21, timer 23, resolution unit 22, processing unit 24 and the second time slot maintenance unit 25, as shown in Figure 4.
Described receiving element 21, for receiving the packet coming from described transmitting terminal 10;
Described timer 23, for recording the total duration receiving above-mentioned two packets and experience, is designated as Tn; Preferably, some start-up time of described timer 23 is put with the time span of the time slot starting point of described transmitting terminal 10 consistent with the time span of the time slot starting point of described transmitting terminal 10 and the shut-in time of described timer 23.
Described resolution unit 22, for resolving described packet, records the ID of described packet, and by described No. ID calculate receive above-mentioned two packets the timeslot number of process, be designated as Fn, described timer controlled simultaneously.Preferably, described resolution unit 22 is carried out control to described timer and is: when described receiving element 21 receives the first packet, records No. ID (such as Fisrt_ID) of described first packet, and starts described timer 23; When described receiving element 21 receives the second packet, record No. ID (such as Last_ID) of described second packet, and close described timer 23, timeslot number Fn=Last_ID-Fisrt_ID, namely timeslot number is the difference of the packet ID of the two bag data successively received.
Described processing unit 24, for obtaining slot timer loading values (being designated as Pn) according to following formula:
Slot timer loading values Pn=total duration Tn/ timeslot number Fn.
It should be noted that, due to communication interference may be there is, if after receiving element 21 receives packet first, again packet is not received through a time slot calibration cycle, the packet ID that then explanation two is adjacent has in fact striden across a time slot calibration cycle, accurately cannot obtain the loading values of slot timer, therefore processing unit 24 can abandon the calibration of this time slot.Resolution unit 22 sends instruction and closes timer 23 and re-execute time slot calibration.
Second time slot maintenance unit 25, for resetting described slot timer according to described slot timer loading values, and safeguards the time slot of described receiving terminal 20.The time slot that second time slot maintenance unit 25 needs the slot timer startup ensureing receiving terminal 20 to be not later than described transmitting terminal 10 starts.According to the slot timer loading values that processing unit 24 obtains, slot timer is loaded, and by safeguarding the time slot of receiving terminal 20, ensure that receiving terminal 20 is identical with transmitting terminal 10 time slot width.
Time slot calibration steps provided by the invention and device can make the wireless device solution of the rudimentary MCU of existing employing under the condition not using plug-in crystal or crystal oscillator, also can realize receiving and dispatching time slot comparatively accurately; And owing to eliminating external-hanging structure, make whole apparatus structure simple, be easy to manufacture, considerably reduce the production cost of components and parts.
Although describe in detail about example embodiment and advantage thereof, being to be understood that when not departing from the protection range of spirit of the present invention and claims restriction, various change, substitutions and modifications can being carried out to these embodiments.For other examples, those of ordinary skill in the art should easy understand maintenance scope in while, the order of processing step can change.
In addition, range of application of the present invention is not limited to the technique of the specific embodiment described in specification, mechanism, manufacture, material composition, means, method and step.From disclosure of the present invention, to easily understand as those of ordinary skill in the art, for the technique existed at present or be about to develop, mechanism, manufacture, material composition, means, method or step later, wherein their perform the identical function of the corresponding embodiment cardinal principle that describes with the present invention or obtain the identical result of cardinal principle, can apply according to the present invention to them.Therefore, claims of the present invention are intended to these technique, mechanism, manufacture, material composition, means, method or step to be included in its protection range.