CN109507914A - A kind of peripheral hardware control method and device - Google Patents
A kind of peripheral hardware control method and device Download PDFInfo
- Publication number
- CN109507914A CN109507914A CN201811375185.9A CN201811375185A CN109507914A CN 109507914 A CN109507914 A CN 109507914A CN 201811375185 A CN201811375185 A CN 201811375185A CN 109507914 A CN109507914 A CN 109507914A
- Authority
- CN
- China
- Prior art keywords
- timer
- control
- instruction
- module
- variable
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B19/00—Programme-control systems
- G05B19/02—Programme-control systems electric
- G05B19/04—Programme control other than numerical control, i.e. in sequence controllers or logic controllers
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Automation & Control Theory (AREA)
- Programmable Controllers (AREA)
Abstract
The present invention relates to a kind of peripheral hardware control method and device, belong to embedded-type control field;The peripheral controller is for realizing the peripheral hardware control method.Wherein, the peripheral hardware control method, comprising the following steps: A, the control instruction that user's input is received by host computer, and it is sent to the timer for interacting with slave computer;B, received control instruction is scanned using timer, and is interacted according to the sequence that user's input control instructs with slave computer;The present invention overcomes prior art problems, it proposes improved peripheral hardware control method and device, collects control instruction by unified, control instruction is issued according to current control variable in timer, solves the problems, such as sporadic hardware controls failure, to improve the quality of product.
Description
Technical field
The present invention relates to a kind of peripheral hardware control method and device, belong to embedded-type control field.
Background technique
In multi-thread software, while there is resource contention in while controlling the same peripheral hardware, for example two threads are same
When the blood pump in hemo system is controlled, thread one needs to start blood pump, and thread two needs to stop blood pump, if by multi-thread
Journey directly issues control instruction to blood pump, then it is possible that following result:
Slave computer receives instruction sequences: thread one, thread two;As a result: blood pump stops;
Slave computer receives instruction sequences: thread two, thread one;As a result: blood pump starting;
Causing the above results, mainly there are two reasons:
1) stationary problem of thread;
2) latency issue in order transmission process;
Therefore thread directly issues control instruction to slave computer and may ask because of thread synchronization and order transmission delay
The control result inscribed and cause peripheral hardware final is different from expected results.
Summary of the invention
The present invention provides a kind of peripheral hardware control method and device, scans received control instruction using timer, according to
The sequence of family input control instruction realizes the control to peripheral hardware, caused by solving because of thread synchronization and/or order transmission delay
The uncontrollable problem of control result.
Technical solution of the present invention first aspect is a kind of peripheral hardware control method, be the described method comprises the following steps:
A, the control instruction of user's input is received by host computer, and is sent to the timer for interacting with slave computer;
B, scan received control instruction using timer, and according to the sequence of user's input control instruction and slave computer into
Row interaction.
Further, the step A includes: creation timer, interacts it with upper computer and lower computer and communicates, described
The sequence that timer is instructed by time-stamp Recognition user's input control of control instruction.
Further, the step A includes: creation control variable, is carried out using preset value corresponding with control instruction to it
Assignment.
Further, the control variable includes: global variable, includes the start and stop for indicating peripheral hardware and starting or stoping for transmitting
Mark;Structural body variable, for transmitting the control parameter including slave computer.
Further, the step B includes: to scan global variable using timer, fixed if start and stop are identified as stopping mark
When device to slave computer transmission cease and desist order;If start and stop be identified as starting mark, using timer Scan Architecture body variable and to
Slave computer sends start command and control parameter.
Technical solution of the present invention second aspect is a kind of peripheral controller, comprising: instruction acquisition module, for passing through
Host computer receives the control instruction of user's input, and is sent to the timer for interacting with slave computer;Instruction issuing module is used
In scanning received control instruction using timer, and interacted according to the sequence that user's input control instructs with slave computer.
Further, described instruction collection module further include: timer module makes itself and host computer for creating timer
Communication is interacted with slave computer, the timer instructs suitable by time-stamp Recognition user's input control of control instruction
Sequence.
Further, described instruction collection module includes: variable module, for creating control variable, use and control instruction
Corresponding preset value carries out assignment to it;
Further, the variable module includes: global variable module, is transmitted for creating global variable outer including indicating
If the start and stop mark started or stoped;Structural body variable module, for creating structural body variable to transmit the control including slave computer
Parameter processed.
Further, it includes: stopping modular that described instruction, which assigns module, for scanning global variable module using timer,
The value for reading start and stop mark therein, timer is ceased and desisted order to slave computer transmission if start and stop are identified as stopping mark;Control
Module reads the value of start and stop mark therein, if start and stop are identified as starting mark for scanning global variable module using timer
Know, then sends start command and control parameter using timer Scan Architecture body variable module and to slave computer.
The technical solution of the present invention third aspect is a kind of computer readable storage medium, is stored thereon with computer and refers to
The step of enabling, the method such as above-mentioned first aspect realized when which is executed by processor.
The invention has the benefit that
Prior art problem is overcome, proposes improved peripheral hardware control method and device, collects control instruction by unified,
Control instruction is issued according to current control variable in timer, solves the problems, such as sporadic hardware controls failure, from
And improve the quality of product.
Detailed description of the invention
Fig. 1 show method flow diagram according to an embodiment of the present invention;
Fig. 2 is shown according to an embodiment of the present, the submethod process that timer and host computer interact
Figure;
Fig. 3 is shown according to an embodiment of the present, the submethod process that timer and slave computer interact
Figure;
Fig. 4 show apparatus module schematic diagram according to an embodiment of the present invention.
Specific embodiment
It is carried out below with reference to technical effect of the embodiment and attached drawing to design of the invention, specific structure and generation clear
Chu, complete description, to be completely understood by the purpose of the present invention, scheme and effect.
It should be noted that unless otherwise specified, in the disclosure used in the "an" of singular, " described " and
"the" is also intended to including most forms, unless the context clearly indicates other meaning.In addition, unless otherwise defined, this paper institute
All technical and scientific terms used are identical as the normally understood meaning of those skilled in the art.This paper specification
Used in term be intended merely to description specific embodiment, be not intended to be limiting of the invention.Term as used herein
"and/or" includes the arbitrary combination of one or more relevant listed items.Provided in this article any and all examples
Or the use of exemplary language (" such as ", " such as ") is intended merely to that the embodiment of the present invention is better described, and unless in addition
It is limited it is required that otherwise will not apply to the scope of the present invention.
With reference to Fig. 1, a kind of peripheral hardware control method is disclosed, the described method comprises the following steps:
A, the control instruction of user's input is received by host computer, and is sent to the timer for interacting with slave computer;
B, scan received control instruction using timer, and according to the sequence of user's input control instruction and slave computer into
Row interaction.
Referring to Fig. 2, in one embodiment, step A further includes following sub-step:
Timer is created, it is interacted with upper computer and lower computer and communicates, the timer passes through control instruction
The sequence of time-stamp Recognition user's input control instruction;
Creation control variable, carries out assignment to it using preset value corresponding with control instruction, which can customize,
It is mainly used for indicating corresponding control instruction;
Further, the control variable includes: global variable, includes the start and stop for indicating peripheral hardware and starting or stoping for transmitting
Mark;Structural body variable, for transmitting the control parameter including slave computer.
Referring to Fig. 3, in one embodiment, step B further include: scan global variable using timer, identify therein
The value of start and stop mark;Timer is ceased and desisted order to slave computer transmission if being to stop if the value of start and stop mark;If the value of start and stop mark
For starting, then start command and control parameter are sent using timer Scan Architecture body variable and to slave computer.
It is illustrated below by an implement scene:
1) collection of control is instructed in upper computer software operational process:
Create global variable, indicated using m (integer value) peripheral hardware stop, n come indicate peripheral hardware start, using a structure
Body is come the correlated condition that needs when recording peripheral hardware control.In software running process, stop if necessary to peripheral hardware, then the overall situation is become
Measure assignment m;If necessary to start peripheral hardware then assignment n, and to structural body assignment (such as rate, driving current, pressure and other parameters value);
2) hardware control instructions are sent according to current variable in timer:
A timer for being specifically used to interact with hardware is created, the global variable created in 1) is scanned in timer,
If scanning is to needing to stop, (coomand mode m), transmission are ceased and desisted order;If scanning is to starting is needed, (coomand mode is
N), then start command is sent, while sending relevant parameter in structural body.
With reference to Fig. 4, a kind of embodiment of the invention also discloses a kind of peripheral controller, comprising: instruction acquisition module,
For receiving the control instruction of user's input by host computer, and it is sent to the timer for interacting with slave computer;Under instruction
Up to module, for using timer to scan received control instruction, and according to the sequence and slave computer of the instruction of user's input control
It interacts.
Referring to Fig. 4, described instruction collection module further include:
Timer module interacts it with upper computer and lower computer and communicates for creating timer, the timer
The sequence instructed by time-stamp Recognition user's input control of control instruction;
Variable module carries out assignment to it using preset value corresponding with control instruction for creating control variable;It is described
Variable module includes: global variable module, for creating global variable to transmit the start and stop started or stoped including instruction peripheral hardware
Mark;Structural body variable module, for creating structural body variable to transmit the control parameter including slave computer.
Referring to Fig. 4, it includes: stopping modular that described instruction, which assigns module, for scanning global variable module using timer,
The value for reading start and stop mark therein, timer is ceased and desisted order to slave computer transmission if start and stop are identified as stopping mark;Control
Module reads the value of start and stop mark therein, if start and stop are identified as starting mark for scanning global variable module using timer
Know, then sends start command and control parameter using timer Scan Architecture body variable module and to slave computer.
It should be appreciated that the embodiment of the present invention can be by computer hardware, the combination of hardware and software or by depositing
The computer instruction in non-transitory computer-readable memory is stored up to be effected or carried out.Standard volume can be used in the method
Journey technology-includes that the non-transitory computer-readable storage media configured with computer program is realized in computer program,
In configured in this way storage medium computer is operated in a manner of specific and is predefined --- according in a particular embodiment
The method and attached drawing of description.Each program can with the programming language of level process or object-oriented come realize with department of computer science
System communication.However, if desired, the program can be realized with compilation or machine language.Under any circumstance, which can be volume
The language translated or explained.In addition, the program can be run on the specific integrated circuit of programming for this purpose.
In addition, the operation of process described herein can be performed in any suitable order, unless herein in addition instruction or
Otherwise significantly with contradicted by context.Process described herein (or modification and/or combination thereof) can be held being configured with
It executes, and is can be used as jointly on the one or more processors under the control of one or more computer systems of row instruction
The code (for example, executable instruction, one or more computer program or one or more application) of execution, by hardware or its group
It closes to realize.The computer program includes the multiple instruction that can be performed by one or more processors.
Further, the method can be realized in being operably coupled to suitable any kind of computing platform, wrap
Include but be not limited to PC, mini-computer, main frame, work station, network or distributed computing environment, individual or integrated
Computer platform or communicated with charged particle tool or other imaging devices etc..Each aspect of the present invention can be to deposit
The machine readable code on non-transitory storage medium or equipment is stored up to realize no matter be moveable or be integrated to calculating
Platform, such as hard disk, optical reading and/or write-in storage medium, RAM, ROM, so that it can be read by programmable calculator, when
Storage medium or equipment can be used for configuration and operation computer to execute process described herein when being read by computer.This
Outside, machine readable code, or part thereof can be transmitted by wired or wireless network.When such media include combining microprocessor
Or other data processors realize steps described above instruction or program when, invention as described herein including these and other not
The non-transitory computer-readable storage media of same type.When peripheral hardware control method according to the present invention and technology program
When, the invention also includes computers itself.
Computer program can be applied to input data to execute function as described herein, to convert input data with life
At storing to the output data of nonvolatile memory.Output information can also be applied to one or more output equipments as shown
Device.In the preferred embodiment of the invention, the data of conversion indicate physics and tangible object, including the object generated on display
Reason and the particular visual of physical objects are described.
The above, only presently preferred embodiments of the present invention, the invention is not limited to above embodiment, as long as
It reaches technical effect of the invention with identical means, all within the spirits and principles of the present invention, any modification for being made,
Equivalent replacement, improvement etc., should be included within the scope of the present invention.Its technical solution within the scope of the present invention
And/or embodiment can have a variety of different modifications and variations.
Claims (10)
1. a kind of peripheral hardware control method, which is characterized in that the described method comprises the following steps:
A, the control instruction of user's input is received by host computer, and is sent to the timer for interacting with slave computer;
B, received control instruction is scanned using timer, and is handed over according to the sequence that user's input control instructs with slave computer
Mutually.
2. peripheral hardware control method according to claim 1, which is characterized in that the step A further include:
Timer is created, it is interacted with upper computer and lower computer and communicates, the time that the timer passes through control instruction
The sequence of stamp identification user's input control instruction.
3. peripheral hardware control method according to claim 1, which is characterized in that the step A further include:
Creation control variable, carries out assignment to it using preset value corresponding with control instruction.
4. peripheral hardware control method according to claim 3, which is characterized in that the control variable includes:
Global variable includes the start and stop mark for indicating peripheral hardware and starting or stoping for transmitting;
Structural body variable, for transmitting the control parameter including slave computer.
5. peripheral hardware control method according to claim 4, which is characterized in that the step B includes:
Global variable is scanned using timer, timer is ceased and desisted order to slave computer transmission if start and stop are identified as stopping mark;
If start and stop are identified as starting mark, start command and control are sent using timer Scan Architecture body variable and to slave computer
Parameter processed.
6. a kind of peripheral controller characterized by comprising
Instruction acquisition module for receiving the control instruction of user's input by host computer, and is sent to for handing over slave computer
Mutual timer;
Instruction issuing module, for using timer to scan received control instruction, and according to the suitable of user's input control instruction
Sequence is interacted with slave computer.
7. peripheral controller according to claim 6, which is characterized in that described instruction collection module further include:
Timer module interacts it with upper computer and lower computer and communicates, the timer passes through for creating timer
The sequence of time-stamp Recognition user's input control instruction of control instruction.
8. peripheral controller according to claim 6, which is characterized in that described instruction collection module further include:
Variable module carries out assignment to it using preset value corresponding with control instruction for creating control variable.
9. peripheral controller according to claim 8, which is characterized in that the variable module further include:
Global variable module, for creating global variable to transmit the start and stop mark started or stoped including instruction peripheral hardware;
Structural body variable module, for creating structural body variable to transmit the control parameter including slave computer.
10. peripheral controller according to claim 9, which is characterized in that described instruction assigns module and includes:
Stopping modular reads the value of start and stop mark therein, if start and stop identify for scanning global variable module using timer
For stopping mark, then timer is ceased and desisted order to slave computer transmission;
Control module reads the value of start and stop mark therein, if start and stop identify for scanning global variable module using timer
For starting mark, then start command and control parameter are sent using timer Scan Architecture body variable module and to slave computer.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811375185.9A CN109507914A (en) | 2018-11-19 | 2018-11-19 | A kind of peripheral hardware control method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811375185.9A CN109507914A (en) | 2018-11-19 | 2018-11-19 | A kind of peripheral hardware control method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109507914A true CN109507914A (en) | 2019-03-22 |
Family
ID=65748999
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811375185.9A Pending CN109507914A (en) | 2018-11-19 | 2018-11-19 | A kind of peripheral hardware control method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109507914A (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1842755A (en) * | 2003-07-01 | 2006-10-04 | 飞思卡尔半导体公司 | Synchronization of data streams over a wireless network |
US8648620B2 (en) * | 2010-12-21 | 2014-02-11 | Hong Fu Jin Precision Industry (Shenzhen) Co., Ltd | Programmable logic controller employing single-chip |
CN106625674A (en) * | 2016-12-29 | 2017-05-10 | 北京光年无限科技有限公司 | Command processing method for robot and robot |
CN107220199A (en) * | 2017-05-25 | 2017-09-29 | 绵阳美菱软件技术有限公司 | The host computer of refrigerator, the slave computer of refrigerator, the communication means of refrigerator and system |
-
2018
- 2018-11-19 CN CN201811375185.9A patent/CN109507914A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1842755A (en) * | 2003-07-01 | 2006-10-04 | 飞思卡尔半导体公司 | Synchronization of data streams over a wireless network |
US8648620B2 (en) * | 2010-12-21 | 2014-02-11 | Hong Fu Jin Precision Industry (Shenzhen) Co., Ltd | Programmable logic controller employing single-chip |
CN106625674A (en) * | 2016-12-29 | 2017-05-10 | 北京光年无限科技有限公司 | Command processing method for robot and robot |
CN107220199A (en) * | 2017-05-25 | 2017-09-29 | 绵阳美菱软件技术有限公司 | The host computer of refrigerator, the slave computer of refrigerator, the communication means of refrigerator and system |
Non-Patent Citations (2)
Title |
---|
于晓敏等: "《数据结构与算法》", 31 December 2010, 北京航空航天大学出版社 * |
何此昂等: "《Freescale 08系列:单片机开发与应用实例》", 31 December 2009, 北京航空航天大学出版社 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2017124988A1 (en) | Ground station, unmanned aerial vehicle, and system and method for communication between ground station and unmanned aerial vehicle | |
CN104216785B (en) | General policies task system and its implementation | |
US10139799B2 (en) | Controller to modify an execution condition during program execution | |
EP3528131A1 (en) | Control device, control system, control method, and control program | |
CN108303969B (en) | Automatic testing device for vehicle-mounted ECU | |
CN106900082B (en) | Data processing method of sensor network node and sensor network node | |
CN107943722A (en) | It is a kind of that the method and system for passing screen are realized based on USB device | |
EP3444080A1 (en) | Actuator control system, actuator control method, information-processing program, and recording medium | |
CN110161983A (en) | Control device, control system, control method and storage medium | |
CN113553190B (en) | Computing cluster system, scheduling method, device and storage medium | |
JP2019503139A5 (en) | ||
US20170277172A1 (en) | Sim system, control method therefor and production informatization system | |
EP2892221A3 (en) | Information processing system, information processing method, and device | |
WO2020100548A1 (en) | Control system and control device | |
CN113242244B (en) | Data transmission method, device and system | |
CN109507914A (en) | A kind of peripheral hardware control method and device | |
CN107977206B (en) | Method and device for processing batch service data files | |
JP5156713B2 (en) | Design support device | |
CN111612138B (en) | Neural network image identification system, neural network construction system and method | |
CN106302125B (en) | The method, apparatus and system that a kind of pair of solicited message is responded | |
CN104460437A (en) | Communication control method and communication device | |
CN111752716A (en) | Model using method, data processing method and device | |
CN111381958B (en) | Communication device, neural network processing chip, combination device and electronic equipment | |
CN110161893A (en) | The communication means and storage medium of slave device, control system, response data | |
CN111143050B (en) | Method and equipment for dispatching container clusters |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB03 | Change of inventor or designer information |
Inventor after: Yan Jinyuan Inventor after: Ren Gaobo Inventor after: Tang Wenpu Inventor after: Liang Jin Inventor after: Zheng Jiaxin Inventor before: Ren Gaobo Inventor before: Tang Wenpu Inventor before: Shi Yizhou |
|
CB03 | Change of inventor or designer information | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190322 |
|
RJ01 | Rejection of invention patent application after publication |