CN112506825A - I/O signal reference method - Google Patents
I/O signal reference method Download PDFInfo
- Publication number
- CN112506825A CN112506825A CN202011522627.5A CN202011522627A CN112506825A CN 112506825 A CN112506825 A CN 112506825A CN 202011522627 A CN202011522627 A CN 202011522627A CN 112506825 A CN112506825 A CN 112506825A
- Authority
- CN
- China
- Prior art keywords
- signal
- variable object
- application module
- identifier
- mapping table
- 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
- 238000007430 reference method Methods 0.000 title description 3
- 238000013507 mapping Methods 0.000 claims abstract description 29
- 238000004891 communication Methods 0.000 claims abstract description 24
- 238000000034 method Methods 0.000 claims abstract description 19
- 230000007246 mechanism Effects 0.000 claims abstract description 15
- 230000008859 change Effects 0.000 claims description 4
- 230000006870 function Effects 0.000 description 9
- 238000010586 diagram Methods 0.000 description 4
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000005070 sampling Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/14—Handling requests for interconnection or transfer
- G06F13/20—Handling requests for interconnection or transfer for access to input/output bus
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The invention provides a method for quoting I/O signals, which comprises S1, defining the mark of the quoting I/O signal; s2, the application module creates a corresponding variable object locally by referring to the identifier of the I/O signal and adds the variable object into a mapping table in which the identifier of the I/O signal and the variable object are in one-to-one correspondence; s3, establishing an access mapping relation between the variable object and the I/O signal through an internal communication mechanism according to the mapping table; s4, the application module controls and accesses the I/O signal by reading and writing the variable object; the external I/O signals are accessed by the application module during running through the control of the external I/O signals by operating the local variable object, the program architecture is decoupled hierarchically, and the method has the advantages of flexibility and high efficiency in I/O access and support for dynamic loading and running of the application module.
Description
Technical Field
The invention belongs to the technical field of embedded equipment, and particularly relates to a method for quoting an I/O signal.
Background
The embedded general control platform generally comprises a CPU board, a communication board, an input/output interface board, and the like, and the input/output interface board generally comprises a switching value input board, a switching value output board, an analog input board, and an analog output board. In order to cooperate with each other, input and output signals (I/O signals for short) need to be exchanged between the boards. The conventional method comprises the following steps: by adopting the method, as long as the requirement of an upper application module (APP for short) for accessing I/O changes, the communication protocol can be modified, and the adaptability is poor; or the configuration information containing the inter-board interaction signals is generated in advance by a visual configuration tool and downloaded to the board card for analysis and operation, the method depends on the tool, the configuration information needs to be analyzed first during operation, the starting speed is influenced, and the method cannot support the dynamic loading (the new requirement of external I/O access during operation, and the tool cannot be configured in advance) operation of the application module. Therefore, how the application module flexibly and efficiently accesses the I/O signal deserves further intensive study, and in order to solve the above problems, the present application proposes a method for referencing the I/O signal.
Disclosure of Invention
The invention aims to provide an I/O signal quoting method, which supports flexible and efficient access to I/O signals when an application module runs; and I/O access during dynamic loading and running of the application module is supported, so that the problem that communication between the cards is not flexible and efficient is solved.
The invention provides the following technical scheme:
a method of referencing an I/O signal, comprising the steps of: s1, defining the identification of the I/O signal which can be used; s2, the application module creates a corresponding variable object locally by referring to the identifier of the I/O signal and adds the variable object into a mapping table in which the identifier of the I/O signal and the variable object are in one-to-one correspondence; s3, establishing an access mapping relation between the variable object and the I/O signal through an internal communication mechanism according to the mapping table; and S4, the application module controls and accesses the I/O signal through reading and writing the variable object.
Preferably, the attribute members of the variable object include a data value, a quality, a time stamp, a read operation function, and a write operation function, and the time stamp is used to mark a change time of the I/O signal.
Preferably, the establishing, by the internal communication mechanism, an access mapping relationship between the variable object and the I/O signal includes: for the I/O signal of the output class, the internal communication mechanism sends the attribute member value of the variable object to the I/O signal of the corresponding identifier according to the mapping table, and then updates the information of the I/O signal; for the I/O signal of the input class, the internal communication mechanism receives the state information sent by the I/O signal of the corresponding identification, and then updates the attribute member value of the local variable object according to the mapping table.
Preferably, the reading and writing of the variable object so as to control and access the I/O signal includes: the application module can update the I/O signal value of the corresponding identification through the write operation of the variable object; the application module can read the I/O signal value of the corresponding identification through the reading operation of the variable object.
Preferably, the application module creates only one variable object for the identifier of each I/O signal, and directly refers to the variable object corresponding to the identifier of the I/O signal if the identifier of the I/O signal already exists in the mapping table.
The invention has the beneficial effects that:
according to the I/O signal reference method, when the application module operates, the I/O signals are accessed by controlling the I/O signals through the operation of the local variable object, the program architecture is decoupled hierarchically, and the method has the advantages of flexibility and high efficiency in I/O access and support of dynamic loading and operation of the application module.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the principles of the invention and not to limit the invention. In the drawings:
FIG. 1 is a schematic flow diagram of the process of the present invention;
FIG. 2 is a schematic view of the present invention in a manner of reference;
FIG. 3 is a control device I/O signal diagram of an embodiment of the present invention;
FIG. 4 is a diagram illustrating a mapping relationship according to an embodiment of the invention;
FIG. 5 is a schematic diagram of control and access to I/O signals by reading and writing to variable objects.
Detailed Description
As shown in fig. 1 and fig. 2, the method for referencing the I/O signal includes the following steps:
s1, defining the identification of the I/O signal that can be referred to.
S2, the application module creates a corresponding variable object locally by referring to the identification of the I/O signal, and adds the variable object into the mapping table of the identification of the I/O signal and the variable object, if the identification of the I/O signal in the mapping table already exists, the variable object corresponding to the identification of the I/O signal is directly referred to. The attribute members of the variable object include a data value, a quality, a time stamp for marking a time of change of the I/O signal, a read operation function, and a write operation function.
S3, establishing an access mapping relation between the variable object and the identification of the I/O signal through an internal communication mechanism; the method specifically comprises the following steps: for the I/O signal of the output class, the internal communication mechanism sends the attribute member value of the variable object to the I/O signal of the corresponding identifier according to the mapping table, and then updates the information of the I/O signal; for the I/O signal of the input class, the internal communication mechanism receives the state information sent by the I/O signal of the corresponding identification, and then updates the attribute member value of the local variable object according to the mapping table.
S4, the application module controls and accesses the I/O signal by reading and writing the variable object; the method specifically comprises the steps that an application module can update an I/O signal value of a corresponding identifier through the write operation of a variable object; the application module can read the I/O signal value of the corresponding identification through the reading operation of the variable object.
Taking a control device as an example, besides a CPU board card, the control device further includes four kinds of interface boards, i.e., a switching value input interface, a switching value output interface, an analog value input interface, and an analog value output interface, where software is cured in each interface board, so as to implement functions corresponding to each board card and define the identifier of a corresponding I/O signal, as shown in fig. 3:
for example, the labels "S3. b 1", "S3. b 2", "S4. b 1", etc., wherein S3, S4, S5, S6 represent board card numbers, for example: when the number 3 board card software runs, the current state of the first path of access channel is stored in a data structure corresponding to the signal identifier 'S3. BI1', and when the state of the first path of access channel changes, the number 3 board card software sends the signal identifier 'S3. BI1' and the access state value out; the control information of the first channel of the outgoing channel is stored in the data structure corresponding to the signal identifier 'S4. BO1' by the number 4 board card software, and the number 4 board card software can control the first channel of the switching value outlet in real time according to the control command in the data structure.
Generally, a plurality of independent application modules exist on a CPU card of a control device, each application module needs to access different external I/O signals, and different application modules also need to access the same external I/O signals. In specific implementation, the LinkIO function is used for referencing the identifier of the external I/O signal, and the function creates a local variable object when calling, and adds the local variable object into the access mapping table in which the identifier of the I/O signal and the local variable object correspond to each other one by one. LinkIO function call example: var _ obj ═ LinkIO ("s 3.b 1"), and var _ obj is a local variable object created with the identification "s 3.b 1" referencing the external I/O signal. The data structure members of the variant objects in this implementation include data values, qualities, time stamps, and the like.
As shown in fig. 4, the application module accesses the external I/O signal requirements and the created local variable object access mapping table. After the application module 1 is started to operate, calling a LinkIO function to create a variable object var _ obj1 for accessing an I/O signal marked as 'S3. BI1' according to the requirement of accessing an external I/O signal; after the application module 2 is started, the I/O signals marked as "s 3.bi1", "s 3.bi2", "s 3.bi3" and "s 4.bo1" need to be accessed, when the variable object of "s 3.bi1" is created, since the variable object corresponding to the mark of the I/O signal is already created by the application module 1, the variable object var _ obj1 is directly referred to, and then the variable objects var _ obj2, var _ obj3 and var _ obj4 are respectively created; the application module 3 needs to access the I/O signals identified as "s 4. bo2", "s 4. bo3", and after startup, the variable objects var _ obj5 and var _ obj6 are created. After all application modules create objects, access mapping tables corresponding to the I/O signal identifiers and the local variable objects one to one are formed.
As shown in fig. 5, access mapping between the I/O signal and the local variable object is realized through an internal communication mechanism, which may be a shared memory or various communication buses, etc., in this case, an inter-board communication bus mode is adopted, and a communication frame is a self-described information body in a format of { I/O signal identifier, I/O signal information body content }.
Now, the switching value input is exemplified: the communication frame format simplification is { "s 3.bi 1; a data value; quality qulitiy; time of time mark "}, that is, the communication frame includes the I/O signal identifier, the current open value, the signal quality and the time of the change of the open signal, the S3 board software will send the frame when detecting that the" S3.b 1 "signal changes, after receiving the communication frame, the CPU board bottom layer software searches for" S3.b 1 "according to the mapping table of fig. 4, locates to the local variable 1(var _ obj1), and then updates the members of the variable object 1, including the data value, the quality and the time mark. Thus, the upper application module 1 and the application module 2 can access the switching value input I/O signal "s 3.b 1" by accessing the read operation of the variable object var _ obj1, thereby realizing the access of the external I/O signal.
Taking the switching value output as an example, the application module 3 updates the control command to the body content of the variable object 5 through the write operation of var _ obj5, and then the internal communication mechanism transfers the information of the variable object 5 to the target I/O signal "s 4.bo 2" according to the mapping table of fig. 4, where the communication frame format is simplified to be { "s 4.bo 2; a data value; quality qulitiy; and after receiving the frame, the board card No. 4 stores the information into a data structure corresponding to the board card No. 4, namely BO2, so as to control the opening of the outlet. The I/O mechanism of the analog quantity input and the analog quantity output is basically consistent with the switching quantity input and the switching quantity output, and the data value attribute of the variable object can have the buffer property by considering the continuous output or sampling buffer supporting the analog quantity.
Although the present invention has been described in detail with reference to the foregoing embodiments, it will be apparent to those skilled in the art that changes may be made in the embodiments and/or equivalents thereof without departing from the spirit and scope of the invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (5)
1. A method of referencing an I/O signal, comprising the steps of:
s1, defining the identification of the I/O signal which can be used;
s2, the application module creates a corresponding variable object locally by referring to the identifier of the I/O signal and adds the variable object into a mapping table in which the identifier of the I/O signal and the variable object are in one-to-one correspondence;
s3, establishing an access mapping relation between the variable object and the I/O signal through an internal communication mechanism according to the mapping table;
and S4, the application module controls and accesses the I/O signal through reading and writing the variable object.
2. The method of claim 1, wherein the member of the attributes of the variable object comprises a data value, a quality, a time stamp, a read operation function, and a write operation function, and wherein the time stamp is used to mark a time of change of the I/O signal.
3. The method of claim 1, wherein the internal communication mechanism establishes an access mapping relationship between the variable object and the I/O signal, comprising:
for the I/O signal of the output class, the internal communication mechanism sends the attribute member value of the variable object to the I/O signal of the corresponding identifier according to the mapping table, and then updates the information of the I/O signal;
for the I/O signal of the input class, the internal communication mechanism receives the state information sent by the I/O signal of the corresponding identification, and then updates the attribute member value of the local variable object according to the mapping table.
4. The method of claim 1, wherein said reading and writing to variable objects to control and access I/O signals comprises:
the application module can update the I/O signal value of the corresponding identification through the write operation of the variable object;
the application module can read the I/O signal value of the corresponding identification through the reading operation of the variable object.
5. The method according to claim 1, wherein the application module creates only one variable object for each I/O signal identifier, and directly references the variable object corresponding to the I/O signal identifier if the I/O signal identifier already exists in the mapping table.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011522627.5A CN112506825A (en) | 2020-12-21 | 2020-12-21 | I/O signal reference method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011522627.5A CN112506825A (en) | 2020-12-21 | 2020-12-21 | I/O signal reference method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112506825A true CN112506825A (en) | 2021-03-16 |
Family
ID=74922845
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011522627.5A Pending CN112506825A (en) | 2020-12-21 | 2020-12-21 | I/O signal reference method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112506825A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113219952A (en) * | 2021-05-10 | 2021-08-06 | 东风电子科技股份有限公司 | Method, device and processor for realizing overall control based on BCM function of vehicle body control module and computer readable storage medium thereof |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101833498A (en) * | 2009-07-31 | 2010-09-15 | 北京伟晨豪嘉科技有限责任公司 | Automatic detection system of embedded type system based on testing script technique |
CN103631596A (en) * | 2013-12-05 | 2014-03-12 | 用友软件股份有限公司 | Configuration device and configuration method of business object data entry and updating rule |
CN105425664A (en) * | 2014-11-14 | 2016-03-23 | 广州电器科学研究院 | Digital quantity I/O control system and method |
-
2020
- 2020-12-21 CN CN202011522627.5A patent/CN112506825A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101833498A (en) * | 2009-07-31 | 2010-09-15 | 北京伟晨豪嘉科技有限责任公司 | Automatic detection system of embedded type system based on testing script technique |
CN103631596A (en) * | 2013-12-05 | 2014-03-12 | 用友软件股份有限公司 | Configuration device and configuration method of business object data entry and updating rule |
CN105425664A (en) * | 2014-11-14 | 2016-03-23 | 广州电器科学研究院 | Digital quantity I/O control system and method |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113219952A (en) * | 2021-05-10 | 2021-08-06 | 东风电子科技股份有限公司 | Method, device and processor for realizing overall control based on BCM function of vehicle body control module and computer readable storage medium thereof |
CN113219952B (en) * | 2021-05-10 | 2022-07-19 | 东风电子科技股份有限公司 | Method, device, processor and computer readable storage medium for realizing overall control based on BCM function of vehicle body control module |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11188999B2 (en) | Graphics processing microprocessor system having master and slave devices | |
US5136709A (en) | Method for generating an operating system by a static link-editor | |
US6681267B2 (en) | Virtual computer system and method for swapping input/output devices between virtual machines and computer readable storage medium | |
EP0752646B1 (en) | Data access implementation of device driver interface | |
US5109504A (en) | Graphics program adaptor | |
KR900006008B1 (en) | Information processing system having smart memories | |
CN112000593B (en) | PCIe equipment management method and operation system thereof | |
CN112000594B (en) | PCIe equipment management method and operation system thereof | |
US6256723B1 (en) | Signal processing system with distributed uniform memory | |
CN112506825A (en) | I/O signal reference method | |
CN1987798A (en) | Communication method between data plane and control plane | |
US6886069B2 (en) | IC card and management method of nonvolatile memory in IC card | |
US4538225A (en) | Table-driven apparatus for data display and modification | |
US6934537B2 (en) | Radio communication device, method of and program for rewriting boot program therefor | |
Lyu et al. | A procedure-based dynamic software update | |
CN101645019A (en) | Virtual operating system creation method | |
JP4778312B2 (en) | Data processing device, program, editor device, and recording medium | |
JP2555920B2 (en) | Online real-time processor | |
CN111562436A (en) | Equipment driving method and device of double-core intelligent electric meter | |
US20020065963A1 (en) | Method and system for flexible channel path identifier assignment | |
CN102567034B (en) | Driver management system | |
EP0316251B1 (en) | Direct control facility for multiprocessor network | |
KR100481995B1 (en) | Target system | |
JPH01125889A (en) | Electronic device provided with printed circuit assembly | |
CN117667796A (en) | Multi-hardware interface board card automatic adaptation control method, control system and test device |
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 |