CN112000599A - Method, system, equipment and storage medium for realizing CEC protocol by IO simulation - Google Patents
Method, system, equipment and storage medium for realizing CEC protocol by IO simulation Download PDFInfo
- Publication number
- CN112000599A CN112000599A CN202010743078.8A CN202010743078A CN112000599A CN 112000599 A CN112000599 A CN 112000599A CN 202010743078 A CN202010743078 A CN 202010743078A CN 112000599 A CN112000599 A CN 112000599A
- Authority
- CN
- China
- Prior art keywords
- cec
- port
- timer
- level
- reading
- 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
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/38—Information transfer, e.g. on bus
- G06F13/382—Information transfer, e.g. on bus using universal interface adapter
- G06F13/385—Information transfer, e.g. on bus using universal interface adapter for adaptation of a particular data processing system to different peripheral devices
-
- 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
- G06F13/24—Handling requests for interconnection or transfer for access to input/output bus using interrupt
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Communication Control (AREA)
Abstract
The invention relates to a method, a system, equipment and a storage medium for realizing CEC protocol by IO simulation, which sequentially comprises the following steps: registering an IO port of an MCU unit connected with a CEC signal line as a registered port by running a program; when the IO port is at a low level, starting a timer of the MCU unit and timing; when the timer is up, if the level of the IO port is high level, reading CEC data at the moment; and then, CEC data is transmitted by setting the IO level and the timing of the timer, and the other end of the CEC signal line in the system is connected with the HDMI controller. According to the invention, the CEC signal is simulated at the IO port directly connected with the CEC signal line to transmit or read the signal through the interruption and timing of the MCU, CEC communication can be realized without a special CEC module on the equipment, the use is convenient, and the cost is also reduced.
Description
Technical Field
The invention relates to the field of communication, in particular to a convenient and practical method, a system, equipment and a storage medium for realizing a CEC protocol by IO simulation.
Background
CEC (consumer Electronics control), consumer Electronics control, is a communication protocol established over HDMI, and a protocol providing a high-level control function for all home audiovisual devices connected through HDMI cable in the user environment, and through CEC signals, the user can control all connected electronic devices connected over the HDMI interface, such as using a tv remote controller to control the single-key playing, system standby, left-right movement, and the like of the electronic devices connected through HDMI. If the CEC communication needs to be supported, the electronic device needs to have a CEC module, but many HDMI conversion chips in the market do not include a CEC module, so that the device without the CEC module cannot support a CEC protocol, the use is limited, and the price of the HDMI chip including the CEC module is high, which increases the cost.
Disclosure of Invention
Aiming at the existing defects, the invention provides a convenient and practical method, system, equipment and storage medium for realizing CEC protocol by IO simulation.
The technical scheme adopted by the invention for solving the technical problems is as follows: a method for realizing CEC protocol by IO simulation comprises the following steps:
s1, registering an IO port of an MCU unit connected with a CEC signal line as an interrupt pin triggered by a falling edge by a running program;
s2, after the CEC signal is received by the IO port, disabling the IO port and reading the level of the IO port, and when the IO port is at a low level, starting a timer of the MCU unit and timing for 3.7 +/-0.2 ms;
s3, when the timer arrives, reading the level of the IO port, and if the level is high, reading the data of the CEC data EOM and the ACK bit;
s4, after the CEC data are read, registering the IO port of the MCU unit connected with the CEC signal line as a port of a bidirectional open circuit mode again through the running program;
s5, setting the IO port to be low level, timing a timer of the MCU unit for 3.7 +/-0.2 ms, pulling up the level of the IO port when the timer is up, and sending a CEC starting signal;
s6, timing the timer for 1.5 plus or minus 0.2ms and pulling down the level of the IO port, timing the timer for 0.9 plus or minus 0.2ms after the timer expires, pulling up the level of the IO port and sending a value of 0, or timing the timer for 0.6 plus or minus 0.2ms and pulling down the level of the IO port, timing the timer for 1.8 plus or minus 0.2ms after the timer expires, pulling up the level of the IO port and sending a value of 1.
Preferably, the reading of the CEC data is continuously performed for a plurality of times, the IO port is set to the interrupt pin triggered by the falling edge again after each reading, the level of the IO port is read when each interrupt is triggered, and the data of the EOM and the ACK bit is read after the reading of the CEC data is completed for a plurality of times.
Preferably, the number of reads of the CEC data is 8.
The utility model provides a system for IO simulation realizes CEC agreement, includes MCU unit, CEC signal line, HDMI controller, CEC signal line one end is connected with an IO mouth of MCU unit, and the other end is connected with the HDMI controller, the IO mouth is registered as the registration port through the operation procedure, the IO mouth is registered in proper order and is used for receiving the interrupt pin that the falling edge that analyzes the CEC signal triggered and is used for simulating the port of the two-way mode of opening a way that sends the CEC signal, the MCU unit is received by this IO mouth through the control of interrupt and timer and is analyzed and simulate sending the CEC signal.
An electronic device comprising a memory for storing a computer program; a processor for implementing the steps of the IO simulation implementation CEC protocol method as described in any of the preceding claims when executing the computer program.
A computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of an IO simulation implementing CEC protocol method as in any preceding claim.
The invention has the beneficial effects that: the invention utilizes one IO port of the MCU to simulate and realize the CEC protocol, the MCU is low in price and can obviously reduce the production cost, and meanwhile, the running program simulates the CEC signal to transmit or read the signal on the IO port directly connected with the CEC signal line by controlling the interruption and the timing of the MCU, so that the equipment without a CEC module can support the CEC protocol, the CEC communication can be realized without arranging a special CEC module on the equipment, the use is convenient, and the cost is also reduced.
Drawings
FIG. 1 is a functional block diagram of the present invention;
FIG. 2 is a system block diagram of an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of an electronic device in an embodiment of the invention;
Detailed Description
For the purpose of more clearly illustrating the objects, technical solutions and advantages of the embodiments of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments, for clear and complete description, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without inventive step, are within the scope of the present invention.
As shown in FIG. 1, for the CEC signal, it delivers a 0,1 numerical sequence, where 0 is pulled down by 1.5ms and then pulled up by 0.9ms from the CEC signal line; 1, firstly pulling down the CEC signal line for 0.5ms, and then pulling up the CEC signal line for 1.9 ms; the start signal is pulled down 3.7ms and then pulled up 0.8ms by the CEC signal. The invention realizes CEC protocol and transmits CEC signal through IO simulation, which comprises MCU unit, CEC signal line, one end of the CEC signal line is connected with one IO port of MCU unit, the other end is connected with HDMI controller which controls signal through HDMI conversion chip, the realization steps are as follows:
s1, registering an IO port of an MCU unit connected with a CEC signal line as a FALLING edge triggered interrupt pin (GPIO _ EnablInt (P0,0, GPIO _ INT _ FALLING)) by running a program;
s2, after the IO port receives the CEC signal, disabling the IO port and reading the level thereof, namely (interrupt pin) and reading the level thereof, when the IO port is at low level, starting the timer of the MCU unit and timing for 3.7 +/-0.2 ms;
s3, when the timer arrives, reading the level of the IO port, and if the level is high, reading the data of the CEC data EOM and the ACK bit; in order to ensure the accuracy of reading data, the reading of the CEC data is continuously performed for multiple times, the IO port is set to be the interrupt pin triggered by the falling edge after each reading, the level of the IO port is read when each interrupt is triggered, and after the reading of the CEC data is completed for multiple times, the data of the EOM and the ACK bit is read, so that the CEC data is completely and accurately read, and the receiving and the analysis of CEC signals are realized. Preferably, the number of reads of the CEC data is 8. The operating procedure is as follows:
s4, after reading CEC data, registering the IO port of the MCU unit connected with the CEC signal line as the port of the bidirectional OPEN circuit mode (GPIO _ SetMode (P0, BIT0, GPIO _ PMD _ OPEN _ DRAIN) by running the program again;
s5, setting the IO port to be low level, timing a timer of the MCU unit for 3.7 +/-0.2 ms, pulling up the level of the IO port when the timer is up, and sending a CEC starting signal;
s6, timing the timer for 1.5 plus or minus 0.2ms and pulling down the level of the IO port, timing the timer for 0.9 plus or minus 0.2ms after the timer expires, pulling up the level of the IO port and sending a value of 0, or timing the timer for 0.6 plus or minus 0.2ms and pulling down the level of the IO port, timing the timer for 1.8 plus or minus 0.2ms after the timer expires, pulling up the level of the IO port and sending a value of 1. In the embodiment, the timings of 1.5ms, 0.9ms, 0.6ms and 1.8ms are selected in sequence to simulate CEC signals
Just so simulate through an IO mouth of running program utilization MCU and realize the CEC agreement, MCU low price, just apparent reduction manufacturing cost, through control and the interruption and the timing of the IO mouth of CEC signal line lug connection, just simulated the CEC signal and sent or read it, then through the UNICOM of HDMI controller with electronic equipment, make the equipment that does not have the CEC module also can support the CEC agreement, need not set up special CEC module on equipment and just can realize the CEC communication, very big use that has made things convenient for people.
For a system for implementing the CEC protocol by IO simulation, as shown in fig. 2, the system includes an MCU unit, a CEC signal line and an HDMI controller, in which the CEC protocol is implemented by controlling the MCU unit, the CEC signal line is used for transmitting signals, the HDMI controller is used for controlling transmission of CEC signals, one end of the CEC signal line is connected to an IO port of the MCU unit, and the other end of the CEC signal line is connected to the HDMI controller, the CEC signal line is a control signal line, each frame transmits a piece of information, each piece of information includes a start bit and a plurality of data bits, so that the MCU unit and the HDMI controller are connected by the CEC signal line and CEC signals are transmitted therebetween, the control of the MCU unit can implement the CEC protocol by simulation under the control of a main control ARM, and the HDMI controller is correspondingly connected to an electronic device to be controlled, such as a tv, A sound, etc., and controls the electronic devices through a CEC signal, and when implementing a CEC protocol through IO simulation, the IO port is registered as a registered port by running a program, different functions are realized by registering ports to run different running programs under different conditions, the IO port is a port which is sequentially registered as an interrupt pin for receiving a falling edge trigger for parsing the CEC signal and a bidirectional open mode for analog transmission of the CEC signal, the MCU unit receives, analyzes or simulates and sends CEC signals through interruption and timing control by the IO port, when the IO port is registered as an interruption pin triggered by a falling edge, the port realizes the receiving and analyzing of CEC model through the control simulation of the MCU unit, when the IO port is registered as the port of the bidirectional open circuit mode, the port is simulated to transmit CEC signals, and CEC signals are transmitted through the system by implementing the CEC protocol through IO simulation.
The invention also provides an electronic device and a computer-readable storage medium, which both have corresponding effects of the method for realizing the CEC protocol through IO simulation. Electronic device as shown in fig. 3, the electronic device comprises a memory 1 for storing a computer program 10; a processor 2 for implementing the steps of any of the CEC protocol methods via IO emulation as described above when executing the computer program 10. The computer readable storage medium has stored therein a computer program which, when executed by a processor, implements the steps of any of the above-described CEC protocol method via IO emulation, comprising a Random Access Memory (RAM), a memory, a Read Only Memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art that is capable of carrying computer program code.
It will be understood that modifications and variations can be made by persons skilled in the art in light of the above teachings and all such modifications and variations are intended to be included within the scope of the invention as defined in the appended claims.
Claims (6)
1. A method for realizing CEC protocol by IO simulation is characterized in that: the method comprises the following implementation steps:
s1, registering an IO port of an MCU unit connected with a CEC signal line as an interrupt pin triggered by a falling edge by a running program;
s2, after the CEC signal is received by the IO port, disabling the IO port and reading the level of the IO port, and when the IO port is at a low level, starting a timer of the MCU unit and timing for 3.7 +/-0.2 ms;
s3, when the timer is up, reading the level of the IO port, and if the level is high, reading the CEC data and the data of the EOM and the ACK bit;
s4, after the CEC data are read, registering the IO port of the MCU unit connected with the CEC signal line as a port of a bidirectional open circuit mode again through the running program;
s5, setting the IO port to be low level, timing a timer of the MCU unit for 3.7 +/-0.2 ms, pulling up the level of the IO port when the timer is up, and sending a CEC starting signal;
s6, timing the timer for 1.5 plus or minus 0.2ms and pulling down the level of the IO port, timing the timer for 0.9 plus or minus 0.2ms after the timer expires, pulling up the level of the IO port and sending a value of 0, or timing the timer for 0.6 plus or minus 0.2ms and pulling down the level of the IO port, timing the timer for 1.8 plus or minus 0.2ms after the timer expires, pulling up the level of the IO port and sending a value of 1.
2. The method for implementing the CEC protocol by IO simulation as claimed in claim 1, wherein: reading the CEC data for multiple times continuously, setting the IO port as an interrupt pin triggered by a falling edge after reading the CEC data once, reading the level of the IO port when the interrupt is triggered each time, and reading the data of the EOM and the ACK bit after the reading of the CEC data for multiple times is finished.
3. The method for implementing the CEC protocol by IO simulation as claimed in claim 2, wherein: the number of reads of the CEC data is 8.
4. A system for realizing CEC protocol by IO simulation is characterized in that: including MCU unit, CEC signal line, HDMI controller, CEC signal line one end is connected with an IO mouth of MCU unit, and the other end is connected with the HDMI controller, the IO mouth is registered as registering the port through the operation procedure, the IO mouth is registered in proper order for receiving the interrupt pin that the falling edge that analyzes the CEC signal triggered and the port that is used for simulating the two-way mode of opening a way that sends the CEC signal, the MCU unit is received by this IO mouth through the control of interrupt and timer and is analyzed and simulate sending the CEC signal.
5. An electronic device, characterized by: comprising a memory for storing a computer program; a processor for implementing the steps of the CEC protocol method by IO simulation as claimed in any of claims 1 to 3 when executing the computer program.
6. A computer-readable storage medium characterized by: the computer readable storage medium has stored therein a computer program which, when executed by a processor, implements the steps of a CEC protocol method implemented by IO simulation as claimed in any of claims 1 to 3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010743078.8A CN112000599A (en) | 2020-07-29 | 2020-07-29 | Method, system, equipment and storage medium for realizing CEC protocol by IO simulation |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010743078.8A CN112000599A (en) | 2020-07-29 | 2020-07-29 | Method, system, equipment and storage medium for realizing CEC protocol by IO simulation |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112000599A true CN112000599A (en) | 2020-11-27 |
Family
ID=73463940
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010743078.8A Pending CN112000599A (en) | 2020-07-29 | 2020-07-29 | Method, system, equipment and storage medium for realizing CEC protocol by IO simulation |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112000599A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101471834A (en) * | 2007-12-27 | 2009-07-01 | 索尼株式会社 | Electronic device and method for controlling the same |
CN101841682A (en) * | 2009-03-16 | 2010-09-22 | 三星电子株式会社 | Handle the Apparatus for () and method therefor of digital interface signal |
CN103188472A (en) * | 2011-12-29 | 2013-07-03 | 美国博通公司 | Controlling HDMI devices via intelligent emulation of consumer electronics control (CEC) protocol |
CN104301650A (en) * | 2013-07-16 | 2015-01-21 | 鸿富锦精密工业(深圳)有限公司 | Signal transmission system |
CN108322798A (en) * | 2018-02-05 | 2018-07-24 | 深圳市兆驰股份有限公司 | A kind of CEC bus monitoring equipments |
-
2020
- 2020-07-29 CN CN202010743078.8A patent/CN112000599A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101471834A (en) * | 2007-12-27 | 2009-07-01 | 索尼株式会社 | Electronic device and method for controlling the same |
CN101841682A (en) * | 2009-03-16 | 2010-09-22 | 三星电子株式会社 | Handle the Apparatus for () and method therefor of digital interface signal |
CN103188472A (en) * | 2011-12-29 | 2013-07-03 | 美国博通公司 | Controlling HDMI devices via intelligent emulation of consumer electronics control (CEC) protocol |
CN104301650A (en) * | 2013-07-16 | 2015-01-21 | 鸿富锦精密工业(深圳)有限公司 | Signal transmission system |
CN108322798A (en) * | 2018-02-05 | 2018-07-24 | 深圳市兆驰股份有限公司 | A kind of CEC bus monitoring equipments |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7987389B2 (en) | System and method for testing sleep and wake functions of computer | |
CN110769319B (en) | Standby wakeup interaction method and device | |
WO2014079267A1 (en) | Automatic test method, device and system for infrared remote control device | |
CN203535460U (en) | High-efficiency pairing intelligent switch system | |
CN112000599A (en) | Method, system, equipment and storage medium for realizing CEC protocol by IO simulation | |
CN109992261A (en) | A kind of voice online programming method and device based on artificial intelligence | |
CN205595062U (en) | Take 4G radio communication's intelligent fender | |
CN204331353U (en) | The control system of intelligent toy | |
CN204305007U (en) | A kind of handheld device infrared communication system | |
CN103517311A (en) | Method and device simulating wireless network | |
CN205405751U (en) | Wireless system of racing to be first to answer a question | |
CN111897584B (en) | Wake-up method and device for voice equipment | |
CN105404422B (en) | Interaction device, the system and method for mutual education are carried out based on near-field communication | |
CN211427532U (en) | Programmable voice intelligent teaching aid | |
CN207966177U (en) | Network self-adapting remote control | |
CN113778931A (en) | Method, system, terminal and storage medium for realizing SMI protocol through IO simulation | |
CN113079368A (en) | Video fluency detection method and device, terminal device and storage medium | |
CN206908809U (en) | A kind of intelligent sound box of telling time | |
CN111145602A (en) | Programmable voice intelligent teaching aid | |
CN206613137U (en) | A kind of exercise data tape deck with adsorption magnetic charging connector | |
CN108490757A (en) | For the independent voice formula Intelligent timer and its working method of green wisdom building | |
CN203882395U (en) | Responder based on ZigBee wireless network | |
CN204557826U (en) | The extendible point-of-reading system based on smart machine of a kind of content | |
CN112565737B (en) | Networking control method for three-dimensional display | |
CN109976267B (en) | Intelligent education housekeeper 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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20201127 |