Background
Currently, with the different demands of consumer groups, the customization of electronic products has become diversified. In the production of these diversified electronic products, the money cost and time cost required for customization are increasing according to the different characteristics of the electronic products. In order to save the cost, electronic products of various models adopt the same hardware and production flow through compatible design, and then diversification of the electronic products is realized through a software parameter configuration mode according to the requirement.
The existing parameter configuration schemes include the following:
first, a signal interface is configured on the electronic device, and the read-write device communicates with the electronic device through the signal interface to write in the configuration parameters. Fig. 1 shows that the electronic device is connected to an external power source through a power line and connected to the read-write device through a signal line, and a signal written in the read-write device in the electronic device is sent to the MCU after signal processing.
In the second type, a module for wireless communication is arranged on the electronic device, and the read-write device writes the configuration parameters into the electronic device by means of radio waves or light. Fig. 2 shows that the electronic device is connected to an external power source through a power line, a wireless communication module is provided in the electronic device to implement communication between the read-write device and the electronic device, and the wireless communication module transmits a received signal to the MCU.
The disadvantages of using the two methods are:
1. structural design of the electronic device needs special consideration, for example, a first wired communication mode needs to configure a signal interface on the electronic device; in the second wireless communication method, transmission of radio waves or light needs to be considered, and an antenna or a window for light transmission needs to be reserved in the structure of the electronic device.
2. The cost is increased, the electronic equipment has larger size, for example, in the first wired communication mode, a signal processing circuit needs to be configured, components are added, and the position of the signal processing circuit needs to be reserved in the electronic equipment; in the second wireless communication mode, a wireless module needs to be configured, and a position for arranging the wireless module needs to be reserved in the electronic device.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a method for communication through a power line without a signal line, so as to be convenient for configuring parameters and reduce the cost of electronic equipment.
The invention is realized by the following technical scheme:
a method for communicating through the power cord, is used in between electronic equipment and read-write equipment, read-write equipment and said electronic equipment connect through the power cord, the said read-write equipment is connected with power cord through the control switch or control switch circuit; the method comprises the following steps:
controlling the control switch or the control switch circuit to switch on or off the power supply branch of the electronic equipment, wherein the electronic equipment stores the on-time when the power supply branch of the electronic equipment is switched on, and the electronic equipment stops working when the power supply branch of the electronic equipment is switched off;
the electronic equipment detects a power-on sequence formed by a plurality of conducting time lengths stored in the electronic equipment, if the power-on sequence accords with a parameter configuration instruction, the electronic equipment executes parameter writing operation, and otherwise, the power-on sequence is not written.
Preferably, the method further comprises: when the power supply branch of the electronic equipment is switched on, the electronic equipment controls a switch or a switching circuit of which the internal load is connected with a power line to switch on or switch off the power supply branch of the internal load, and further feeds back a writing success signal or the working information of the electronic equipment to the reading and writing equipment.
Preferably, the method further comprises: when the power supply branch of the electronic equipment is conducted, the electronic equipment controls the power or resistance of the internal load of the electronic equipment, and feeds back a writing success signal or the working information of the electronic equipment to the read-write equipment.
Preferably, the power line is provided with a current detection device connected with the read-write equipment; and the current value of the load in the electronic equipment is used as a writing success signal or reading working information of the electronic equipment and is fed back to the reading and writing equipment through the current detection device.
Preferably, the writing success signal or the reading electronic device work information is fed back to the reading and writing device in the form of a light source in the electronic device or a light source externally connected between a power line and the reading and writing device.
Preferably, the light source is in an on-off state or brightness or color temperature to identify a writing success signal or read the electronic device operation information.
Preferably, the electronic device controls the resistance of its internal load to be specifically: the electronic equipment controls whether the internal load is connected with the standby load or not so as to change the total resistance value of the internal load.
Preferably, the control switch or the control switch circuit is controlled by the read-write device.
Preferably, the electronic device stores a parameter configuration instruction and a power-on sequence corresponding to the parameter configuration instruction in advance.
Preferably, the step of reading the working information of the electronic equipment and feeding the working information back to the read-write equipment and the step of writing the electronic equipment by the read-write equipment are not in sequence.
The invention has the following beneficial effects:
the invention relates to a method for communicating through a power line, which is used between read-write equipment and electronic equipment, and only utilizes the power line to supply power and communicate without a communication line, a communication interface and a wireless module, and realizes the writing and reading of parameters by the on-off time sequence of the power supply; the device and cost in the electronic equipment are greatly reduced, and the structural design is more flexible.
Detailed Description
The following are specific embodiments of the present invention and are further described with reference to the drawings, but the present invention is not limited to these embodiments.
Fig. 1 and fig. 2 show two parameter configuration manners in the prior art, where an electronic device needs to additionally configure a communication interface or a communication module to communicate with a read-write device to implement reading and writing of parameters. However, the above two methods not only require additional structural design, but also have high cost.
Therefore, the invention provides a method for communication through a power line, which is suitable for the application field with low real-time communication requirement and realizes parameter reading and writing.
Fig. 3 shows a schematic diagram of a connection structure between an electronic device and a read-write device using the method of the present invention. The read-write equipment is connected with the electronic equipment through a power line, and the read-write equipment is connected with the power line through a control switch. The read-write equipment controls the power on and off of the electronic equipment through the control switch. The control switch may also be replaced by a control switch circuit having switching properties, such as a control switch circuit having a switching element.
The method comprises the following steps:
and S1, controlling the control switch or the control switch circuit to switch on or off the power supply branch of the electronic equipment, wherein the electronic equipment stores the on-time when the power supply branch of the electronic equipment is switched on, and the electronic equipment stops working when the power supply branch of the electronic equipment is switched off.
And S2, the electronic equipment detects a power-on sequence formed by a plurality of conduction durations stored in the electronic equipment, if the power-on sequence conforms to a parameter configuration instruction, the electronic equipment executes parameter writing operation, otherwise, the power-on sequence is not written.
Taking fig. 3 as an example, when the control switch controls the power supply branch of the electronic device to be conducted, the electronic device is powered on, the MCUs in the electronic device are powered on to work simultaneously, and start timing, time the power-on state, record the conducting duration, and then the conducting duration is stored by the internal memory; when the power supply branch of the electronic equipment is disconnected, the electronic equipment is powered off, the electronic equipment does not work, the last starting working time is stored in a memory in the electronic equipment, and when the power supply branch of the electronic equipment is switched on next time, the MCU starts timing again and stores the timing to another position in the memory in real time; after the power supply branch of the electronic equipment is switched on or off for multiple times, a power-on sequence formed by multiple on-time duration is stored in the memory. And the MCU checks the sequence stored in the MCU, if the power-on sequence is found to be consistent with the parameter configuration instruction, the electronic equipment executes parameter writing operation, and otherwise, the electronic equipment does not write.
Specifically, the electronic device stores a parameter configuration instruction and a power-on sequence corresponding to the parameter configuration instruction in advance. The memory in the electronic device may store the parameter configuration instruction in correspondence with the power-on sequence in the form of a mapping table. When the MCU checks the sequence, the MCU compares the mapping table, if the power-on sequence corresponds to the parameter configuration instruction, the MCU executes the parameter configuration instruction, and the electronic equipment performs parameter writing operation. In order to avoid the loss of stored data after power failure, the memory can adopt a nonvolatile memory.
In order to determine whether the read/write device successfully writes the parameter, in an embodiment of the method, the method further includes S3, when the power supply branch of the electronic device is turned on, the electronic device controls a switch or a switching circuit of an internal load connection power line to turn on or off the power supply branch of the internal load, so as to feed back a write-success signal to the read/write device (refer to fig. 6). Fig. 5 shows the structure inside the electronic device, the MCU is connected to the power supply line via the MCU power supply, and the MCU is connected to the power supply line via the switch and the load R1. The MCU can control the on-off of the switch to control the on-off of a load power supply branch of the load R1. The switch may also be replaced by a switching circuit having switching properties, such as a switching circuit having a switching element.
As shown in fig. 5, a current detection device connected to the read/write device is disposed on the power line, and the current detection device is disposed on the power line outside the electronic device. The current detection device may be a detection element such as a current sensor. When the switch is adopted in the electronic equipment to switch on or switch off the load power supply branch, the load power supply branch has influence on the current value of the whole output of the electronic equipment on a power line when the load power supply branch is switched on or switched off, the current value detected by the current detection device can be changed, and the reading and writing equipment reads the sequence of current change to determine whether the reading and writing equipment successfully writes the parameters into the electronic equipment. If the read-write equipment end stores the comparison table of the current change sequence corresponding to the write-in parameters, whether the parameters written into the electronic equipment by the read-write equipment are correct can be obtained.
In addition to the feedback signal by current detection, a light source may be provided in the electronic device or may be provided outside the electronic device and connected between the power supply line and the read/write device (see the current detection position in fig. 5). The light source may be an LED light source. The light source identifies a write success signal in a bright off state or brightness or color temperature. If the read-write equipment writes the light source bright parameter into the electronic equipment, the electronic equipment executes the write operation and lights the light source, so that the information is fed back to the read-write equipment, and the read-write equipment knows that the write parameter is successfully written and the write is accurate; if the read-write equipment writes the 'delay' parameter into the electronic equipment, the electronic equipment executes the write operation delay and lights the light source, so that the information is fed back to the read-write equipment, the read-write equipment knows that the write parameter is successfully written, and the light source is only used as an identifier of successful write.
In addition, the signal can also be fed back by changing the size of the load in the electronic equipment. When the power supply branch of the electronic equipment is conducted, the electronic equipment controls the power or resistance of the internal load of the electronic equipment and feeds a writing success signal back to the read-write equipment. When the electronic device is provided with a plurality of power operation modes, the electronic device executes parameter commands, including executing a low-power operation mode and a high-power operation mode, and once the electronic device is executed in different power operation modes, the changed power is used as feedback to inform the read-write device that the parameter configuration is successful or the configuration parameters are accurate. Taking a lamp source as an example, the lamp source is bright in brightness in a high-power operation mode; in the low power mode of operation, the light source is dimmed. The electronic equipment feeds back the accurate signal of the write-in parameter to the read-write equipment through the brightness degree of the lamp source. For the resistance value change situation, the resistance value of the internal load controlled by the electronic device is specifically as follows: the electronic equipment controls whether the internal load is connected with the standby load or not so as to change the total resistance value of the internal load. Taking the lamp source as an example, when a plurality of groups of lamp sources are needed to work, the standby lamp source is lightened on the basis of the original lamp source, and the resistance value of the load supplied by the load power supply branch circuit changes. The electronic equipment feeds back a writing parameter accurate signal to the reading and writing equipment through the number of the lighting sources.
In order to obtain the execution parameter information in the electronic device, in another embodiment of the method, in step S3, when the power supply branch of the electronic device is turned on, the electronic device controls a switch or a switching circuit of an internal load connection power line to turn on or off the power supply branch of the internal load, so as to feed back the read working information of the electronic device to the read-write device. Fig. 5 shows the structure inside the electronic device, the MCU is connected to the power supply line via the MCU power supply, and the MCU is connected to the power supply line via the switch and the load R1. The MCU can control the on-off of the switch to control the on-off of a load power supply branch of the load R1. The switch may also be replaced by a switching circuit having switching properties, such as a switching circuit having a switching element.
As shown in fig. 5, a current detection device connected to the read/write device is disposed on the power line, and the current detection device is disposed on the power line outside the electronic device. The current detection device may be a detection element such as a current sensor. When the load power supply branch is switched on or off by adopting a switch in the electronic equipment, the load power supply branch has influence on the current value of the whole output of the electronic equipment on a power line during switching on or off, the current value detected by the current detection device can be changed, and the read-write equipment reads the current change sequence. When the read-write equipment terminal compares the read current change sequence with the stored comparison table of the current change sequence corresponding to the write-in parameters for reading, the parameter which is written into the electronic equipment by the read-write equipment can be obtained.
In addition to the feedback signal by current detection, a light source may be provided in the electronic device or may be provided outside the electronic device and connected between the power supply line and the read/write device (see the current detection position in fig. 5). The light source may be an LED light source. The light source identifies a write success signal in a bright off state or brightness or color temperature. If the electronic equipment executes the operation of lighting the light source, the read-write equipment knows that the electronic equipment executes a light source 'lighting' instruction through the lighting state of the light source; if the electronic equipment executes the delay operation and lights the light source, the read-write equipment acquires that the light source lighting state is the delay operation by comparing the lighting state of the light source with the comparison table, namely, the electronic equipment executes a delay instruction, wherein the light source is only used as the identifier of the delay instruction.
In addition, the signal can also be fed back by changing the size of the load in the electronic equipment. When the power supply branch of the electronic equipment is conducted, the electronic equipment controls the power or resistance of the internal load of the electronic equipment and feeds back the read working information of the electronic equipment to the read-write equipment. When the electronic device is provided with a plurality of power operation modes, the electronic device executes parameter commands, including executing a low power operation mode and a high power operation mode, and once the electronic device is executed in different power operation modes, the electronic device uses the changed power as feedback to inform the read-write device of which power operation mode is executed. Taking a lamp source as an example, the lamp source is bright in brightness in a high-power operation mode; in the low power mode of operation, the light source is dimmed. The reading equipment knows what kind of instruction operation has been carried out to electronic equipment through the light and dark of lamp source. For the resistance value change situation, the resistance value of the internal load controlled by the electronic device is specifically as follows: the electronic equipment controls whether the internal load is connected with the standby load or not so as to change the total resistance value of the internal load. Taking the lamp source as an example, when a plurality of groups of lamp sources are needed to work, the standby lamp source is lightened on the basis of the original lamp source, and the resistance value of the load supplied by the load power supply branch circuit changes. The reading device performs what kind of instruction operation is performed by the number of lighting of the light sources or the electronic device.
And the step of reading the working information of the electronic equipment and feeding the working information back to the reading and writing equipment and the step of writing the electronic equipment by the reading and writing equipment are not in sequence. The reading may be performed first, and then the other parameters may be written, or the previous parameters may be rewritten.
It will be appreciated by persons skilled in the art that the embodiments of the invention described above and shown in the drawings are given by way of example only and are not limiting of the invention. The objects of the present invention have been fully and effectively accomplished. The functional and structural principles of the present invention have been shown and described in the examples, and any variations or modifications of the embodiments of the present invention may be made without departing from the principles.