CN107766077A - A kind of multiple external device control methods and device - Google Patents

A kind of multiple external device control methods and device Download PDF

Info

Publication number
CN107766077A
CN107766077A CN201710978217.3A CN201710978217A CN107766077A CN 107766077 A CN107766077 A CN 107766077A CN 201710978217 A CN201710978217 A CN 201710978217A CN 107766077 A CN107766077 A CN 107766077A
Authority
CN
China
Prior art keywords
interface function
function
controller
operate interface
control
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
Application number
CN201710978217.3A
Other languages
Chinese (zh)
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.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN201710978217.3A priority Critical patent/CN107766077A/en
Publication of CN107766077A publication Critical patent/CN107766077A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/22Microcontrol or microprogram arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4411Configuring for operating with peripheral devices; Loading of device drivers

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a kind of multiple external device control methods and device.Wherein, control method is based on controller, comprises the following steps:The multiple different external equipments controlled by the controller build unified device model;For the unified device model, operate interface function is set;Based on the operate interface function, according to the external equipment of target control, the parameter matched with the external equipment is selected, calls the bottom layer driving of the external equipment to be controlled.The present invention can reduce the development difficulty for the software that multiple external equipments are controlled using controller, accelerate project development progress.

Description

A kind of multiple external device control methods and device
Technical field
The present invention relates to equipment control technology field, more particularly to a kind of multiple external device control methods and device.
Background technology
At present, in microcontroller software design, control to external equipment mostly by the control bit of configuration register or The distinct interface function of each peripheral hardware in the firmware library provided using semiconductor producer is controlled.This control mode needs pair Numerous interface functions have very familiar understanding in the register or firmware library of microcontroller.Therefore increase the difficulty of software development Degree, slows down project development progress.
The content of the invention
In view of above-mentioned technical problem, present invention aims to propose a kind of multiple external device control methods and device, is based on The present invention, the development difficulty for the software that multiple external equipments are controlled using controller can be reduced, accelerate project development progress.
In a first aspect, the invention provides a kind of multiple external device control methods, the control method is based on controller, Comprise the following steps:Unified Device model establishment step, the multiple different external equipments controlled by the controller are built Unified device model;Operate interface function determines step, and operate interface function is set for the unified device model;Call Step, based on the operate interface function, according to the external equipment of target control, the parameter matched with the external equipment is called, Bottom layer driving based on the external equipment is controlled.
Further, in above-mentioned multiple external device control methods, the controller is microcontroller.
Further, in above-mentioned multiple external device control methods, the microcontroller is single-chip microcomputer.
Further, in above-mentioned multiple external device control methods, state operate interface function include initialization operation function, Function reading and transmission function;Control parameter in the operate interface function is variable, and the number of control parameter is variable.
Second aspect, present invention also offers a kind of multiple external device controllers, the control device is arranged at control Device processed, including:Unified Device model building module, operate interface function determination module and calling module.Wherein, Unified Device mould Type establishes multiple different external equipments that module is used to be controlled by the controller and builds unified device model;Operation connects Mouth function determination module is used to set operate interface function for the unified device model;Calling module is used to be based on the behaviour Make interface function, according to the external equipment of target control, the parameter matched with the external equipment is called, based on the external equipment Bottom layer driving is controlled.
Further, in above-mentioned multiple external device controllers, the controller is microcontroller.
Further, in above-mentioned multiple external device controllers, the microcontroller is single-chip microcomputer.
Further, in above-mentioned multiple external device controllers, the operate interface function includes initialization operation letter Number, function reading and transmission function;Control parameter in the operate interface function is variable, and the number of control parameter is variable.
In the present invention, the multiple different external equipments controlled by controller build unified device model and are that it sets Operate interface function is put, therefore, when being controlled to some specific external equipment, the operate interface function can be based on, According to the external equipment of target control, the parameter matched with the external equipment is called, calls the bottom layer driving of the external equipment to enter Row control.
In other words, answering during the present invention configures according to the device model that multiple equipment is abstracted departing from actual hardware interface Miscellaneous operation, upper level applications can be transplanted very easily on each controller, and the process of programming becomes simple;Cause And accelerate the progress of project, reduce the exploitation threshold of controller control, convenient later maintenance.On the other hand, unified equipment Operate interface, there is provided common external equipment function control, cover the hardware adaptor work(that nearly all microcontroller provides Can, the mode of hardware operation in specification software development process so that program is easy to understand, facilitates place on programmed logic Reason.
Brief description of the drawings
The accompanying drawing for forming the part of the present invention is used for providing a further understanding of the present invention, schematic reality of the invention Apply example and its illustrate to be used to explain the present invention, do not form inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is the step flow chart of the multiple external device control method one embodiment of the present invention;
Fig. 2 is the fundamental diagram of the multiple external device control method one embodiment of the present invention;
Fig. 3 is the structured flowchart of the multiple external device controller one embodiment of the present invention.
Embodiment
It should be noted that in the case where not conflicting, the feature in embodiment and embodiment in the present invention can phase Mutually combination.Describe the present invention in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 is the step flow chart of the multiple external device control method one embodiment of the present invention.Reference picture 1, this implementation The multiple external device control methods of example comprise the following steps:
S110, the multiple different external equipments controlled by controller build unified device model;
S120, operate interface function is set for unified device model;
S130, based on operate interface function, according to the external equipment of target control, select the ginseng matched with the external equipment Number, calls the bottom layer driving of the external equipment to be controlled.
In a preferred embodiment, controller is microcontroller, for example, the controller such as single-chip microcomputer, ARM.In addition, behaviour Initialization operation function, function reading can be included but is not limited to and send function by making interface function.Also, operate interface function In control parameter it is variable, the number of control parameter is variable.
With reference to Fig. 2, the operation principle of the present embodiment is illustrated.
In fig. 2, the multiple different external equipments controlled by controller (not shown) build Unified Device model, and For it, operate interface function is set, therefore, carried out to some specific external equipment (for example, peripheral hardware one, peripheral hardware two, peripheral hardware three) During control, the operate interface function can be based on, according to the external equipment of target control, calls what is matched with the external equipment Parameter, the bottom layer driving (for example, peripheral hardware one drives, peripheral hardware two drives, peripheral hardware three drives) of the external equipment is called to be controlled.
Assuming that controller is microcontroller, the microcontroller needs to control UART1 interfaces to read with 9600 baud rates Data be put into the internal memory that first address is RxBuffer and be TxBuffer by first address contiguous memory in 100 data Send.The initialization operation function of calling Unified Device model is only needed during programming, arrange parameter list is INB, Further according to corresponding parameter UART, 1,9600 are filled in behind the item of parameter list, that is, realize and peripheral hardware UART1 is arranged to baud Rate 9600;When reading data, the function reading of Unified Device model need to be only called, arrange parameter list is INR, is arranged according to parameter The item of table fills in corresponding parameter UART, 1, RxBuffer;Then when UART1 receives data, reception will be returned to by receiving function The data amount check arrived, and in the memory address that the data received deposit is specified;When sending data, unification need to be only called The transmission function of device model, arrange parameter list are INTL, according to corresponding to being filled in parameter list item parameter UART, 1, TxBuffer、100;Specified data can be sent.
Below, one embodiment that the above method is realized using controller STM32F030 is provided.
Control STM32F030 UART, IIC, FLASH peripheral hardware
UART, IIC, FLASH are abstracted as to the process of device model
1st, UART, IIC, FLASH are elementary cell interactive information by byte,
2nd, these three point peripheral hardwares can be abstracted into a box, i.e. Unified Device model,
3rd, it is the box, i.e. Unified Device model, there is provided an input interface, it is (initial to receive the information from upper strata Change, reading and writing).
4th, the other end of Unified Device model is connected to different external equipments by N number of passage
Stand three external equipments from the point of view of user, then different external equipments can be seen as same kind equipment, i.e., Realize the abstract of equipment
The example of interface function:
Initialize the baud rate of serial ports 1,9600, word length 8bit, not enabled stream control
InterfaceInit(“INB”,”UART”,1,9600)
IIC2 interfaces are initialized, configuration slave addresses are 0x10
InterfaceInit(“INS”,”IIC”,2,0x10)
10 data in TxBuffer [10] are sent by serial ports 1
SendData(“INTL”,”UART”,1,TxBuffer,10);
Pass through 10 data of the IIC 2 into slave 0x10 transmission TxBuffer [10]
SendData(“INSTL”,”IIC”,2,0x10,TxBuffer,10)
Read 10 data received in serial ports 1 and be stored in RxBuffer [10]
ReadData(“INRL”,”UART”,1,RxBUffer,10)
10 byte datas are read in the slave for being 0x10 from address, and are stored in RxBuffer
ReadData(“INSRL”,”IIC”,2,RxBuffer,10)。
The present embodiment according to multiple equipment be abstracted device model departing from actual hardware interface configure in complex operations, Upper level applications can be transplanted very easily on each controller, and the process of programming becomes simple;Thus, accelerate item Purpose progress, reduce the exploitation threshold of controller control, convenient later maintenance.On the other hand, unified equipment operation interface, Common external equipment function control is provided, covers the hardware adaptor function that nearly all microcontroller provides, specification The mode of hardware operation in software development process so that program is easy to understand, facilitates processing on programmed logic.
On the other hand, present invention also offers a kind of multiple external device controller one embodiment, reference picture 3, its For the structured flowchart of the multiple external device controller one embodiment of the present invention.Including:Unified Device model building module 30, Operate interface function determination module 32 and calling module 34.
Wherein, Unified Device model building module 30 is used for the multiple different external equipments controlled by the controller Build unified device model;Operate interface function determination module 32 is used to set operate interface for the unified device model Function;Calling module 34 is used to be based on the operate interface function, according to the external equipment of target control, calls with being set outside this The parameter of standby matching, the bottom layer driving based on the external equipment are controlled.
Preferably, the control device of above-mentioned multiple external equipments, the controller are microcontroller, such as single-chip microcomputer, ARM The equipment such as controller.Operate interface function therein includes initialization operation function, function reading and sends other letters such as function Number;Control parameter in operate interface function is variable, and the number of control parameter is variable.
The present embodiment according to multiple equipment be abstracted device model departing from actual hardware interface configure in complex operations, Upper level applications can be transplanted very easily on each controller, and the process of programming becomes simple;Thus, accelerate item Purpose progress, reduce the exploitation threshold of controller control, convenient later maintenance.On the other hand, unified equipment operation interface, Common external equipment function control is provided, covers the hardware adaptor function that nearly all microcontroller provides, specification The mode of hardware operation in software development process so that program is easy to understand, facilitates processing on programmed logic.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention God any modification, equivalent substitution and improvements made etc., should be included in the scope of the protection with principle.

Claims (8)

1. a kind of multiple external device control methods, it is characterised in that the control method is based on controller, including following step Suddenly:
Unified Device model establishment step, the multiple different external equipments controlled by the controller build unified equipment Model;
Operate interface function determines step, and operate interface function is set for the unified device model;
Invocation step, based on the operate interface function, according to the external equipment of target control, calling matches with the external equipment Parameter, the bottom layer driving based on the external equipment is controlled.
2. multiple external device control methods according to claim 1, it is characterised in that
The controller is microcontroller.
3. multiple external device control methods according to claim 2, it is characterised in that
The microcontroller is single-chip microcomputer.
4. multiple external device control methods according to claim 3, it is characterised in that
The operate interface function includes initialization operation function, function reading and sends function;
Control parameter in the operate interface function is variable, and the number of control parameter is variable.
A kind of 5. multiple external device controllers, it is characterised in that the control device is arranged at controller, including:
Unified Device model building module, multiple different external equipments for being controlled by the controller build unified Device model;
Operate interface function determination module, for setting operate interface function for the unified device model;
Calling module, for based on the operate interface function, according to the external equipment of target control, calling and the external equipment The parameter of matching, the bottom layer driving based on the external equipment are controlled.
6. multiple external device controllers according to claim 5, it is characterised in that
The controller is microcontroller.
7. multiple external device controllers according to claim 6, it is characterised in that
The microcontroller is single-chip microcomputer.
8. multiple external device controllers according to claim 7, it is characterised in that
The operate interface function includes initialization operation function, function reading and sends function;
Control parameter in the operate interface function is variable, and the number of control parameter is variable.
CN201710978217.3A 2017-10-18 2017-10-18 A kind of multiple external device control methods and device Pending CN107766077A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710978217.3A CN107766077A (en) 2017-10-18 2017-10-18 A kind of multiple external device control methods and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710978217.3A CN107766077A (en) 2017-10-18 2017-10-18 A kind of multiple external device control methods and device

Publications (1)

Publication Number Publication Date
CN107766077A true CN107766077A (en) 2018-03-06

Family

ID=61268323

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710978217.3A Pending CN107766077A (en) 2017-10-18 2017-10-18 A kind of multiple external device control methods and device

Country Status (1)

Country Link
CN (1) CN107766077A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1441366A (en) * 2001-09-04 2003-09-10 三星电子株式会社 Communication method and its device during process
CN101924909A (en) * 2010-07-20 2010-12-22 深圳市茁壮网络股份有限公司 Middleware adaptation layer-based universal digital television conditional access system
US20120173767A1 (en) * 2011-01-04 2012-07-05 Samsung Electronics Co., Ltd. Apparatus and method for remotely controlling peripheral devices in mobile communication terminal
US20130222849A1 (en) * 2012-02-29 2013-08-29 Kyocera Document Solutions Inc. Device Information Providing System for Providing Information Through a Web Page Included in Each of a Main Electronic Device and a Sub-Electronic Device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1441366A (en) * 2001-09-04 2003-09-10 三星电子株式会社 Communication method and its device during process
CN101924909A (en) * 2010-07-20 2010-12-22 深圳市茁壮网络股份有限公司 Middleware adaptation layer-based universal digital television conditional access system
US20120173767A1 (en) * 2011-01-04 2012-07-05 Samsung Electronics Co., Ltd. Apparatus and method for remotely controlling peripheral devices in mobile communication terminal
US20130222849A1 (en) * 2012-02-29 2013-08-29 Kyocera Document Solutions Inc. Device Information Providing System for Providing Information Through a Web Page Included in Each of a Main Electronic Device and a Sub-Electronic Device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
苏勇: "嵌入式实时操作系统MQX应用框架研究", 《中国优秀硕士学位论文全文数据库(电子期刊)》 *

Similar Documents

Publication Publication Date Title
US9239573B2 (en) Mapping between hierarchies in an industrial automation system
CN105224480B (en) A kind of method and apparatus for the access memory device in response to reading requirement
CN104424154B (en) General serial peripheral interface
CN102082969B (en) External Bluetooth equipment driving system for set-top box
WO2009021974A2 (en) Real-time industrial ethernet ethercat communication control
CN105335155A (en) Method for realizing different IoT (Internet of Things) applications by only needing to configure cloud-end script
CN108388531A (en) A kind of chip and its pin multiplexing method
CN103150198B (en) A kind of display methods of configuration software
CN106528153A (en) Embedded software modular construction method and device
CN109656841A (en) Mixing control method and device based on software simulation I2C and Hardware I2C
CN103513977B (en) Display method and device for group member list
CN103778765A (en) Remote control method, remote control equipment and main equipment
CN103676911A (en) Equipment control system and control method
CN107766077A (en) A kind of multiple external device control methods and device
EP3186712A1 (en) Universal serial bus emulation layer
CN106815128A (en) Log-output method and device, electronic equipment
CN102999002B (en) The method of programmable logic controller device and control programmable logic controller device
CN106776388A (en) Server system and read method
CN101969476B (en) Communication mode management method and system for emulating semiconductor manufacturing equipment
CN102263709A (en) Gateway for realizing communication transformation between EtherCAT (Ethernet for control and automation technology) and RS485 and communication method thereof
CN101957878B (en) Method and device for constructing and managing prototype device library
CN207586900U (en) Remote update system based on ZYNQ
CN105717829A (en) Method for solving chip pin compatibility problem
WO2018121004A1 (en) Method and system for managing and controlling gpio used for controlling set-top box led, and electronic device
CN107341117A (en) The method to set up and external equipment of a kind of external equipment

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20180306

RJ01 Rejection of invention patent application after publication