CN104202394B - A kind of implementation method of the multitask application program based on GPRS monitor terminals - Google Patents

A kind of implementation method of the multitask application program based on GPRS monitor terminals Download PDF

Info

Publication number
CN104202394B
CN104202394B CN201410439874.7A CN201410439874A CN104202394B CN 104202394 B CN104202394 B CN 104202394B CN 201410439874 A CN201410439874 A CN 201410439874A CN 104202394 B CN104202394 B CN 104202394B
Authority
CN
China
Prior art keywords
gprs
task
data
state
modem
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410439874.7A
Other languages
Chinese (zh)
Other versions
CN104202394A (en
Inventor
徐立强
李琼
杨平
桂仲成
李勇
吴建东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dongfang Electric Group Research Institute of Science and Technology Co Ltd
Original Assignee
Dongfang Electric Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dongfang Electric Corp filed Critical Dongfang Electric Corp
Priority to CN201410439874.7A priority Critical patent/CN104202394B/en
Publication of CN104202394A publication Critical patent/CN104202394A/en
Application granted granted Critical
Publication of CN104202394B publication Critical patent/CN104202394B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention particularly discloses a kind of implementation method of the multitask application program based on GPRS monitor terminals, the multitask application program realizes that multitask includes based on multitask design mode:Begin a task with, Modem serial ports receives task, GPRS scheduler tasks, data parse convert task, GPRS link establishments and keeps task, system monitoring alarming assignment, device data acquisition storage upload task;A kind of implementation method of multitask application program based on GPRS monitor terminals provided by the invention, meet high reliability request of the severe application environment such as photovoltaic plant, wind power plant to GPRS monitor terminals.

Description

A kind of implementation method of the multitask application program based on GPRS monitor terminals
Technical field
The present invention relates to wireless communication technology field, specifically discloses a kind of multitask application based on GPRS monitor terminals The implementation method of program.
Background technology
In the severe industrial applications such as photovoltaic plant, wind power plant, in order to ensure the reliability service of field apparatus, it is necessary to Remote monitoring is carried out to these equipment.GPRS is one of most important data transfer mode in Internet of Things application, extensively should For industry fields such as industrial automation, intelligent grid, intelligent transportation, smart home, logistics, the hydrology, meteorologies.Using GPRS skills Art can easily build field apparatus Intelligent remote monitoring system, for meeting the needs of user.On the one hand, equipment manufacturer The long term monitoring and remote upgrade of equipment running status can be conveniently realized by the monitoring system, so as to realize the long-range of equipment Safeguard, constantly improve the reliability of product, save a large amount of trip expenses and human cost;On the other hand, field apparatus makes User also can easily check the running status of equipment by the remote monitoring system, configure device parameter, set so as to reduce The maintenance cost of received shipment row, and obtain more preferable Consumer's Experience.
But reality the industrial applications such as industry spot such as photovoltaic plant, wind power plant, severe physical environment and Various electromagnetic interferences may cause the GPRS monitor terminal cisco unity malfunctions for being arranged in industry spot, i.e., industry spot is to GPRS The reliability of monitor terminal has very high requirement.
The content of the invention
The technical problems to be solved by the invention are to provide a kind of multitask application program based on GPRS monitor terminals Implementation method, to meet high reliability request of the severe application environment such as photovoltaic plant, wind power plant to GPRS monitor terminals.
In order to solve the above technical problems, present invention employs following technical scheme:
A kind of implementation method of the multitask application program based on GPRS monitor terminals, the multitask application program are based on Multitask design mode realizes that multitask includes:Begin a task with, Modem serial ports receives task, GPRS scheduler tasks, data solution Analyse convert task, GPRS link establishments and keep task, system monitoring alarming assignment, device data acquisition storage upload task;
Begin a task with:Start GPRS wireless communication modules first, then detect embedded microcontroller and serial ports is locally configured The instruction into configuration status whether is received, if being not detected by the instruction in setting time, is normally started into system State, otherwise into systematic parameter configuration state;
Modem serial ports receives task:Modem serial ports receives task and is mainly responsible for periodically inquiry and GPRS wireless communication modules Whether data that GPRS wireless communication module send are had in the serial ports buffering area for the embedded microcontroller being connected, if so, then Take out and be sent into Modem and receive data-message queue;
GPRS scheduler tasks:GPRS scheduler tasks complete the reception of GPRS wireless communication modules data, short message, and The transmission of GPRS data, short message;
Data parse convert task:Data parsing convert task is periodically inquired about following flag bit and located accordingly successively Reason:Data accepted flag position is inquired about, if the flag bit is true, the data received are parsed;Inquire about data and send mark Will position, if the flag bit is true, structure sends packet and passes to GPRS scheduler tasks and transmitted wirelessly;
System monitoring alarming assignment:System monitoring alarming assignment is completed to system mode and the equipment real time data collected Exception monitoring, by the running status of periodic detection system, so as to find system exception in time, and detecting anomalous event When set alert flag bit accordingly, and set sends the flag bit of system exception alarm packet, is changed so that data parse Task is inquired about, built and transmission system alarm packet to GPRS scheduler tasks are transmitted wirelessly;
Device data acquisition stores upload task:Device data acquisition storage upload task is periodically completed to the real-time number of equipment According to collection, storage, and set equipment real time data uploads flag bit, so that data parsing convert task is inquired about, built And transmission equipment real time data bag to GPRS scheduler tasks are transmitted wirelessly;
GPRS link establishments and holding task:GPRS link establishments and keep task complete GPRS communication links foundation and Maintain, the task employ state machine realization, the state machine by " GPRS Modem initialization " state, " establish GPRS PPP company Connect " state, " establishing GPRS TCP/UDP connections " state, " login remote server " state, " detection GPRS PPP connection shapes State " state, " detection GPRS TCP/UDP connection status " state, " GPRS Modem hardware resets " state, " GPRS Modem Upper electricity again " state and " software systems warm reset " state are formed.
Further, described to begin a task with systematic parameter configuration state, user can be by configuring serial ports to system Send configuration instructs, and system carries out instructing parsing and parameter modification, storage after configuration-direct is received;User can also lead to Cross instruction and check newest system parameter values, after the configuration completion instruction that user sends is received, system enters normal start State, after software systems enter normal activation state, multi-tasks Software house dog is initialized first, then creates the letter of correlation Number amount, message mailbox and message queue, then create that Modem serial ports receives task, GPRS scheduler tasks, data parsing conversion are appointed Business, GPRS link establishments and holding task, system monitoring alarming assignment, device data acquisition storage upload task, finally start Task hangs up itself;Afterwards, operating system begins to carry out Modem serial ports reception task, GPRS scheduler tasks, data parsing Convert task, GPRS link establishments and holding task, system monitoring alarming assignment, the tune of device data acquisition storage upload task Degree.
Further, the GPRS scheduler tasks periodically inquire about Modem and receive in data-message queue whether have message, if Have, then take out the message and parsed, if message content is TCP/UDP data or short message, carries out corresponding data and carry The simultaneously corresponding flag bit of set is taken, if message content is AT repeat-back data, is delivered the data to by message mailbox GPRS link establishments and holding task are handled;GPRS scheduler tasks are also periodically inquired about Modem and sent in data-message queue Whether message is had, if so, then take out the message, and whether unimpeded, if unimpeded, carry out the wireless hair of data if detecting GPRS links Send, otherwise, add up sending times and the wait that is delayed, repeating transmission.If sending times more than 3 times, abandon the wireless transmission of the data; In addition, GPRS scheduler tasks, which periodically inquire about short message, sends flag bit, if the flag bit is true, the transmission of short message is carried out.
Further, the inquiry of the data parsing convert task and implementation procedure are as follows:
If a, there are new TCP/UDP data, parsed accordingly, if the TCP/UDP data are grasped for Server remote Order, then build corresponding acknowledgement frame according to predefined stipulations, and the acknowledgement frame is added into Modem and sends data-message team Row, GPRS scheduler tasks are waited to be transmitted wirelessly;If the TCP/UDP data are server acknowledgement frame, set is marked accordingly Will position;
If b, there is new remote operation short message, parsed, and response short message is built simultaneously according to predefined stipulations Set short message sends flag bit, and wait GPRS scheduler tasks are inquired about and the wireless transmission of short message;
C, when network connection is normal, logon data bag, heartbeat data packets, equipment real time data bag, ALM are carried out Packet, equipment alarm packet etc. send the detection of flag bit, if it is true that certain packet, which sends flag bit, according to predetermined Adopted stipulations build the packet, and are sent to message queue to be sent, wait GPRS scheduler tasks to be transmitted wirelessly.
Further, the system monitoring alarming assignment is additionally included in when detecting new equipment real time data, to it Carry out abnormality detection, it is similar with the processing of system exception, when detecting equipment real time data anomalous event set accuse accordingly Alert flag bit, and set sends the flag bit of unit exception alarm packet, is inquired about so that data parse convert task, structure Build and transmission equipment alarm packet to GPRS scheduler tasks are transmitted wirelessly.
Compared with the prior art, the invention has the advantages that:The advantage of this multitask application programming is:
Compared with the single task software system design for not using operating system, it on the one hand need not carry out function scheduling and set Meter, so as to reduce the complexity of software system design, reduces design deviation to greatest extent;On the other hand, as a result of more Business design, when the software systems of GPRS monitor terminals meet with outside strong jamming, some task for only resulting in software systems is different Often, without triggering all task abnormities, so as to enhance the reliability of software systems.
Multitask design can easily carry out expanding of system function and system upgrade, if necessary on original function basis Upper increase One function, it is only necessary to be individually for the Functional Design and realize a task, without carrying out big to existing software systems Change.
The efficiency and real-time of system can also be improved using the multitask design based on embedded OS.
Brief description of the drawings
Fig. 1 is a kind of hardware system structure of high reliability GPRS monitor terminals of the present invention.
Fig. 2 is the GPRS power management module circuits of the present invention.
The multitask interaction schematic diagram of the multitask application program of Fig. 3 present invention.
Fig. 4 is GPRS link establishments and the hold mode machine flow chart of the present invention.
Fig. 5 is the GPRS Modem initialization program flow charts of the present invention.
Fig. 6 is that multi-tasks Software house dog of the present invention feeds dog flow chart.
Fig. 7 is the shell structure of the present invention.
Wherein, reference is:1 is upper shell, and 2 be lower house, and 3 be connector installation site, and 4 be upper shell groove (Sealing strip installation site).
Embodiment
A kind of high reliability GPRS monitor terminals of the present invention are described further below in conjunction with accompanying drawing.
As shown in figure 1, a kind of high reliability GPRS monitor terminals that this example is related to, its hardware circuit includes insertion and declined Controller, GPRS wireless communication modules, power module, GPRS power management modules, memory module, input/output module, hardware House dog and indicator lamp;Wherein, GPRS wireless communication modules are connected by serial ports with embedded microcontroller, GPRS power supply pipes Reason module is connected by universal I/O port with embedded microcontroller, and power module is electric with embedded microcontroller, GPRS respectively Source control module is connected, embedded microcontroller also with memory module, input/output module, hardware watchdog and indicator lamp phase Connection, embedded microcontroller is by controlling GPRS power management modules to open or stop the confession to GPRS wireless communication modules Electricity.
As shown in Fig. 2 the input of GPRS power management module circuits is GPRS_PWR_DOWNn, with embedded microcontroller The universal I/O port of device is connected, and output end VCC_GPRS, is connected with the power input of GPRS wireless communication modules.It is embedded The controller that declines controls the output level of the universal I/O port of embedded microcontroller according to the control instruction of software systems, and then controls The level of the input of GPRS power management modules circuit processed.When GPRS power management modules circuit input end is low level, GPRS power management module circuit output end VCC_GPRS voltages are zero, i.e., now cut off the power supply to GPRS wireless communication modules Supply;When GPRS power management modules circuit input end is high level, GPRS power management module circuit output ends VCC_ GPRS voltages are 3.8V, i.e., the power supply for now providing GPRS wireless communication modules 3.8V is supplied.It is real by above-mentioned controlling mechanism The upper electric operation again of software instruction control GPRS wireless communication modules is showed, so as to ensure that GPRS monitor terminals can after suspension Normal operating conditions is returned to, is reliably connected to network.
As shown in figure 3, on GPRS monitor terminals after electricity, software systems automatic start simultaneously enters Main functions, in Main letters In number, the peripheral hardwares such as serial ports, indicator lamp, memory module are initialized first, then control GPRS power management modules wireless to GPRS It is electric in communication module, embedded OS is then initialized, and create and begin a task with, finally start multi-task scheduling.
In beginning a task with, start GPRS wireless communication modules first, then detect embedded microcontroller and string is locally configured Whether mouth receives the instruction into configuration status, if being not detected by the instruction in setting time, is normally opened into system Dynamic state, otherwise into systematic parameter configuration state.Under systematic parameter configuration state, user can be by configuring serial ports to being Send configuration of uniting instruction, system carry out instructing parsing and parameter modification, storage after configuration-direct is received.User can also Newest system parameter values are checked by instruction.After the configuration completion instruction that user sends is received, system, which enters, normally to be opened Dynamic state.After software systems enter normal activation state, multi-tasks Software house dog is initialized first, then creates correlation Semaphore, message mailbox and message queue, then create Modem serial ports and receive task, GPRS scheduler tasks, data parsing conversion Task, GPRS link establishments and holding task, system monitoring alarming assignment, device data acquisition storage upload task, are finally opened Beginning task hangs up itself.Afterwards, operating system begins to carry out Modem serial ports reception task, GPRS scheduler tasks, data solution Analyse convert task, GPRS link establishments and keep task, system monitoring alarming assignment, device data acquisition to store upload task Scheduling.
Modem serial ports, which receives task, to be mainly responsible for periodically inquiring about the embedded micro-control being connected with GPRS wireless communication modules Whether data that GPRS wireless communication module send are had in the serial ports buffering area of device processed, if so, then taking out and being sent into Modem receptions Data-message queue.
GPRS scheduler tasks complete the reception of GPRS wireless communication modules data, short message, and GPRS data, short message Transmission.GPRS scheduler tasks periodically inquire about Modem and receive in data-message queue whether have message, disappear if so, then taking out this Cease and parsed, if message content is TCP/UDP data or short message, carries out corresponding data extraction and set is corresponding Flag bit, if message content is AT repeat-back data, by message mailbox deliver the data to GPRS link establishments and Holding task is handled.GPRS scheduler tasks also periodically inquire about Modem and send in data-message queue whether have message, if Have, then take out the message, and detect whether GPRS links are unimpeded, if unimpeded, the wireless transmission of progress data is otherwise, accumulative Sending times and the wait that is delayed, repeating transmission.If sending times more than 3 times, abandon the wireless transmission of the data.In addition, GPRS is adjusted Degree task periodically inquires about short message and sends flag bit, if the flag bit is true, carries out the transmission of short message.
Data parsing convert task periodically carries out the inquiry of following flag bit successively, and performs corresponding action:
(1)If there are new TCP/UDP data, parsed accordingly.If the TCP/UDP data are grasped for Server remote Order(Such as remote inquiry, setting command), then corresponding acknowledgement frame is built according to predefined stipulations, and the acknowledgement frame is added Enter Modem and send data-message queue, wait GPRS scheduler tasks to be transmitted wirelessly;If the TCP/UDP data are server Acknowledgement frame(Such as log in acknowledgement frame, heartbeat packet acknowledgement frame), then the corresponding flag bit of set.
(2)If there is new remote operation short message, parsed, and response short message is built simultaneously according to predefined stipulations Set short message sends flag bit, and wait GPRS scheduler tasks are inquired about and the wireless transmission of short message.
(3)When network connection is normal, logon data bag, heartbeat data packets, equipment real time data bag, ALM are carried out Packet, equipment alarm packet etc. send the detection of flag bit, if it is true that certain packet, which sends flag bit, according to predetermined Adopted stipulations build the packet, and are sent to message queue to be sent, wait GPRS scheduler tasks to be transmitted wirelessly.
System monitoring alarming assignment completes the exception monitoring to system mode and the equipment real time data collected, by fixed When detecting system running status, so as to finding system exception in time, and set alerts accordingly when detecting anomalous event Flag bit, and set sends the flag bit of system exception alarm packet, is inquired about, built so that data parse convert task And transmission system alarm packet to GPRS scheduler tasks are transmitted wirelessly.In addition, system monitoring alarming assignment is detecting When having new equipment real time data, abnormality detection is carried out to it, it is similar with the processing of system exception, detecting that equipment counts in real time Flag bit is alerted accordingly according to set during anomalous event, and set sends the flag bit of unit exception alarm packet, to count Inquired about, built according to parsing convert task and transmission equipment alarm packet to GPRS scheduler tasks are transmitted wirelessly.
Device data acquisition stores upload task:Device data acquisition storage upload task is periodically completed to the real-time number of equipment According to collection, storage and upload.
GPRS link establishments and holding task:GPRS link establishments and keep task complete GPRS communication links foundation and Maintain, the task employ state machine realization, the state machine by " GPRS Modem initialization " state, " establish GPRS PPP company Connect " state, " establishing GPRS TCP/UDP connections " state, " login remote server " state, " detection GPRS PPP connection shapes State " state, " detection GPRS TCP/UDP connection status " state, " GPRS Modem hardware resets " state, " GPRS Modem Upper electricity again " state and " software systems warm reset " state are formed.
As shown in figure 4, the State Transferring mechanism of the state machine of the GPRS link establishments and holding task is as follows:
A, into " GPRS Modem initialization " state, GPRS Modem initialization is carried out in this case, is being initialized Each Modem AT command operatings when, employ " deterministic Modem AT command operatings mechanism ";If at the beginning of Modem Beginning chemical conversion work(then enters " establishing GPRS PPP connections " state, if initialization failure, enters " GPRS Modem hardware resets " State;
B, under " establishing GPRS PPP connections " state, trial is instructed to establish PPP companies by sending AT to GPRS Modem Connect, if establishing successful connection, enter " establishing GPRS TCP/UDP connections " state, if PPP connections are established in continuous 3 trials Failure, then enter " GPRS Modem hardware resets " state;
C, under " establishing GPRS TCP/UDP connections " state, attempt and specify according to the configuration selection of systematic parameter Service-Port establishes TCP connections or UDP connections, if establishing successful connection, enters " login remote server " state, if even Continue 3 trials and establish TCP/UDP connection failures, then enter " GPRS Modem hardware resets " state;
D, under " login remote server " state, the long-range of server is carried out using " reliable to log in GPRS network mechanism " Register;Set sends the flag bit of logon data bag to server, waits pending data parsing convert task detect simultaneously structure Build, transmit logon data bag to GPRS scheduler tasks and transmitted wirelessly, and the logon data bag feedback of waiting for server, if The logon data bag feedback of server is received in the stand-by period specified, then illustrates the success of login service device, into " detection GPRS PPP connection status " state, otherwise illustrate that login service device fails, if continuous 3 login service devices fail, enter " GPRS Modem hardware resets " state;
E, under " detection GPRS PPP connection status " state, realize " terminal real-time online testing mechanism ".By fixed Phase sends the state of AT command detection GPRS PPP connections to GPRS Modem, if GPRS PPP connections are normal, enters " detection GPRS TCP/UDP connection status " state, if detecting for continuous 3 times, GPRS PPP connections disconnect, and enter and " establish GPRS PPP Connection " state, re-establishes GPRS PPP connections;Periodic detection GPRS PPP connection status why is needed, is due to GPRS The network condition of network in itself can cause GPRS wireless monitor nodes to go offline, in order to ensure GPRS wireless monitors node and service The proper communication of device, GPRS wireless monitor nodes have to know when to go offline from GPRS network, so as to re-establish PPP in time Connection and TCP/UDP connections.
F, under " detection GPRS TCP/UDP connection status " state, TCP/UDP links are realized using " heartbeat mechanism " Connection status detects.By periodically sending heartbeat data packets to server to detect the state of GPRS TCP/UDP connections, if GPRS TCP/UDP connections are normal, then enter " detection GPRS PPP connection status " state, if continuous 3 times detect GPRS TCP/UDP connections disconnect, then enter " establishing GPRS TCP/UDP connections " state, re-establish GPRS TCP/UDP connections.Its In, it is similar with sending logon data bag to the implementation of server transmission heartbeat data packets, sent by set to server The flag bit of heartbeat data packets, wait pending data parsing convert task to be detected and built, transmit heartbeat data packets to GPRS tune Degree task is transmitted wirelessly, and the heartbeat data packets feedback of waiting for server, if receiving clothes within the specified stand-by period The heartbeat data packets feedback of business device, then illustrate that TCP/UDP connections are normal, otherwise it is assumed that TCP/UDP connections disconnect.
G, under " GPRS Modem hardware resets " state, the action of GPRS Modem hardware resets, and accumulative GPRS are performed The number of Modem hardware resets, if the number of GPRS Modem hardware resets more than 3 times, enter " GPRS Modem again on Electricity " state, otherwise enters " GPRS Modem initialization " state;
H, under " GPRS Modem again upper electricity " state, GPRS Modem shutdown, power-off, upper electricity, start behaviour are performed successively Make, and add up GPRS Modem upper electric numbers again, if above the number of electricity more than 3 times, enters " software system to GPRS Modem again System warm reset " state, otherwise enters " GPRS Modem initialization " state;
I, under " software systems warm reset " state, software systems warm reset action is performed, restarts software systems, Jin Er After establishing GPRS link establishments and holding task, into " GPRS Modem initialization " state.
The Modem AT command operating mechanism is the response time instructed for GPRS wireless communication modules to different AT It is inconsistent, using timeout mechanism, i.e., the different stand-by period is set according to each AT orders different response time, if specify Interior acquisition return value then terminates to wait, overtime then terminate to wait automatically, the reliability of guarantee Modem AT command operatings.
The reliable GPRS network mechanism that logs in is logged in using timeout mechanism, i.e., when monitor node logs in, if waiting Log in feedback time-out, then it is assumed that login failure, after multiple login failure, then reset GPRS wireless communication modules again.
The heartbeat mechanism is that the timing of GPRS monitor terminals sends heartbeat packet to background server, if not received in the keep-alive time Fed back to heartbeat packet, then it is assumed that link has disconnected, and disconnects existing connection automatically and re-establishes link;Exist always although GPRS has The characteristics of line, but when GPRS online no data transmission for a long time, data service rank can be lowered automatically, using heartbeat machine I.e. when system is transmitted without valid data for a long time, monitor node is sent system according to certain time interval to server One frame invalid data, so as to keep data transmission service to be in higher priority level, maintain GPRS data link.
The terminal real-time online testing mechanism is by being periodically detected GPRS PPP connection status, can detect in time Whether node goes offline from GPRS network, is performed if going offline and attempts the operation of dial-up connection again, so as to ensure that monitor node is real-time Online;Gone offline because the unstability of GPRS network in itself may result in GPRS wireless monitor nodes, in order to ensure monitoring section The proper communication of point and server, monitor node have to know when to go offline from GPRS network, and then re-establish PPP connections And TCP/UDP connections.
" the GPRS Modem hardware resets ", " GPRS Modem are again upper electric ", " software systems warm reset " three kinds of shapes State constitutes GPRS link establishments and keeps triple Restart mechanisms of task;Ensure that monitor node can recover after going offline with after The connection of platform server, so as to realize the reliable networking of GPRS wireless monitor nodes.
As shown in figure 5, GPRS Modem initialization flow is as follows:
(1)AT instruction testings are carried out to GPRS Modem first, Modem AT instruction echo work(is closed if being successfully tested Can, then carry out SIM card test;Terminate GPRS Modem initialization if continuous 3 test crash, and return to initialization failure Information.
(2)GPRS signal quality testings are carried out if SIM card is successfully tested;If continuous 3 SIM card test crash, are tied Beam GPRS Modem are initialized, and return to initialization failure information.
(3)If GPRS signal qualitys well if carry out GPRS Modem network registries;If GPRS signals are unavailable, terminate GPRS Modem are initialized, and return to initialization failure information.
(4)If the success of GPRS Modem network registries, carries out short message(SMS)Relevant parameter initializes;If continuous 3 times GPRS Modem network registries fail, then terminate GPRS Modem initialization, and return to initialization failure information.
(5)If short message(SMS)Relevant parameter initializes successfully, then reads GPRS Modem information, terminates GPRS Modem is initialized, and returns to initialization successful information;If short message(SMS)Relevant parameter initialization failure, then terminate GPRS Modem is initialized, and returns to initialization failure information.
The number of various tests or operation in above initialization procedure is not limited to 3 times, can be according to the applied field of reality Conjunction is adjusted.
As shown in fig. 6, the multitask application program realizes multi-tasks Software house dog, the multi-tasks Software house dog Fed dog subprogram by the software watchdog subprogram of each task, and multi-tasks Software house dog and formed;Each task is soft Part watchdog program is mainly responsible for the initialization of the task software watchdog, and updates the task software in major cycle and guard the gate The counter of dog;Multi-tasks Software house dog feeds the software that dog subprogram then checks each task in each system clock cycle Whether house dog has timed out, as long as the software watchdog time-out of some task, just answering by the complete paired systems of hardware watchdog Position.
Wherein, the software watchdog subprogram of each task mainly includes the assignment and counter of the initial value of timer Renewal, specifically:It is required for initializing the software watchdog of the task in each task section start, including by software watchdog The initial value of timer is entered as the timeout value of the task, and opens the software watchdog of the task.In addition, in each task The counter of the task software watchdog will be updated in major cycle.
Multi-tasks Software house dog feeds dog subprogram and is located at system clock beat Hook Function, in each system clock cycle It is interior to be called once.Multi-tasks Software house dog feeds dog subroutine flow and is described as follows:
After feeding dog subprogram into multi-tasks Software house dog, " stopping feeding hardware watchdog flag bit " is first checked for whether It is true, if true, then directly terminate multi-tasks Software house dog and feed dog subprogram;If it is not true, successively to each The software watchdog state of business is checked that step is as follows:Check whether the task software watchdog counter has updated, if Renewal, then the value for resetting the task software watchdog timer is the timeout value of the task, and continues next task Software watchdog status checkout;If not updating, the value of the task software watchdog timer is subtracted 1 first, then judging should Whether the value of task software watchdog timer is zero, is zero and illustrates that the task software watchdog timer has timed out, set " stopping feeding hardware watchdog flag bit " is true, directly terminates multi-tasks Software house dog and feeds dog subprogram, is not zero, continues Carry out the software watchdog status checkout of next task.It is sequentially completed according to above-mentioned steps to each task software watchdog Status checkout, the step of feeding hardware watchdog is then performed, finally terminate multi-tasks Software house dog and feed dog subprogram.
As shown in fig. 7, housing using it is interior it is it is outer under shell structure, material is aluminium alloy;Using close between upper-lower casing Strip of paper used for sealing is sealed, and sealing strip is silastic material, is installed in the groove in upper shell;Upper-lower casing is connected using screw thread Connect and compress the sealing strip between upper-lower casing, reach the effect of sealing;Connector selects PG7 Waterproof connector of cable, installation position Put and be arranged in housing both sides;Hardware circuit board, which is connected through a screw thread, to be fixed in lower house.
The description of understanding for embodiment is only to understand the present invention for help, rather than for limiting this hair Bright.Those skilled in the art can carry out some changes and change using the thought of the present invention, as long as its technological means does not have There are the thought and main points for departing from the present invention, still within protection scope of the present invention.

Claims (4)

  1. A kind of 1. implementation method of the multitask application program based on GPRS monitor terminals, it is characterised in that:The multitask should Realize that multitask includes based on multitask design mode with program:Begin a task with, Modem serial ports receives task, GPRS scheduling is appointed Business, data parsing convert task, GPRS link establishments and holding task, system monitoring alarming assignment, device data acquisition storage Upload task;
    Begin a task with:Start GPRS wireless communication modules first, then detect serial ports is locally configured whether in embedded microcontroller The instruction into configuration status is received, if being not detected by the instruction in setting time, into system normal activation state, Otherwise systematic parameter configuration state is entered;
    Modem serial ports receives task:Modem serial ports, which receives task, to be mainly responsible for periodically inquiring about being connected with GPRS wireless communication modules Whether data that GPRS wireless communication module send are had in the serial ports buffering area of the embedded microcontroller connect, if so, then taking out And it is sent into Modem and receives data-message queue;
    GPRS scheduler tasks:GPRS scheduler tasks complete the reception of GPRS wireless communication modules data, short message, and GPRS numbers According to the transmission of, short message;
    Data parse convert task:Data parsing convert task is periodically inquired about following flag bit and handled accordingly successively: Data accepted flag position is inquired about, if the flag bit is true, the data received are parsed;Inquire about data and send mark Position, if the flag bit is true, structure sends packet and passes to GPRS scheduler tasks and transmitted wirelessly;
    System monitoring alarming assignment:System monitoring alarming assignment is completed to the different of system mode and the equipment real time data collected Often monitoring, by the running status of periodic detection system, so as to find system exception in time, and put when detecting anomalous event The corresponding alarm flag bit in position, and set sends the flag bit of system exception alarm packet, so that data parse convert task Inquired about, built and transmission system alarm packet to GPRS scheduler tasks are transmitted wirelessly;
    Device data acquisition stores upload task:Device data acquisition storage upload task is periodically completed to equipment real time data Collection, storage, and set equipment real time data uploads flag bit, so that data parsing convert task is inquired about, built and passed Delivery apparatus real time data bag to GPRS scheduler tasks are transmitted wirelessly;
    GPRS link establishments and holding task:GPRS link establishments and foundation and the dimension for keeping task completion GPRS communication links Hold, the task employ state machine realization, the state machine by " GPRS Modem initialization " state, " establish GPRS PPP company Connect " state, " establishing GPRS TCP/UDP connections " state, " login remote server " state, " detection GPRS PPP connection shapes State " state, " detection GPRS TCP/UDP connection status " state, " GPRS Modem hardware resets " state, " GPRS Modem Upper electricity again " state and " software systems warm reset " state are formed;
    Described to begin a task with systematic parameter configuration state, user can be instructed by configuring serial ports to system send configuration, System carries out instructing parsing and parameter modification, storage after configuration-direct is received;User can also be checked newest by instruction System parameter values, after receiving the configuration that user sends and completing instruction, system enters normal activation state, in software systems Into after normal activation state, first initialize multi-tasks Software house dog, then create correlation semaphore, message mailbox and Message queue, then create Modem serial ports and receive task, GPRS scheduler tasks, data parsing convert task, GPRS link establishments And task, system monitoring alarming assignment, device data acquisition storage upload task are kept, finally begin a task with and hang up itself; Afterwards, operating system begins to carry out Modem serial ports reception task, GPRS scheduler tasks, data parsing convert task, GPRS chains Establish and keep the scheduling of task, system monitoring alarming assignment, device data acquisition storage upload task in road.
  2. 2. a kind of implementation method of multitask application program based on GPRS monitor terminals according to claim 1, it is special Sign is:The GPRS scheduler tasks periodically inquire about Modem and receive in data-message queue whether have message, if so, then taking out The message is simultaneously parsed, if message content is TCP/UDP data or short message, carries out corresponding data extraction and set phase The flag bit answered, if message content is AT repeat-back data, GPRS links are delivered the data to by message mailbox and built Vertical and holding task is handled;
    GPRS scheduler tasks also periodically inquire about Modem and send in data-message queue whether have message, disappear if so, then taking out this Breath, and detect whether GPRS links are unimpeded, if unimpeded, the wireless transmission of progress data, otherwise, accumulative sending times are simultaneously delayed Wait, retransmit;If sending times more than 3 times, abandon the wireless transmission of the data;In addition, GPRS scheduler tasks are periodically inquired about Short message sends flag bit, if the flag bit is true, carries out the transmission of short message.
  3. 3. a kind of implementation method of multitask application program based on GPRS monitor terminals according to claim 1, it is special Sign is:The inquiry of the data parsing convert task and implementation procedure are as follows:
    If a, there are new TCP/UDP data, parsed accordingly, if the TCP/UDP data are ordered for remote operation of server Order, then corresponding acknowledgement frame is built according to predefined stipulations, and the acknowledgement frame is added into Modem and sends data-message queue, etc. Treat that GPRS scheduler tasks are transmitted wirelessly;If the TCP/UDP data are server acknowledgement frame, the corresponding flag bit of set;
    If b, there is new remote operation short message, parsed, and response short message and set are built according to predefined stipulations Short message sends flag bit, and wait GPRS scheduler tasks are inquired about and the wireless transmission of short message;
    C, when network connection is normal, logon data bag, heartbeat data packets, equipment real time data bag, ALM data are carried out Bag, equipment alarm packet send the detection of flag bit, if it is true that certain packet, which sends flag bit, according to predefined stipulations The packet is built, and is sent to message queue to be sent, waits GPRS scheduler tasks to be transmitted wirelessly.
  4. 4. a kind of implementation method of multitask application program based on GPRS monitor terminals according to claim 1, it is special Sign is:The system monitoring alarming assignment is additionally included in when detecting new equipment real time data, and abnormal inspection is carried out to it Survey, it is similar with the processing of system exception, when detecting equipment real time data anomalous event set alert flag bit accordingly, and Set sends the flag bit of unit exception alarm packet, so that data parsing convert task is inquired about, built and transmitted and sets Standby alarm packet to GPRS scheduler tasks are transmitted wirelessly.
CN201410439874.7A 2014-09-01 2014-09-01 A kind of implementation method of the multitask application program based on GPRS monitor terminals Active CN104202394B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410439874.7A CN104202394B (en) 2014-09-01 2014-09-01 A kind of implementation method of the multitask application program based on GPRS monitor terminals

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410439874.7A CN104202394B (en) 2014-09-01 2014-09-01 A kind of implementation method of the multitask application program based on GPRS monitor terminals

Publications (2)

Publication Number Publication Date
CN104202394A CN104202394A (en) 2014-12-10
CN104202394B true CN104202394B (en) 2017-11-10

Family

ID=52087619

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410439874.7A Active CN104202394B (en) 2014-09-01 2014-09-01 A kind of implementation method of the multitask application program based on GPRS monitor terminals

Country Status (1)

Country Link
CN (1) CN104202394B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104536934A (en) * 2014-12-24 2015-04-22 深圳市航盛电子股份有限公司 Serial port communication method and system
CN110069323B (en) * 2018-01-24 2024-04-05 可赛尔内存股份有限公司 High-speed reaction game device and task allocation method thereof
CN114490765B (en) * 2022-01-25 2022-11-29 中国人民解放军32039部队 Fault monitoring method and device and electronic equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"基于GPRS的嵌入式远程抄表监控系统的研究";王磊;《中国优秀硕士学位论文全文数据库工程科技II辑》;20090531;正文第46-52页,图5.1,图5.2 *
"基于嵌入式系统的GPRS数据终端的设计与实现";蔡田芳;《中国优秀硕士学位论文全文数据库信息科技辑》;20060930;全文 *

Also Published As

Publication number Publication date
CN104202394A (en) 2014-12-10

Similar Documents

Publication Publication Date Title
CN104200628B (en) A kind of industrial GPRS monitor terminals
CN104200629B (en) A kind of software systems based on GPRS monitor terminals
CN104202395B (en) A kind of GPRS link establishments and the state machine implementation method for keeping task
CN104199746A (en) Multitask software watchdog acquiring method
US10429092B2 (en) Asynchronous reporting system
US6665384B2 (en) Methods and apparatus for appliance communication interface
CN103942080B (en) Electronic device information transmission method
US11063855B2 (en) Monitoring of the data transmission in a client/server-based device access system
CN104202394B (en) A kind of implementation method of the multitask application program based on GPRS monitor terminals
US20160178125A1 (en) Diagnostics and enhanced functionality for single-wire safety communication
CN110427220B (en) Configuration method and device of device command, electronic device and storage medium
US20150019025A1 (en) Wireless Node Auto-Reset Function
CN111767167B (en) Gateway data migration method, system, server and storage medium
CN106033641A (en) A multifunctional intelligent control system achieved by a power line carrier and a controlling method thereof
JP2005117371A (en) Apparatus and system for remote monitoring
CN105306289A (en) Method and device for improving reliability of multi-module devices, and client terminal device
CN101764698B (en) Automatic recovering method for power equipment
CN110545211B (en) Interrupt-free message capture in industrial control systems
CN105959351A (en) Data transmission method, data transmission device, and communication management device
CN112596940A (en) Multi-stage fault tolerance method, device and storage medium
JP6945416B2 (en) Power controller, control method, control program, and control system
KR200401936Y1 (en) Re-booting apparatus of home network system
CN113028584B (en) Abnormity processing method and device for air conditioner singlechip
CN102891725B (en) Method and system for controlling transmitters, and transmitter control box
KR20130063132A (en) Plc auto communication interface method and apparatus

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
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20171221

Address after: 610000 West Core Avenue, Chengdu hi tech Zone (West District), Sichuan Province, No. 18

Patentee after: Dongfang Electric Chengdu Intelligent Technology Co., Ltd.

Address before: Jinniu District Chengdu City, Sichuan province 610036 Shu Road No. 333

Patentee before: Dongfang Electric Corporation

CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 610218 No.18, Xixin Avenue, hi tech Zone (West Zone), Chengdu, Sichuan Province

Patentee after: Dongfang Electric Group Research Institute of science and Technology Co., Ltd

Address before: 610000 No. 18 West core road, hi tech Zone, Chengdu, Sichuan

Patentee before: Dongfang Electric Chengdu Intelligent Technology Co., Ltd.