CN104022963B - Communication and the communication means and device deposited - Google Patents
Communication and the communication means and device deposited Download PDFInfo
- Publication number
- CN104022963B CN104022963B CN201410001049.9A CN201410001049A CN104022963B CN 104022963 B CN104022963 B CN 104022963B CN 201410001049 A CN201410001049 A CN 201410001049A CN 104022963 B CN104022963 B CN 104022963B
- Authority
- CN
- China
- Prior art keywords
- communication
- data
- round
- module
- robin queue
- 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
Links
Landscapes
- Mobile Radio Communication Systems (AREA)
- Communication Control (AREA)
Abstract
The invention discloses one kind of multiple communication modes and the communication means and device deposited, it is related to Optical Distribution Network field, method includes:For each data communication module configures corresponding communication task in RTOS, all communication tasks are formed into communication task queue;When judging that the communication disruption signal of data communication module is produced, region of memory is opened up, be defined as round-robin queue;Judge that round-robin queue is non-full queue, receive communications reception data;Communications reception data is stored to communication data storage element;The communications processing data of communication data reading unit is read, communications processing data is processed and sent by corresponding communication interface.Operating efficiency of the invention is higher, the bit error rate is relatively low, not only increases the operating efficiency of CPU, and transmission data stabilization reliability, user-friendly.
Description
Technical field
The present invention relates to Optical Distribution Network field, and in particular to one kind of multiple communication modes and the communication means and dress deposited
Put.
Background technology
FTTH(Fiber-To-The-Home, fiber to the home)Mainly use PON(Passive Optical Network,
EPON)Technology, FTTH mainly includes OLT(Optical line terminal, optical line terminal)、ODN(Optical
Distribution Network, optical distribution network)And ONU(Optical Network Unit, optical network unit).OLT is main
For realizing that fiber backbone network accesses to ODN, ONU is used to export ODN to user port, and ODN opens light for OLT and ONU
The transmission channel of fiber communication, ODN is mainly made up of various ODN equipment, and ODN plays a crucial role in optical communication network.
With the pulling that FTTH builds, the development speed of ODN is more and more faster, and people use intelligence ODN technologies by traditional ODN
Technology is combined with modern science and technology, realizes the intelligent management of ODN.Intelligent ODN technologies pass through eID(Electronic
Identity, electronic tag)Technology is realized to optical fiber(Such as tail optical fiber, jumping fiber, optical branching device tail optical fiber etc.)Unique mark;eID
With reference to modern data storehouse and network management technology, optical fiber information data can be realized(Such as light distribution line device port number of resources
According to, optical fiber connection relation data etc.)Automatic storage, importing and derive.
The intelligent management of ODN causes that ODN system possesses intelligent functions(Such as automatic store function of optical fiber information, light
Fine connection relation information automatic identification function, optical fiber resource information calibration function, visualization construction guiding function etc.).The intelligence of ODN
Management can be changed can be by ODN webmasters, PON webmasters, resource management system, OSS(Comprehensive service operation and management platform)With it is existing
By Network Management Equipment constitute unified management platform, provide the user panorama type network management.In order to realize the intelligent pipe of ODN
Reason between ODN equipment and NM server, it is necessary to realize proper communication.
It is shown in Figure 1, between the master control administrative unit and the NM server of Network Management Equipment of ODN equipment it is main by with
Too network interface communication, NM server can issue control command, transmission data by Ethernet interface to master control administrative unit to be believed
Feedack can be back to NM server by breath, master control administrative unit.In ODN, Ethernet is a kind of the most frequently used
Local area network communication mode;Ethernet mainly realizes the communication between master control administrative unit and webmaster, master control administrative unit and webmaster
Can either be by RJ45 interface direct communications, it is also possible to by switch communication.
Intelligent management terminal is realized communicating by USB communication interface or bluetooth communication interface with master control administrative unit;Intelligence
The packet that energy management terminal will receive master control administrative unit is sent to NM server by 3G network or WiFi.
Due to most of Intelligent management terminal equipment(Such as mobile phone, panel computer etc.)Typically use USB interface, therefore intelligence
Energy management terminal is communicated by USB interface with master control administrative unit, can expand the range of application of ODN equipment;Meanwhile, USB connects
Mouth supports hot plug operations, can not only at any time insert or pull out USB, and traffic rate is higher.
Bluetooth module is all used due to general on common mobile intelligent terminal, therefore Intelligent management terminal passes through Bluetooth communication
Interface communicates with master control administrative unit, can not only meet the requirement of ODN equipment, and compared with USB interface, Bluetooth communication connects
The communication distance of mouth is farther out(The communication distance of USB interface is 1~2 meter, and the communication distance of bluetooth communication interface is 10 meters or so).
Usb communication mode is combined with Blue-tooth communication method, proper communication between network management system and ODN equipment is ensure that.
Mainly communicated by RS485 EBIs between master control administrative unit and allocation manager unit in ODN equipment.
RS485 EBIs overcome RS232 interfaces cannot networking defect, RS485 EBIs be at best able to hang 128 nodes,
And RS485 EBIs use differential signal transmission, not only strong antijamming capability, and also transmission rate is higher(Generally
10Mbps), transmission range is also farther out(Transmission range can reach 3000 meters).Therefore, the master control administrative unit in ODN equipment and
Allocation manager unit realizes the best results of communication by the scheme of RS485 EBIs.
Communicated by 1-Wire bus communication interfaces between allocation manager unit and eID modules;The interface of ODN equipment compared with
Many, by have selected, the communication of 1-Wire bus communication interfaces is not only simple in structure, communication linkage facilitates, and is adapted to collection multiterminal
The equipment communication occasion of message breath.1-Wire bus communications can enter row information and exchange by a data lines and external equipment,
One 1-Wire bus can mount the device of multiple autonomous workings;The main control chip of allocation manager unit is by reading ROM information
Specify device and communicate to recognize.
Due to there is Ethernet interface interface, USB communication interface, bluetooth communication interface, RS485 bus communications in ODN equipment
Interface and the various data communication modes of 1-Wire bus communication interfaces, each communication modes function in whole system communication are equal
Differ, therefore, Network Management Equipment occurs the concurrent situation of multiple communication modes when running.Such as following 2 kinds of situations:
(1)When Network Management Equipment carries out device upgrade, Network Management Equipment is by AKU by reaching master control pipe under Ethernet interface
Manage the caching of unit, its own system of upgrading for main control chip;Network Management Equipment can also synchronously will be corresponding by RS485 EBIs
AKU, is downloaded to allocation manager unit.
(2)When Network Management Equipment carries out equipment routing inspection, allocation manager unit needs to be read by 1-Wire bus communication interfaces
The port information of eID modules, allocation manager unit also needs to that the information for assembling disk is uploaded into master control by RS485 EBIs
Administrative unit.
Communication and deposit can be so that ODN equipment has following defect when using:
(1)Communication and when depositing, CPU needs to process the data of multiple communication interface transmission, various communications simultaneously
The data of interface transmission may cause conflict;Not only operating efficiency is relatively low for CPU, and easily stuck, is not easy to people and uses.
(2)Because communication may be operated to shared data (being located in same internal storage location) simultaneously(I.e.
Data are stored in internal memory by one communication interface, and another communication interface carries out respective handling to the data in internal memory), it is thus possible to
Occur when a kind of corresponding data processing of communication interface is not yet completed, another communication interface receives the feelings of new data again
Condition;If the reception speed for receiving the communication interface of new data is faster than the processing speed of the communication interface of processing data, server
The new data of reception is possible to cover historical data, and then causes data transmission fault, security presence hidden danger.In order to prevent data
Error of transmission, can separate individually operated by data receiver and data processing, i.e. the corresponding data receiver behaviour of different communication mode
Make, data processing operation individually weaves into subfunction, but individually weave into the logical arrangement ratio that subfunction can cause in main program
More difficult, the operating efficiency of programming is relatively low.
The content of the invention
For defect present in prior art, it is an object of the invention to provide one kind of multiple communication modes and deposit it is logical
Letter method and device, its operating efficiency is higher, the bit error rate is relatively low, not only increases the operating efficiency of CPU, and transmission data are steady
It is fixed reliable, it is user-friendly.
To achieve the above objectives, the present invention is adopted the technical scheme that:One kind of multiple communication modes and the communication means deposited,
Comprise the following steps:
A, the Kernel Porting of embedded real-time operating system RTOS is entered into communication equipment, communication interface is write in RTOS not
Same data communication module, a kind of communication interface of each data communication module correspondence;For each data communication module configures right
All communication tasks are divided into different priority by the communication task answered according to function to be performed by, form communication task
Queue;
B, the order according to communication task queue, the communication disruption signal for judging data communication module by RTOS are produced
When, one piece of region of memory is opened up, region of memory is defined as round-robin queue;By the first internal storage location mark in round-robin queue
It is judging unit, judging unit is marked with the empty information of the full information of round-robin queue's data, round-robin queue's data;By a number
According to rear pointers are received, second internal storage location in round-robin queue is labeled as communication data storage element;By a number
According to front pointers are read, second internal storage location in round-robin queue is labeled as communication data reading unit;
C, judge stored data count in round-robin queue not less than round-robin queue threshold value when, receive and communicate
The corresponding communications reception data of break signal;Judge whether the rear pointers in round-robin queue are pointed in same with front pointers
Memory cell, if so, going to step D, otherwise goes to step E;
D, the information for reading judging unit, if the information of judging unit is the empty information of round-robin queue's data, go to step
E;If the information of judging unit is the full information of round-robin queue's data, step H is gone to;
E, communications reception data is stored to communication data storage element, while rear pointers are pointed into next interior deposit receipt
Unit is simultaneously marked as communication data storage element, goes to step F;
F, send corresponding with communications reception data block type semaphore, judge rear pointers in round-robin queue and
Whether front pointers point to same internal storage location, if so, going to step G, otherwise go to step H;
G, the information for reading judging unit, if the information of judging unit is the full information of round-robin queue's data, go to step
H;If the information of judging unit is the empty information of round-robin queue's data, step B is gone to;
H, the communications processing data for reading communication data reading unit, while front pointers are pointed into next interior deposit receipt
Unit, be marked as communication data reading unit, communications processing data is processed and sent by corresponding communication interface;
Go to step I;
I, repeat step B~step H, until all communications reception datas receive, all communications processing datas
It is sent, releasing memory region.
On the basis of above-mentioned technical proposal, the different data communication modules of communication interface described in step A is:1-Wire
Bus communication module, usb communication module, RS485 communication modules, ethernet communication module and bluetooth communication.
On the basis of above-mentioned technical proposal, communication task described in step A includes 1-Wire read-writes task, usb data
Reception task, usb data process task, RS485 data receivers task, RS485 data processing tasks, ethernet communication task and
Bluetooth communication task.
On the basis of above-mentioned technical proposal, if the communication disruption signal without data communication module in step B is produced,
Re-execute step B.
On the basis of above-mentioned technical proposal, the size of round-robin queue described in step B be 256 bytes, 512 bytes or
1024 bytes.
On the basis of above-mentioned technical proposal, threshold value described in step C is the 85%~90% of round-robin queue's memory amount.
On the basis of above-mentioned technical proposal, if data count stored in round-robin queue in step C exceedes circulation
The threshold value of queue, then pass directly to step F.
A kind of communication based on the above method and the communicator deposited, including:
Programming module, is used for:The Kernel Porting of embedded RTOS is entered into communication equipment, various communications is write in RTOS and is connect
A kind of different data communication module of mouth, communication interface of each data communication module correspondence, sends to task configuration module and appoints
Business configuration signal;
Task configuration module, is used for:It is each data communication module after receiving the task configuration signal that programming module sends
Corresponding communication task is configured, all communication tasks are divided into different priority according to function to be performed by, form logical
Letter task queue simultaneously sends communication disruption detection signal to communication disruption signal detection module;
Communication disruption signal detection module, is used for:Receive after interrupting detection signal, according to the order of communication task queue,
When judging that the communication disruption signal of data communication module is produced by RTOS, send round-robin queue to round-robin queue's definition module and determine
Adopted signal;
Round-robin queue's definition module, is used for:Receive round-robin queue's definition signal that communication disruption signal detection module sends
Afterwards, one piece of region of memory is opened up, region of memory is defined as round-robin queue;By the first internal storage location mark in round-robin queue
It is judging unit, judging unit is marked with the empty information of the full information of round-robin queue's data, round-robin queue's data;Referred to by rear
Pin, communication data storage element is labeled as by second internal storage location in round-robin queue;By front pointers, team will be circulated
Second internal storage location in row sends data receiver inspection labeled as communication data reading unit and to data receiver detection module
Survey signal;
Data receiver detection module, is used for:After receiving the data receiver detection signal that round-robin queue's definition module sends, sentence
Determine stored data count in round-robin queue, not less than the threshold value of round-robin queue, send logical to communication data storage module
Letter data storage assembly;
Communication data storage module, is used for:After receiving the communication data storage assembly that data receiver detection module sends, connect
Communications reception data corresponding with communication disruption signal is received, judges whether the rear pointers in round-robin queue refer to front pointers
To same internal storage location, if so, sending communication data to communication data judge module judges signal;Otherwise to data storage mould
Block sends data storage signal;
Communication data judge module, is used for:After the communication data that reception communication data storage module sends judges signal, read
The information of judging unit is taken, if the information of judging unit is the empty information of round-robin queue's data, number is sent to data storage module
According to storage assembly;If the information of judging unit is the full information of round-robin queue's data, data processing is sent to data processing module
Signal;
Data storage module, is used for:After receiving data storage signal, communications reception data is stored to communication data storage
Unit, while rear pointers are pointed into next internal storage location and communication data storage element is marked as, to data processing
Detection module sends data processing detection signal;
Data processing detection module, is used for:After receiving data processing detection signal, send corresponding with communications reception data
Block type semaphore, judges whether the rear pointers in round-robin queue point to same internal storage location with front pointers, if so,
Data processing is sent to data processing judge module judge signal;Otherwise data processing signal is sent to data processing module;
Data processing judge module, is used for:After the data processing that reception data processing detection module sends judges signal, read
The information of judging unit is taken, if the information of judging unit is the full information of round-robin queue's data, sends number to data processing module
According to process signal;If the information of judging unit is the empty information of round-robin queue's data, sent to communication disruption signal detection module
Communication disruption detection signal;
Data processing module, is used for:After receiving data processing signal, the communication process number of communication data reading unit is read
According to while front pointers add 1, communications processing data being processed and sent by corresponding communication interface;
Internal memory release module, is used for:All communications reception datas are received, all communications processing datas are sent
Afterwards, releasing memory region.
Compared with prior art, the advantage of the invention is that:
(1)The present invention uses embedded RTOS, by the multi-task mechanism of RTOS, can be by the data receiver of every kind of communication
It is arranged in different tasks with treatment and is realized;Using the interrupt mechanism of RTOS, be each communication mode set it is different in
It is disconnected, once interrupt occurring, a block type semaphore will be sent out to corresponding reception task(The semaphore is only received, is connect
Receipts task can just be performed).Therefore, the present invention enables to various communication data real-time Transmissions, can avoid communication
The operation conflict caused when concurrent, improves operating efficiency, reduces the bit error rate, can not only improve the operating efficiency of CPU, Er Qiebian
Used in people.
(2)The present invention uses the data structure of circle queue(Round-robin queue), while increased data flow control mechanism.This
When invention is used, after each system initialization, rear pointers point to the tail of the queue of circle queue, often receive a data, and rear refers to
Pin adds 1(Point to next internal storage location).Judge whether storage element round-robin queue has expired before receiving data every time, if so,
Pause receives data, waits data processing task to perform.
Data processing task takes out the data in round-robin queue and is correspondingly processed by front pointers, often takes out one
Individual data, front pointers add 1(Point to next internal storage location).Access every time judges whether front pointers have referred to according to preceding
To the tail end of round-robin queue, if so, not carrying out any operation then.
During due to internal memory round-robin queue sky and queue full, the sensing same region of memory of front pointers and rear pointers.
In order to distinguish the full state and dummy status of round-robin queue of storage element circulation team, the present invention is reserved in the original position of round-robin queue
Go out a judging unit, judging unit is marked with the full information of round-robin queue's data and the empty information of round-robin queue's data.When
When front pointers and rear pointers point to same internal storage location, by the information for reading judging unit, it becomes possible to accurately identify
The full dummy status of round-robin queue;Not only it is effectively prevented from covering of the new data to historical data, it is ensured that data are accurately transmitted, and
And internal memory can be cyclically utilized, improve the utilization rate of internal memory.
(3)The present invention can utilize the multi-task mechanism of RTOS, various communication interfaces are received and treatment is individually divided into
Task so that the level of whole program preferably, is not only convenient for the maintenance and expansion in later stage, and improve communication
The collaboration capabilities of concurrent efforts.
Brief description of the drawings
Fig. 1 is the Organization Chart of OND systems communication in background of invention;
Fig. 2 is that RTOS carries out the structure chart of task scheduling in the embodiment of the present invention;
Fig. 3 is the schematic flow sheet of the circle queue of data processing and data reception operation in the embodiment of the present invention;
Fig. 4 is the schematic flow sheet of terminal triggering reception task in the embodiment of the present invention;
Fig. 5 is the schematic flow sheet of RS485 communication interfaces and USB communication interface transmission data in the embodiment of the present invention.
Specific embodiment
The present invention is described in further detail below in conjunction with drawings and Examples.
Shown in Figure 2, communication in the embodiment of the present invention and the communication means deposited are comprised the following steps:
S1:By embedded RTOS(Real Time Operation System, real time operating system)Kernel Porting enter
Communication equipment, writes the different data communication module of various communication interfaces, each data communication module correspondence one in RTOS
Plant communication interface.
The different data communication module of various communication interfaces is:1-Wire bus communications module, usb communication module, RS485
Communication module, ethernet communication module and bluetooth communication.
S2:It is each data communication module configures corresponding communication task, by all communication tasks according to being performed
Function is divided into different priority, forms communication task queue.
Communication task includes that 1-Wire read-writes task, usb data receive task, usb data process task, RS485 data
Reception task, RS485 data processing tasks, ethernet communication task and Bluetooth communication task.
S3:According to the order of communication task queue, in determining whether the communication of data communication module successively by RTOS
Break signal is produced, if so, going to step S4, otherwise re-executes step S3.
S4:One piece of region of memory is opened up, region of memory is defined as round-robin queue, the size of round-robin queue is according to user's
Demand is set, generally 256 bytes, 512 bytes or 1024 bytes.
First internal storage location in round-robin queue is labeled as judging unit, judging unit is marked with round-robin queue's data
Full information, the information of round-robin queue's data sky.
By a rear(Data receiver)Pointer, communication data is labeled as by second internal storage location in round-robin queue
Storage element;By a front(Digital independent)Pointer, by second internal storage location in round-robin queue labeled as communication number
According to reading unit.
S5:Judge stored data count in round-robin queue, if more than the threshold value of round-robin queue(Threshold value typically sets
It is set to the 85%~90% of round-robin queue's memory amount), if it is not, going to step S6, otherwise go to step S9.
S6:Receive corresponding with communication disruption signal communications reception data, judge rear pointers in round-robin queue and
Whether front pointers point to same internal storage location, if so, going to step S7, otherwise go to step S8.
S7:The information of judging unit is read, if the information of judging unit is the empty information of round-robin queue's data, step is gone to
Rapid S8.If the information of judging unit is the full information of round-robin queue's data, step S11 is gone to.
S8:Communications reception data is stored to communication data storage element, while rear pointers add 1(That is rear pointers refer to
To next internal storage location, communication data storage element is marked as), go to step S9.
S9:Send corresponding with communications reception data block type semaphore, judge rear pointers in round-robin queue and
Whether front pointers point to same internal storage location, if so, going to step S10, otherwise go to step S11.
S10:The information of judging unit is read, if the information of judging unit is the full information of round-robin queue's data, is gone to
Step S11, if the information of judging unit is the empty information of round-robin queue's data, goes to step S3.
S11:The communications processing data of communication data reading unit is read, while front pointers add 1(That is front pointers refer to
To next internal storage location, it is marked as communication data reading unit), by communications processing data by corresponding communication
Interface treatment is concurrently sent, and goes to step S12.
S12:Repeat step S5~S11, until all communications reception datas are received, all communications processing datas send
Finish, releasing memory region.
The operation principle of communication and the communication means deposited in the embodiment of the present invention is as follows:
In order to improve the utilization rate of internal memory, the present invention is using this data structure of round-robin queue.When in round-robin queue
When the data count of storage exceedes the threshold value for setting, because the data of the storage in round-robin queue are larger, therefore in order to coordinate place
The multiple data tasks of reason, prevent communication data capped, it is necessary to stop receiving communication data, the data that priority treatment has been received,
To reduce the bit error rate.
If data storage sum is not less than the threshold value for setting in round-robin queue, the threshold value is traditionally arranged to be whole team
The 85%~90% of row memory capacity), the communication data storage that microprocessor will be received to the interior deposit receipt pointed by rear pointers
In unit.Often received a communication data, rear pointers add 1, it is ensured that next communication data of reception can normal storage exist
In round-robin queue.
If the round-robin queue in internal memory is in non-null states(That is queue for storing pending processing valid data), micro- place
Device is managed by reading the content of the internal storage location pointed by front pointers, the data in round-robin queue are obtained, one is often run through and is led to
Letter data, front pointers will add 1, with ensure microprocessor accurately obtain round-robin queue in next valid data, it is and right
The data are correspondingly processed.
The communication in the embodiment of the present invention and the communication means deposited are illustrated below by 1 embodiment.
The Kernel Porting of RTOS is entered into communication equipment, the different data communication mould of various communication interfaces is write in RTOS
Block, a kind of communication interface of each data communication module correspondence.
For each data communication module configures corresponding communication task, by all communication tasks according to function to be performed by
Different priority are divided into, communication task queue is formed.
Referring to shown in Fig. 4, Fig. 5, RTOS judges to have the usb communication interrupt signal of usb communication module to produce, and opens up one piece
The region of memory of 1024 bytes, round-robin queue is defined as by region of memory, by the first internal storage location mark in round-robin queue
It is judging unit, judging unit is marked with the empty information of the full information of round-robin queue's data, round-robin queue's data.Referred to by rear
Pin, communication data storage element is labeled as by second internal storage location in round-robin queue;By front pointers, team will be circulated
Second internal storage location in row is labeled as communication data reading unit.
Stored data count in round-robin queue, not less than the threshold value of round-robin queue(Threshold value is set to round-robin queue
The 87% of memory amount), receive usb communication and receive data;Now the rear pointers in round-robin queue point to same with front pointers
One internal storage location, the but because information of judging unit is the empty information of round-robin queue data, so by the storage of usb communication data
Deposit to communication data storage element, shown in Figure 3, rear pointers add 1.
Send block type semaphore 3 corresponding with usb communication reception data, rear pointers and front in round-robin queue
Pointer does not point to same internal storage location;The usb communication processing data of communication data reading unit is read, it is shown in Figure 3,
Front pointers add 1.Usb communication processing data is processed and sent by RS485 communication modules.
Communication in the embodiment of the present invention and the communicator deposited, including:
Programming module, is used for:The Kernel Porting of embedded RTOS is entered into communication equipment, various communications is write in RTOS and is connect
A kind of different data communication module of mouth, communication interface of each data communication module correspondence simultaneously sends to task configuration module
Task configures signal.
Task configuration module, is used for:It is each data communication module after receiving the task configuration signal that programming module sends
Corresponding communication task is configured, all communication tasks are divided into different priority according to function to be performed by, form logical
Letter task queue simultaneously sends communication disruption detection signal to communication disruption signal detection module.
Communication disruption signal detection module, is used for:Receive after interrupting detection signal, according to the order of communication task queue,
Determine whether that the communication disruption signal of data communication module is produced successively by RTOS, if so, to round-robin queue's definition module
Round-robin queue's definition signal is sent, otherwise continues to determine whether that the communication disruption signal of data communication module is produced.
Round-robin queue's definition module, is used for:Receive round-robin queue's definition signal that communication disruption signal detection module sends
Afterwards, one piece of region of memory is opened up, region of memory is defined as round-robin queue;By the first internal storage location mark in round-robin queue
It is judging unit, judging unit is marked with the empty information of the full information of round-robin queue's data, round-robin queue's data;Referred to by rear
Pin, communication data storage element is labeled as by second internal storage location in round-robin queue;By front pointers, team will be circulated
Second internal storage location in row sends data receiver inspection labeled as communication data reading unit and to data receiver detection module
Survey signal.
Data receiver detection module, is used for:After receiving the data receiver detection signal that round-robin queue's definition module sends, sentence
Stored data count in disconnected round-robin queue, if more than the threshold value of round-robin queue, if it is not, storing mould to communication data
Block sends communication data storage assembly;Otherwise data processing detection signal is sent to data processing detection module.
Communication data storage module, is used for:After receiving the communication data storage assembly that data receiver detection module sends, connect
Communications reception data corresponding with communication disruption signal is received, judges whether the rear pointers in round-robin queue refer to front pointers
To same internal storage location, if so, sending communication data to communication data judge module judges signal;Otherwise to data storage mould
Block sends data storage signal.
Communication data judge module, is used for:After the communication data that reception communication data storage module sends judges signal, read
The information of judging unit is taken, if the information of judging unit is the empty information of round-robin queue's data, number is sent to data storage module
According to storage assembly;If the information of judging unit is the full information of round-robin queue's data, data processing is sent to data processing module
Signal.
Data storage module, is used for:After receiving data storage signal, communications reception data is stored to communication data storage
Unit, while rear pointers add 1 and send data processing detection signal to data processing detection module.
Data processing detection module, is used for:After receiving data processing detection signal, send corresponding with communications reception data
Block type semaphore, judges whether the rear pointers in round-robin queue point to same internal storage location with front pointers, if so,
Data processing is sent to data processing judge module judge signal;Otherwise data processing signal is sent to data processing module.
Data processing judge module, is used for:After the data processing that reception data processing detection module sends judges signal, read
The information of judging unit is taken, if the information of judging unit is the full information of round-robin queue's data, sends number to data processing module
According to process signal.If the information of judging unit is the empty information of round-robin queue's data, sent to communication disruption signal detection module
Communication disruption detection signal.
Data processing module, is used for:After receiving data processing signal, the communication process number of communication data reading unit is read
According to while front pointers add 1, communications processing data being processed and sent by corresponding communication interface.
Internal memory release module, is used for:All communications reception datas are received, all communications processing datas are sent
Afterwards, releasing memory region.
The present invention is not limited to the above-described embodiments, for those skilled in the art, is not departing from
On the premise of the principle of the invention, some improvements and modifications can also be made, these improvements and modifications are also considered as protection of the invention
Within the scope of.The content not being described in detail in this specification belongs to prior art known to professional and technical personnel in the field.
Claims (8)
1. one kind of multiple communication modes and the communication means deposited, it is characterised in that:Comprise the following steps:
A, the Kernel Porting of embedded real-time operating system RTOS is entered into communication equipment, communication interface is write in RTOS different
Data communication module, a kind of communication interface of each data communication module correspondence;For each data communication module configures corresponding
All communication tasks are divided into different priority by communication task according to function to be performed by, form communication task queue;
B, the order according to communication task queue, when judging that the communication disruption signal of data communication module is produced by RTOS, open
One piece of region of memory is warded off, region of memory is defined as round-robin queue;First internal storage location in round-robin queue is labeled as to sentence
Disconnected unit, judging unit is marked with the empty information of the full information of round-robin queue's data, round-robin queue's data;Connect by a data
Rear pointers are received, second internal storage location in round-robin queue is labeled as communication data storage element;Read by a data
Front pointers are taken, second internal storage location in round-robin queue is labeled as communication data reading unit;
C, judge stored data count in round-robin queue not less than round-robin queue threshold value when, receive and communication disruption letter
Number corresponding communications reception data;Judge whether the rear pointers in round-robin queue point to same interior deposit receipt with front pointers
Unit, if so, going to step D, otherwise goes to step E;
D, the information for reading judging unit, if the information of judging unit is the empty information of round-robin queue's data, go to step E;If
The information of judging unit is the full information of round-robin queue's data, goes to step H;
E, communications reception data is stored to communication data storage element, at the same by rear pointers point to next internal storage location,
And communication data storage element is marked as, go to step F;
F, transmission block type semaphore corresponding with communications reception data, only receive the block type semaphore, and communication task is
Can perform;Judge whether the rear pointers in round-robin queue point to same internal storage location with front pointers, if so, going to step
Rapid G, otherwise goes to step H;
G:The information of judging unit is read, if the information of judging unit is the full information of round-robin queue's data, step H is gone to;If
The information of judging unit is the empty information of round-robin queue's data, goes to step B;
H, the communications processing data for reading communication data reading unit, at the same by front pointers point to next internal storage location, general
It is labeled as communication data reading unit, and communications processing data is processed and sent by corresponding communication interface;Go to
Step I;
I, step B~step H is repeated, until all communications reception datas are received and all communications processing datas send
Finish, releasing memory region.
2. communication as claimed in claim 1 and the communication means deposited, it is characterised in that:Communicated described in step A
The different data communication module of interface is:1-Wire bus communications module, usb communication module, RS485 communication modules, Ethernet
Communication module and bluetooth communication.
3. communication as claimed in claim 2 and the communication means deposited, it is characterised in that:Communicated described in step A
Task include 1-Wire read-write task, usb data receive task, usb data process task, RS485 data receivers task,
RS485 data processing tasks, ethernet communication task and Bluetooth communication task.
4. communication as described in any one of claims 1 to 3 and the communication means deposited, it is characterised in that:In step B
If the communication disruption signal without data communication module is produced, step B is re-executed.
5. communication as described in any one of claims 1 to 3 and the communication means deposited, it is characterised in that:In step B
The size of the round-robin queue is 256 bytes, 512 bytes or 1024 bytes.
6. communication as described in any one of claims 1 to 3 and the communication means deposited, it is characterised in that:In step C
The threshold value is the 85%~90% of round-robin queue's memory amount.
7. communication as described in any one of claims 1 to 3 and the communication means deposited, it is characterised in that:In step C
If stored data count exceedes the threshold value of round-robin queue in round-robin queue, step F is passed directly to.
8. a kind of communication based on claim 1 to 7 any one methods described and the communicator deposited, its feature exist
In, including:
Programming module, is used for:The Kernel Porting of embedded RTOS is entered into communication equipment, various communication interfaces are write in RTOS not
A kind of same data communication module, communication interface of each data communication module correspondence sends task and matches somebody with somebody to task configuration module
Confidence number;
Task configuration module, is used for:It is the configuration of each data communication module after receiving the task configuration signal that programming module sends
All communication tasks are divided into different priority by corresponding communication task according to function to be performed by, are formed communication and are appointed
Business queue simultaneously sends communication disruption detection signal to communication disruption signal detection module;
Communication disruption signal detection module, is used for:Receive after interrupting detection signal, according to the order of communication task queue, pass through
When RTOS judges that the communication disruption signal of data communication module is produced, round-robin queue's definition letter is sent to round-robin queue's definition module
Number;
Round-robin queue's definition module, is used for:After receiving round-robin queue's definition signal that communication disruption signal detection module sends, open
One piece of region of memory is warded off, region of memory is defined as round-robin queue;First internal storage location in round-robin queue is labeled as to sentence
Disconnected unit, judging unit is marked with the empty information of the full information of round-robin queue's data, round-robin queue's data;By rear pointers,
Second internal storage location in round-robin queue is labeled as communication data storage element;By front pointers, by round-robin queue
Second internal storage location labeled as communication data reading unit and to data receiver detection module send data receiver detection letter
Number;
Data receiver detection module, is used for:After receiving the data receiver detection signal that round-robin queue's definition module sends, judge to follow
Stored data count in ring queue, not less than the threshold value of round-robin queue, communication number is sent to communication data storage module
According to storage assembly;
Communication data storage module, is used for:After receiving the communication data storage assembly that data receiver detection module sends, receive with
The corresponding communications reception data of communication disruption signal, judges whether the rear pointers in round-robin queue point to together with front pointers
One internal storage location, if so, sending communication data to communication data judge module judges signal;Otherwise sent out to data storage module
Send data storage signal;
Communication data judge module, is used for:After the communication data that reception communication data storage module sends judges signal, reading is sentenced
The information of disconnected unit, if the information of judging unit is the empty information of round-robin queue's data, sends data and stores up to data storage module
Deposit signal;If the information of judging unit is the full information of round-robin queue's data, data processing signal is sent to data processing module;
Data storage module, is used for:After receiving data storage signal, communications reception data is stored to communication data and stores single
Unit, while rear pointers are pointed into next internal storage location and communication data storage element is marked as, examines to data processing
Survey module and send data processing detection signal;
Data processing detection module, is used for:After receiving data processing detection signal, obstruction corresponding with communications reception data is sent
Formula semaphore, only receives the block type semaphore, and communication task can just be performed;Judge rear pointers in round-robin queue with
Whether front pointers point to same internal storage location, if so, sending data processing to data processing judge module judges signal;
Otherwise data processing signal is sent to data processing module;
Data processing judge module, is used for:After the data processing that reception data processing detection module sends judges signal, reading is sentenced
The information of disconnected unit, if the information of judging unit is the full information of round-robin queue's data, is sent at data to data processing module
Reason signal;If the information of judging unit is the empty information of round-robin queue's data, is sent to communication disruption signal detection module and communicated
Interrupt detection signal;
Data processing module, is used for:After receiving data processing signal, the communications processing data of communication data reading unit is read,
Front pointers add 1 simultaneously, and communications processing data is processed and sent by corresponding communication interface;
Internal memory release module, is used for:All communications reception datas are received and after all communications processing datas are sent,
Releasing memory region.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410001049.9A CN104022963B (en) | 2014-01-02 | 2014-01-02 | Communication and the communication means and device deposited |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410001049.9A CN104022963B (en) | 2014-01-02 | 2014-01-02 | Communication and the communication means and device deposited |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104022963A CN104022963A (en) | 2014-09-03 |
CN104022963B true CN104022963B (en) | 2017-06-13 |
Family
ID=51439537
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410001049.9A Active CN104022963B (en) | 2014-01-02 | 2014-01-02 | Communication and the communication means and device deposited |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104022963B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105577415B (en) * | 2014-10-17 | 2020-02-14 | 中兴通讯股份有限公司 | Intelligent optical distribution network equipment |
CN105893279B (en) * | 2016-03-30 | 2019-04-26 | 北京经纬恒润科技有限公司 | A kind of data transmission method and system based on round-robin queue |
CN108710925A (en) * | 2018-05-15 | 2018-10-26 | 南京博内特信息科技有限公司 | A method of the clothes commodity shelf system based on Internet of Things |
CN108694064A (en) * | 2018-05-15 | 2018-10-23 | 南京博内特信息科技有限公司 | A kind of clothes frame equipments for goods under Internet of Things |
CN108764395A (en) * | 2018-05-15 | 2018-11-06 | 南京博内特信息科技有限公司 | A kind of method of clothes frame equipments for goods under Internet of Things |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1193410A (en) * | 1995-06-15 | 1998-09-16 | 英特尔公司 | A method and apparatus for transporting messages between processors in a multiple processor system |
CN1538300A (en) * | 2003-09-23 | 2004-10-20 | 中兴通讯股份有限公司 | Method of detecting and location of leakage of internal storage of real-time system localization |
KR20040102835A (en) * | 2003-05-29 | 2004-12-08 | 유티스타콤코리아 유한회사 | Method for communication of message queue in real time operating system |
CN101848549A (en) * | 2010-04-29 | 2010-09-29 | 中国人民解放军国防科学技术大学 | Task scheduling method for wireless sensor network node |
-
2014
- 2014-01-02 CN CN201410001049.9A patent/CN104022963B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1193410A (en) * | 1995-06-15 | 1998-09-16 | 英特尔公司 | A method and apparatus for transporting messages between processors in a multiple processor system |
KR20040102835A (en) * | 2003-05-29 | 2004-12-08 | 유티스타콤코리아 유한회사 | Method for communication of message queue in real time operating system |
CN1538300A (en) * | 2003-09-23 | 2004-10-20 | 中兴通讯股份有限公司 | Method of detecting and location of leakage of internal storage of real-time system localization |
CN101848549A (en) * | 2010-04-29 | 2010-09-29 | 中国人民解放军国防科学技术大学 | Task scheduling method for wireless sensor network node |
Also Published As
Publication number | Publication date |
---|---|
CN104022963A (en) | 2014-09-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104022963B (en) | Communication and the communication means and device deposited | |
CN104702474B (en) | A kind of EtherCAT master station devices based on FPGA | |
CN100471156C (en) | Data bus bridge and its working method | |
CN108833237A (en) | Intelligent domestic gateway and its management-control method | |
CN105024942B (en) | A kind of dynamic flow monitoring method | |
CN107092574B (en) | A kind of Multi-serial port caching multiplexing method suitable for electronic equipment on satellite | |
CN104052758A (en) | Self-adaptive method of multiple communication protocols of electric energy meter | |
CN106469125A (en) | A kind of bus communications controller based on FPGA and bus communication control method | |
CN101610116A (en) | Optical port self-adaptive ethernet optical fiber transceiver and adaptive approach thereof | |
CN102426724A (en) | Integrated charging and acquisition terminal | |
CN109828933A (en) | A kind of implementation method of the NCSI function of NCSI function network interface card and network interface card | |
CN103997448B (en) | The method of automatic configuration and system of pattern are transmitted based on physical chip | |
CN105993148B (en) | Network interface | |
CN102840992A (en) | Satellite-borne self-testing method based on satellite network | |
CN108345558B (en) | RS485 centralized configuration unit supporting multiple protocols | |
CN102664918A (en) | Blade server control method and console | |
CN102223452A (en) | Method and system for testing text telephone (TTY) of mobile terminals | |
CN105915518B (en) | A kind of ethernet data frame real time parsing method and device | |
CN109412897A (en) | System and method is realized based on the shared MAC of multi-core processor and FPGA | |
CN105892609B (en) | A kind of method and intelligent terminal of terminal booting and identification memory card synchronous operation | |
CN103107862B (en) | Logical device and MDIO data transmission method for uplink thereof | |
CN1988501B (en) | Realizing device for embedded control path communication using FPGA completing optic transmission device | |
CN109389287A (en) | A kind of performance accounting system for circular knitting machine | |
CN103226535B (en) | A kind of microserver and management method thereof | |
CN108399137A (en) | I2C switching method of the PON modules based on CPLD |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |