Uart serial communication circuit and output method of voltage zero-crossing signal

By multiplexing the TXD pin in the signal generator and controller of the UART serial communication circuit, the problem of the meter chip being unable to output a voltage zero-crossing signal was solved, and the transmission of the voltage zero-crossing signal was realized, reducing the chip area and cost.

CN115811325BActive Publication Date: 2026-08-04SHENZHEN RENERGY TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN RENERGY TECH
Filing Date
2022-10-31
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

Existing meter chips' UART can only perform data transmission and reception functions, and cannot output a voltage zero-crossing signal without adding extra pins. This results in a separate pin being required for phase sequence detection in three-phase circuits, increasing chip area and cost.

Method used

The signal generator in the UART serial communication circuit samples the three-phase circuit voltage to generate a voltage zero-crossing signal, and the controller controls the data selector to multiplex the TXD pin to send the voltage zero-crossing signal and data frame, thereby realizing the output of the voltage zero-crossing signal.

Benefits of technology

Without adding extra pins, the transmission of zero-crossing voltage signals was achieved, reducing chip area and cost, while ensuring the normal data transmission and reception functions of UART serial communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115811325B_ABST
    Figure CN115811325B_ABST
Patent Text Reader

Abstract

The application discloses a UART serial communication circuit and a voltage zero-crossing signal output method, and relates to the technical field of communication interfaces. The circuit comprises a communication circuit, a data strobe, a controller and a signal generator. The signal generator is connected with the data strobe, the data strobe is used for connecting a sending end, and the communication circuit is used for connecting a receiving end and the data strobe. The signal generator is used for sampling voltage on a three-phase circuit to generate a voltage zero-crossing signal and transmitting the voltage zero-crossing signal to the data strobe. The communication circuit is used for receiving instructions, receiving data or sending data. The controller is used for controlling the data strobe to transmit the voltage zero-crossing signal or the data to be sent to the sending end according to the instructions. The UART serial communication circuit in the application still transmits the voltage zero-crossing signal through the sending end on the basis of guaranteeing normal data receiving and sending, so that a pin does not need to be additionally increased, the area of a first chip applied by the UART serial communication circuit is reduced, and the cost is also reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication interface technology, and in particular to a UART serial communication circuit and a method for outputting a voltage zero-crossing signal. Background Technology

[0002] Common electricity meter chips typically utilize three-phase circuits, where the alternating current (AC) power usually requires a phase difference of 120 degrees between each phase. To maintain this phase difference, phase sequence detection is usually performed on the three-phase circuit. Currently, phase sequence detection generally uses zero-crossing voltage detection. Specifically, the meter chip acquires the voltage across the three-phase circuit, processes it through filtering and amplification to generate a zero-crossing voltage pulse signal, and then the processor uses this signal to determine whether the voltage across the three-phase circuit is normal. Within the meter chip, a Universal Asynchronous Receiver / Transmitter (UART) enables asynchronous communication between two devices.

[0003] However, the UART on the current meter chip can only realize the function of transmitting and receiving data. For the voltage zero-crossing signal generated by the phase sequence detection of the three-phase circuit, the meter chip needs to set up a separate pin for transmission. Summary of the Invention

[0004] This application provides a UART serial communication circuit and a method for outputting a voltage zero-crossing signal, which enables the transmission of a voltage zero-crossing signal by reusing the TXD pin of the meter chip without adding any additional pins, while ensuring normal communication between the meter chip and the microcontroller.

[0005] The technical solution is as follows:

[0006] In a first aspect, a UART serial communication circuit is provided, the UART serial communication circuit comprising: a communication circuit, a data selector, a controller connected to the communication circuit and the data selector, and a signal generator.

[0007] The signal generator is connected to the data selector, the data selector is used to connect to the transmitting end, and the communication circuit is used to connect the receiving end and the data selector.

[0008] The signal generator is used to sample the voltage on the three-phase circuit to generate a voltage zero-crossing signal, and to transmit the voltage zero-crossing signal to the data selector.

[0009] The communication circuit is used to receive a first control command through the receiving end and to generate a data frame to be sent to the data selector.

[0010] The controller is configured to, according to the first control instruction, control the data selector to transmit the voltage zero-crossing signal to the transmitting end, or control the data selector to transmit the data frame to be transmitted generated by the communication circuit to the transmitting end.

[0011] The UART serial communication circuit in this application includes a communication circuit, a data selector, and a controller, as well as a signal generator connected to the data selector. The signal generator samples the voltage on the three-phase circuit to generate a zero-crossing signal and transmits it to the data selector. The communication circuit receives a first control command and a data frame to be transmitted via the receiver RXD. The controller controls the data selector to transmit the zero-crossing signal or the data frame to be transmitted to the transmitter TXD according to the first control command. This scheme uses the controller to obtain the first control command through the communication circuit and controls the data selector to select one data path from multiple channels for transmission. This allows the data selector to multiplex the same transmitter TXD to transmit the zero-crossing signal and the data frame to be transmitted in a time-division multiplexing manner; that is, when a zero-crossing signal needs to be transmitted, the transmitter TXD is used to transmit the zero-crossing signal, and when a data frame to be transmitted needs to be transmitted, the transmitter TXD is used to transmit the data frame. In addition, since the communication circuit is also connected to the receiving end RXD, it can receive the data frame to be stored while transmitting the data frame to be transmitted / voltage zero-crossing signal. Therefore, while ensuring the normal transmission and reception of data by the UART serial communication circuit, it is still possible to transmit the voltage zero-crossing signal through the transmitting end TXD of the UART serial communication circuit. Therefore, there is no need to add an additional pin for transmitting the voltage zero-crossing signal, thus reducing the chip area of ​​the UART serial communication circuit application and reducing the cost.

[0012] In one possible implementation of this application, the communication circuit further includes a storage unit, and the communication circuit is also configured to receive a data receiving instruction through the receiving end, and to forward the data receiving instruction to the controller;

[0013] The controller is also configured to control the communication circuit to receive the data frame to be stored through the receiving end according to the data receiving instruction, and to store the data frame to be stored in the storage unit;

[0014] Accordingly, when the first control command is to instruct the transmission of data, the controller is used to control the communication circuit to read the data frame to be sent from the storage unit and send it to the data selector.

[0015] In one possible implementation of this application, the communication circuit is configured to receive a second control command through the receiving end, and to forward the second control command to the controller.

[0016] The controller is further configured to control the data gate to stop outputting the voltage zero-crossing signal to the transmitting end according to the second control instruction.

[0017] In one possible implementation of this application, when the first control command data selector transmits the voltage zero-crossing signal to the transmitting end, if the controller receives the first control command indicating data transmission, the controller continues to control the data selector to transmit the voltage zero-crossing signal to the transmitting end.

[0018] Until the controller receives a second control instruction, which is used to control the data selector to stop transmitting the voltage zero-crossing signal to the transmitting end, when the controller receives the first control instruction indicating data transmission, the controller controls the data selector to transmit the data frame to be sent.

[0019] In one possible implementation of this application, the communication circuit is further configured to obtain a first verification frame associated with the first control command through the receiving end;

[0020] Specifically, the controller is used to, when the first control instruction is determined to be a valid command based on the first verification frame, control the data selector to transmit the voltage zero-crossing signal to the transmitting end according to the first control instruction, or control the data selector to transmit the data frame to be transmitted generated by the communication circuit to the transmitting end.

[0021] In one possible implementation of this application, the communication circuit includes a receiver and a transmitter, the receiver being connected to the receiving end, and the transmitter being connected to the data selector.

[0022] The UART serial communication circuit also includes a baud rate generator connected to the receiver and / or the transmitter.

[0023] The baud rate generator is used to output a corresponding communication clock signal to the receiver and / or the transmitter according to a pre-configured baud rate;

[0024] The communication clock signal is used to control the rate at which the receiver receives the data frame to be stored and the rate at which the transmitter transmits the data frame to be sent.

[0025] Secondly, a method for outputting a voltage zero-crossing signal is provided. This method is applied to a UART serial communication circuit, which has a receiving end and a transmitting end. The method includes:

[0026] The first control command is received through the receiving terminal;

[0027] According to the first control command, the zero-crossing voltage signal generated by the voltage on the three-phase circuit sampled by the signal generator is transmitted through the transmitting end, or the data frame to be transmitted by the UART serial communication circuit is transmitted through the transmitting end.

[0028] In one possible implementation of this application, the method further includes: receiving a data receiving instruction through the receiving end; receiving the data frame to be stored through the receiving end in response to the data receiving instruction; and storing the data frame to be stored.

[0029] In one possible implementation of this application, the method further includes: receiving a second control instruction through the receiving end, the second control instruction being used to instruct the UART serial communication circuit to stop transmitting the voltage zero-crossing signal through the transmitting end; and stopping the transmission of the voltage zero-crossing signal through the transmitting end in response to the second control instruction.

[0030] Thirdly, an electricity meter chip is provided, the electricity meter chip having a transmitting end and a receiving end, and the electricity meter chip further includes the UART serial communication circuit as described above.

[0031] The transmitting end is connected to the data selector, and the receiving end is connected to the communication circuit.

[0032] It is understood that the beneficial effects of the second and third aspects mentioned above can be found in the relevant descriptions in the first aspect above, and will not be repeated here. Attached Figure Description

[0033] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0034] Figure 1 This is a schematic diagram of the structure of a UART serial communication circuit provided in an embodiment of this application;

[0035] Figure 2 This is a schematic diagram of a communication frame during the communication process of a UART serial communication circuit provided in an embodiment of this application;

[0036] Figure 3 This is a circuit diagram of a UART serial communication circuit for receiving data, provided in an embodiment of this application.

[0037] Figure 4 This is a circuit diagram of a UART serial communication circuit for transmitting data, provided in an embodiment of this application.

[0038] Figure 5 This is a schematic diagram of a method for outputting a voltage zero-crossing signal according to an embodiment of this application;

[0039] Figure 6 This is a circuit diagram of a UART serial communication circuit for transmitting a zero-crossing voltage signal, provided in an embodiment of this application.

[0040] Figure 7 This is a communication flowchart of a UART serial communication circuit provided in an embodiment of this application;

[0041] Figure 8 This is a schematic diagram of the structure of a processing device provided in an embodiment of this application. Detailed Implementation

[0042] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0043] It should be understood that "multiple" as mentioned in this application refers to two or more. In the description of this application, unless otherwise stated, " / " indicates "or," for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist, for example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, to facilitate a clear description of the technical solutions of this application, the terms "first," "second," etc., are used to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first," "second," etc., do not limit the quantity or execution order, and that "first," "second," etc., do not necessarily imply differences.

[0044] Before providing a detailed explanation of the embodiments of this application, the application scenarios of these embodiments will be described first.

[0045] In electricity meter chips, UART is widely used for communication between meter chips and processing devices because it only requires one transmit (TXD) and one receive (RXD) terminal to complete asynchronous communication between two devices. However, in the three-phase circuits used in electricity meter chips, the phase difference of the AC current in a three-phase circuit is 120 degrees. Therefore, the meter chip also needs to perform timing detection of the three-phase voltages. This timing detection is usually based on detecting the three-phase voltage values ​​when the voltage crosses zero. Specifically, the processor processes the zero-crossing signal to determine if the three-phase voltage values ​​are normal. However, the UART on the electricity meter chip only has data transmission and reception functions; to simultaneously implement zero-crossing detection, a separate pin needs to be added.

[0046] In order to add the function of voltage zero crossing detection on the basis of normal UART data transmission and reception of the meter chip, this application provides a UART serial communication circuit, which outputs voltage zero crossing signal through the transmitting end of the UART while ensuring normal data transmission and reception between the meter chip and the processing device. This reduces the additional pins required for voltage zero crossing detection and reduces the area and cost of the meter chip.

[0047] The following is a detailed explanation of a UART serial communication circuit provided in the embodiments of this application.

[0048] Figure 1 This application provides a schematic diagram of a UART serial communication circuit structure. The UART serial communication circuit includes: a communication circuit 101, a data selector 102, a controller 103 connected to the communication circuit 101 and the data selector 102, and a signal generator 104. The signal generator 104 is connected to the data selector 102. The data selector 102 is used to connect to the transmitting end TXD, and the communication circuit 101 is used to connect the receiving end RXD and the data selector 102. The signal generator 104 is used to sample the voltage on the three-phase circuit to generate a voltage zero-crossing signal, and to transmit the voltage zero-crossing signal to the data selector 102. The communication circuit 101 is used to receive a first control command through the receiving end RXD and to generate a data frame to be transmitted. The controller 103 is used to control the data selector 102 to transmit the voltage zero-crossing signal to the transmitting end TXD, or to control the data selector 102 to transmit the data frame to be transmitted generated by the communication circuit 101 to the transmitting end TXD, according to the first control command.

[0049] In one embodiment of this application, the receiving end RXD is connected to the transmitting end of an external device, and the transmitting end TXD is connected to the receiving end of the external device. The external device sends a first control command to the receiving end RXD, and the processor receives a zero-crossing voltage signal or a data frame to be transmitted through the transmitting end TXD. The external device can be a microprocessor, such as a microcontroller, or other devices with data processing capabilities; this is not limited to any particular device.

[0050] In one embodiment of this application, the data selector 102 includes at least two data input terminals. Taking the inclusion of two data input terminals as an example, one data input terminal is connected to the communication circuit 101, and the other data input terminal is connected to the signal generator 104. The data selector 102 also includes two address terminals and one output terminal. Each address terminal corresponds to one data input terminal. The address terminals are connected to the controller 103, and the output terminal is connected to the transmitting terminal TXD.

[0051] As an example, data selector 102 receives data A through one data input terminal and data B through another data input terminal. The channel selection signal sent by controller 103 is transmitted to data selector 102 via the address terminal. When the channel selection signal indicates the transmission of data A, data selector 102 transmits data A to the output terminal; when the channel selection signal indicates the transmission of data B, data selector 102 transmits data B to the output terminal. Specifically, the channel selection signal is used to indicate the address code corresponding to the address terminal, meaning that the transmission of data A or data B can be determined based on the address code.

[0052] In one embodiment of this application, the first control instruction can be either an instruction to transmit a zero-crossing voltage signal or an instruction to transmit data. If the first control instruction is an instruction to transmit a zero-crossing voltage signal, the controller 103 controls the data selector 102 to transmit the zero-crossing voltage signal to the transmitting end TXD; if the first control instruction is an instruction to transmit data, the controller 103 controls the data selector 102 to transmit the data frame to be transmitted generated by the communication circuit 101 to the transmitting end TXD.

[0053] In addition to the communication circuit 101, data selector 102, and controller 103, the UART serial communication circuit in this application also includes a signal generator 104 connected to the data selector 102. The signal generator 104 samples the voltage on the three-phase circuit to generate a zero-crossing signal and transmits it to the data selector 102. The communication circuit 101 receives a first control command and generates a data frame to be transmitted via the receiving end RXD. The controller 103 controls the data selector 102 to transmit the zero-crossing signal or the data frame to be transmitted to the transmitting end TXD according to the first control command. This scheme uses the controller 103 to obtain the first control command through the communication circuit 101 and controls the data selector to select one data path from multiple channels for transmission. This allows the data selector 102 to multiplex the same transmitting end TXD to transmit the zero-crossing signal and the data frame to be transmitted in a time-division multiplexing manner; that is, when a zero-crossing signal needs to be transmitted, the transmitting end TXD is used to transmit the zero-crossing signal, and when a data frame to be transmitted needs to be transmitted, the transmitting end TXD is used to transmit the data frame. In addition, since the communication circuit 101 is also connected to the receiving end RXD, it can receive the data frame to be stored while transmitting the data frame to be transmitted / voltage zero-crossing signal. Therefore, while ensuring the normal transmission and reception of data by the UART serial communication circuit, it is still possible to transmit the voltage zero-crossing signal through the transmitting end TXD of the UART serial communication circuit. Therefore, it is not necessary to add an additional pin for transmitting the voltage zero-crossing signal, thus reducing the chip area of ​​the UART serial communication circuit application and reducing the cost.

[0054] In one embodiment of this application, such as Figure 1 As shown, the communication circuit 101 also includes a storage unit 105. The communication circuit 101 is further configured to receive a data reception command through the receiving end RXD, and to forward the data reception command to the controller 103. The controller 103 is further configured to control the communication circuit 101 to receive a data frame to be stored through the receiving end RXD according to the data reception command, and to store the data frame to be stored in the storage unit 105. It is worth noting that the process of the communication circuit 101 receiving the data frame to be stored can be an independent process, that is, the UART serial communication circuit can receive one or more data frames to be stored independently. Accordingly, when the first control command is to instruct the transmission of data, the controller 103 is configured to control the communication circuit 101 to read the data to be transmitted from the data frame to be transmitted in the storage unit 105 and send it to the data selector 102.

[0055] In another embodiment of this application, the process of the communication circuit 101 receiving the data frame to be stored can also be that after the controller 103 controls the data selector 102 to transmit the voltage zero-crossing signal, the communication circuit 101 receives the data receiving instruction through the receiving end RXD, and the controller 103 controls the communication circuit 101 to receive the data frame to be stored and store it in the storage unit 105.

[0056] The communication circuit 101 receives instructions via the receiving end RXD, such as the transmission voltage zero-crossing signal instruction and data reception instruction in the first control instruction, or other instructions, which are not limited here. Each instruction is a command frame and may also include a check frame. The command frame indicates the corresponding command, and the check frame verifies whether the command frame is valid. For example, the data reception instruction includes command frame 1 and check frame 1. Command frame 1 indicates that data is to be received, that is, the data frame to be stored is to be received from the processing device. Check frame 1 is used to determine whether command frame 1 is valid. As an example, the check frame of the data reception instruction can be at least one first indicator or at least one second indicator. For example, the first indicator can be 0 and the second indicator can be 1. When the check frame is the first indicator, it indicates that the command frame of the data reception instruction is valid, and the communication circuit 101 receives the data frame to be stored via the receiving end RXD; when the check frame is the second indicator, it indicates that the command frame of the data reception instruction is invalid, and the communication circuit 101 does not receive the data frame to be stored.

[0057] It is worth noting that the communication circuit 101 can also send a verification frame associated with the instruction received by the receiving end RXD. For example, if the receiving end RXD receives a first control instruction that indicates data transmission, after sending the data frame to be transmitted, the communication circuit 101 can also send a verification frame associated with the first control instruction to determine whether the first control instruction and the data frame to be transmitted are valid.

[0058] In one embodiment of this application, the communication circuit 101 is used to receive a second control command through the receiving end RXD, and to forward the second control command to the controller 103. The controller 103 is further used to control the data selector 102 to stop outputting a zero-crossing voltage signal to the transmitting end TXD according to the second control command. It is understood that the second control command is an instruction to stop outputting the zero-crossing voltage signal. It is also understood that the communication circuit 101 is used to receive a verification frame A for verifying the validity of the second control command. If the controller 103 determines that the second control command is valid based on the verification frame A, then the controller 103 is further used to control the data selector 102 to stop outputting the zero-crossing voltage signal to the transmitting end TXD according to the second control command. If the controller 103 determines that the second control command is invalid based on the verification frame A, then the controller 103 will not respond to the second control command. Specifically, the controller 103 can control the data selector 102 to stop outputting a zero-crossing voltage signal. This means that the controller 103 sends a channel selection signal to the data selector 102 to trigger the data selector 103 to interrupt the path between it and the signal generator 104, that is, to disconnect the path between the output terminal of the data selector 103 and the data input terminal connected to the signal generator 104.

[0059] In one embodiment of this application, when the data selector 102 transmits a zero-crossing voltage signal to the transmitting end TXD, when the controller 103 receives a first control command indicating data transmission, the controller 103 continues to control the data selector 102 to transmit the zero-crossing voltage signal to the transmitting end TXD. It is understood that during the process of the data selector 102 transmitting the zero-crossing voltage signal to the transmitting end TXD, even if the communication circuit 101 receives a first control command indicating data transmission, the controller 103 will prioritize transmitting the zero-crossing voltage signal until it determines to stop transmitting the zero-crossing voltage signal, at which point it will respond to the first control command to control the data selector 102 to transmit the data frame to be transmitted.

[0060] In one possible implementation of this application, when no voltage zero-crossing signal is currently being transmitted, if the controller 103 receives a control command (e.g., a first control command) via the communication circuit 101 to instruct data transmission, the controller 103 controls the data selector 102 to transmit the data frame to be sent. For example, initially, if the controller 103 receives a control command from the receiving end RXD via the communication circuit 101 instructing the transmission of a voltage zero-crossing signal, then the controller 103 controls the data selector 102 to transmit the voltage zero-crossing signal generated by the signal generator 104 to the transmitting end. During the transmission of the voltage zero-crossing signal, if the controller 103 receives an instruction via the communication circuit 101 to instruct the receiving end RXD to receive one or more data frames, and then stores these one or more data frames in a storage unit. That is, external data can be received synchronously from RXD during the transmission of the voltage zero-crossing signal. During the transmission of the zero-crossing voltage signal, if the controller 103 receives a control command (e.g., a first control command) through the communication circuit 101 to instruct the data selector 102 to continue transmitting the zero-crossing voltage signal generated by the signal generator 104 to the transmitting end, the controller 103 will only respond to the first control command to control the data selector 102 to transmit the data frame to be sent when it is determined that the transmission of the zero-crossing voltage signal will be stopped.

[0061] When controller 103 receives a second control command, which controls data selector 102 to stop transmitting the zero-crossing voltage signal to the transmitting end TXD, then when controller 103 receives a first control command indicating data transmission, controller 103 controls data selector 102 to transmit the data frame to be sent. It can be understood that controller 103 will only control data selector 102 to stop transmitting the zero-crossing voltage signal when it receives a command to stop transmitting the signal. Only when data selector 102 is not transmitting the zero-crossing voltage signal, and when communication circuit 101 receives the first control command indicating data transmission, will controller 103 control data selector 102 to transmit the data frame to be sent.

[0062] In one embodiment of this application, the communication circuit 101 is further configured to acquire a first verification frame associated with the first control command through the receiving end RXD. Specifically, the controller 103 is configured to, when determining that the first control command is a valid command based on the first verification frame, control the data selector 102 to transmit a voltage zero-crossing signal to the transmitting end TXD according to the first control command, or control the data selector 102 to transmit a data frame to be transmitted generated by the communication circuit 101 to the transmitting end TXD.

[0063] It is worth noting that, in the embodiments of this application, when the UART serial communication circuit transmits and receives data, the instructions received by the UART serial communication circuit (data reception instructions and a first control instruction indicating data transmission), the data frame to be transmitted, and the first check frame can be regarded as a single communication frame, such as... Figure 2 The diagram shows the format of a communication frame. Each communication frame includes a command frame (i.e., an instruction), multiple data frames (i.e., data frames to be transmitted), and a check frame (i.e., the first check frame). Specifically, each frame in the communication frame includes 11 bits, which includes a 1-bit start bit, 8 bits of data, a 1-bit check bit, and a 1-bit end bit.

[0064] Since the UART serial communication circuit proposed in this application typically uses passive chips, such as electricity meter chips, the command frame (instruction) is initiated by the processing device (such as a microcontroller) communicating with the electricity meter chip. The 8-bit data in the instruction is the command sent by the microcontroller to the electricity meter chip. The 8-bit data in the data frame is the data that the UART needs to receive or send, and the check frame is used to verify whether the communication is valid.

[0065] As an example, when the communication circuit 101 receives the first control command as an instruction to transmit data through the receiving end RXD, and the controller 103 determines that the first control command is valid according to the first verification frame, the controller 103 controls the data selector 102 to transmit the data frame to be sent stored in the storage unit 105 of the communication circuit 101 to the sending end TXD.

[0066] As another example, when the communication circuit 101 receives the first control command as an indication of transmitting a zero-crossing voltage signal through the receiving end RXD, and the controller 103 determines that the first control command is valid according to the first verification frame, the controller 103 controls the data selector 102 to transmit the zero-crossing voltage signal sent from the signal generator 104 to the transmitting end TXD.

[0067] In one embodiment of this application, such as Figure 1 As shown, the communication circuit 101 also includes a receiver 106 and a transmitter 107. The receiver 106 is connected to the receiving end RXD, and the transmitter 107 is connected to the data selector 102. The UART serial communication circuit also includes a baud rate generator connected to the receiver 106 and / or the transmitter 107. The baud rate generator is used to output a corresponding communication clock signal to the receiver 106 and / or the transmitter 107 according to a pre-configured baud rate. The communication clock signal is used to control the rate at which the receiver 106 receives data frames to be stored and the transmitter 107 transmits data frames to be sent.

[0068] For example, the baud rate generator outputs a communication clock signal corresponding to the pre-configured baud rate to the receiver 106 and the transmitter 107, ensuring that the UART serial communication circuit transmits data at a specific baud rate.

[0069] In one possible embodiment of this application, when the communication circuit 101 receives a data reception command through the receiver RXD, the baud rate generator can be connected only to the receiver 106 and not to the transmitter 107. When the communication circuit 101 receives a first control command through the receiver RXD, the baud rate generator needs to be connected to both the transmitter 107 and the receiver 106.

[0070] In one possible implementation of this application, such as Figure 3 The diagram shows the circuit structure of the UART serial communication circuit's data receiving section. The data receiving section includes a baud rate generator, receiver 106, storage unit 105, and controller 103. It can be understood that, regardless of whether the UART serial communication circuit outputs a zero-crossing signal, receiver 106 continuously checks whether the receiving end RXD has a data receiving command, i.e., whether the receiving end RXD is equal to the start bit. The start bit indicates that the data receiving command has begun transmission. After receiver 106 receives the start bit, it begins receiving data receiving commands and converts the serial format data receiving command into a parallel format. At this time, controller 103 determines whether the check bit and stop bit of the data receiving command are valid. If valid, it continues to receive the data frame to be stored; if the check bit or stop bit is invalid, the current data receiving command is considered invalid, and it waits for the start bit of the next data receiving command.

[0071] After receiving the data frame to be stored, the controller 103 determines whether the first verification frame associated with the data receiving instruction is valid. If it is invalid, the received data receiving instruction and the data frame to be stored are ignored, and the controller waits for the start bit of the next data receiving instruction. If it is valid, the controller 103 controls the storage unit 105 to store the data frame to be stored received this time.

[0072] In one possible implementation of this application, such as Figure 4The diagram shows the circuit structure of the data transmission section of the UART serial communication circuit. The data transmission section includes a baud rate generator, a transmitter 107, a storage unit 105, a data selector 102, and a controller 103. It is worth noting that when a first control command is sent to the UART serial communication circuit to instruct data transmission, a second control command must first be sent to control the data selector 102 to stop transmitting the zero-crossing voltage signal. When the UART serial communication circuit receives the first control command to instruct data transmission, the controller 103 controls the storage unit 105 to send the stored data frame to be transmitted to the transmitter 107. Under the communication clock generated by the baud rate generator 108, the transmitter 107 converts the parallel format data frame to be transmitted into a serial format, adds a start bit, a parity bit, and a stop bit, and transmits it to the data selector 102. The controller 103 then controls the data selector 102 to transmit it to the transmitting end TXD.

[0073] In one possible implementation of this application, two baud rate generators 108 may be included, each connected to a receiver 106 and a transmitter 107, respectively. One generator provides a communication clock signal to the receiver 106, and the other provides a communication clock signal to the transmitter 107. The specific processes for receiving and transmitting data are the same as in the above embodiments and will not be repeated here.

[0074] This application provides a method for outputting a voltage zero-crossing signal, such as... Figure 5 As shown, this method is applied in a UART serial communication circuit, which has a receiver (RXD) and a transmitter (TXD).

[0075] Step 501: The UART serial communication circuit receives the first control command through the receiving end RXD. The first control command indicates the zero-crossing signal of the output voltage.

[0076] Step 502: According to the first control command, the UART serial communication circuit sends the voltage zero-crossing signal generated by the voltage on the three-phase circuit sampled by the signal generator 104 through the transmitting end TXD.

[0077] Step 503: The UART serial communication circuit receives the second control command through the receiving end RXD.

[0078] Step 504: According to the second control command, the UART serial communication circuit stops transmitting the voltage zero-crossing signal generated by the voltage on the three-phase circuit sampled by the TXD signal generator 104.

[0079] like Figure 6The diagram shows the circuit structure for transmitting a zero-crossing voltage signal in a UART serial communication circuit. Signal generator 104 is connected to a three-phase circuit. The voltage input from the three-phase circuit is fed into signal generator 104, which generates a zero-crossing voltage signal and sends it to data selector 102. Data selector 102 transmits the zero-crossing voltage signal through its transmitter TXD.

[0080] In one embodiment of this application, the method provided further includes: a UART serial communication circuit receiving a data reception command through a receiving end RXD; and in response to the data reception command, the UART serial communication circuit receiving a data frame to be stored through the receiving end RXD and storing the data frame to be stored. For example, the controller 103 in the UART serial communication circuit controls the communication circuit 102 to receive the data frame to be stored using the receiving end RXD. It is understood that the UART serial communication circuit receiving the data frame to be stored through the receiving end RXD can be done during the transmission of a voltage zero-crossing signal or during the cessation of the transmission of a voltage zero-crossing signal; this embodiment of the application does not limit this. Specifically, when the data reception command is valid, the UART serial communication circuit receives the data frame to be stored through the receiving end RXD and stores it in the storage unit.

[0081] In one embodiment of this application, the method further includes: the UART serial communication circuit receiving a second control command through the receiving end RXD, the second control command being used to instruct the UART serial communication circuit to stop transmitting a voltage zero-crossing signal through the transmitting end TXD. In response to the second control command, the UART serial communication circuit stops transmitting the voltage zero-crossing signal through the transmitting end TXD.

[0082] In one possible implementation of this application, such as Figure 7This is a flowchart of the UART serial communication circuit during the communication process. The UART serial communication circuit continuously monitors for received commands. Upon receiving a command, it determines whether the command is a first control command indicating a zero-crossing voltage signal. If it is, it receives a check frame and determines the validity of the command based on the check frame. If valid, it transmits the zero-crossing voltage signal to the transmitting end (TXD). If invalid, the UART serial communication circuit continues to monitor for received commands. If it is not a first control command indicating a zero-crossing voltage signal, it determines whether the command is a valid first control command indicating data transmission. If valid, it outputs a data frame to be transmitted. If invalid, it determines whether the command is a valid data reception command. If valid, it receives and stores the data frame to be stored. If invalid, it continues to receive commands, preparing for the next communication.

[0083] When the UART serial communication circuit is continuously transmitting a zero-crossing voltage signal, the UART serial communication circuit determines whether the detected instruction is a second control instruction. If it is, it stops outputting the zero-crossing voltage signal; if not, it determines whether the instruction is a valid data reception instruction. If it is a valid data reception instruction, it receives and stores the data frame to be stored; if it is not a valid data reception instruction, it determines whether the instruction is a valid first control instruction indicating data transmission. Regardless of whether it is a valid first control instruction indicating data transmission, the UART serial communication circuit will continue to output the zero-crossing voltage signal and continuously detect instructions, preparing for the next communication.

[0084] This application provides an electricity meter chip, which has a transmitting end TXD and a receiving end RXD, and also includes the aforementioned UART serial communication circuit. The transmitting end TXD is connected to the data selector 102, and the receiving end RXD is connected to the communication circuit 101.

[0085] Figure 8 This is a schematic diagram of a processing device provided in an embodiment of this application. Figure 8 As shown, the processing device 801 includes: a processor 8011, a memory 8012, and a computer program 8013 stored in the memory 8012 and executable on the processor 8011.

[0086] The processing device 801 can be a general-purpose computer device or a special-purpose computer device. In specific implementations, the processing device 801 can be a desktop computer, a portable computer, a network server, a handheld computer, a mobile phone, a tablet computer, a wireless terminal device, a communication device, or an embedded device. This application embodiment does not limit the type of processing device 801. Those skilled in the art will understand that... Figure 8 This is merely an example of the processing device 801 and does not constitute a limitation on the processing device 801. It may include more or fewer components than shown, or combine certain components, or different components, such as input / output devices, network access devices, etc.

[0087] The processor 8011 can be a Central Processing Unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0088] In some embodiments, memory 8012 may be an internal storage unit of processing device 801, such as a hard disk or memory of processing device 801. In other embodiments, memory 8012 may be an external storage device of processing device 801, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., provided on processing device 801. Furthermore, memory 8012 may include both internal memory 8102 of processing device 801 and external storage devices. Memory 8012 is used to store operating system, applications, boot loader, data, and other programs. Memory 8012 can also be used to temporarily store data that has been output or will be output.

[0089] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0090] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0091] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A UART serial communication circuit, characterized in that, The UART serial communication circuit includes: a communication circuit, a data selector, a controller connected to the communication circuit and the data selector, and a signal generator. The signal generator is connected to the data selector, the data selector is used to connect to the transmitting end, and the communication circuit is used to connect the receiving end and the data selector. The signal generator is used to sample the voltage on the three-phase circuit to generate a voltage zero-crossing signal, and to transmit the voltage zero-crossing signal to the data selector. The communication circuit is used to receive a first control command and generate a data frame to be sent through the receiving end. The controller is configured to, according to the first control instruction, control the data selector to transmit the voltage zero-crossing signal to the transmitting end, or control the data selector to transmit the data frame to be transmitted generated by the communication circuit to the transmitting end; The communication circuit is further configured to receive a second control instruction through the receiving end and forward it to the controller; the controller is further configured to control the data selector to stop outputting the voltage zero-crossing signal to the transmitting end according to the second control instruction; When the data selector transmits the zero-crossing voltage signal to the transmitting end, if the controller receives the first control command indicating data transmission, the controller continues to control the data selector to transmit the zero-crossing voltage signal to the transmitting end. Until the controller receives a second control instruction, which is used to control the data selector to stop transmitting the voltage zero-crossing signal to the transmitting end, when the controller receives the first control instruction indicating data transmission, the controller controls the data selector to transmit the data frame to be sent.

2. The UART serial communication circuit according to claim 1, characterized in that, The communication circuit also includes a storage unit. The communication circuit is also used to receive a data receiving instruction through the receiving end, and to forward the data receiving instruction to the controller; The controller is also configured to control the communication circuit to receive the data frame to be stored through the receiving end according to the data receiving instruction, and to store the data frame to be stored in the storage unit; Accordingly, when the first control command is to instruct the transmission of data, the controller is used to control the communication circuit to read the data frame to be sent from the storage unit and send it to the data selector.

3. The UART serial communication circuit according to claim 1, characterized in that, The communication circuit is also used to obtain the first verification frame associated with the first control command through the receiving end; Specifically, the controller is used to, when the first control instruction is determined to be a valid command based on the first verification frame, control the data selector to transmit the voltage zero-crossing signal to the transmitting end according to the first control instruction, or control the data selector to transmit the data frame to be transmitted generated by the communication circuit to the transmitting end.

4. The UART serial communication circuit according to claim 1, characterized in that, The communication circuit includes a receiver and a transmitter, the receiver being connected to the receiving end, and the transmitter being connected to the data selector. The UART serial communication circuit also includes a baud rate generator connected to the receiver and / or the transmitter. The baud rate generator is used to output a corresponding communication clock signal to the receiver and / or the transmitter according to a pre-configured baud rate; The communication clock signal is used to control the rate at which the receiver receives the data frame to be stored and the rate at which the transmitter sends the data frame to be sent.

5. A method for outputting a voltage zero-crossing signal, characterized in that, The method is applied to the UART serial communication circuit as described in claim 1, wherein the UART serial communication circuit has a receiving end and a transmitting end, and the method includes: The first control command is received through the receiving terminal; According to the first control command, the zero-crossing voltage signal generated by the voltage on the three-phase circuit sampled by the signal generator is sent through the transmitting end, or the data frame to be sent by the UART serial communication circuit is sent through the transmitting end. The receiving end receives a second control command, which instructs the UART serial communication circuit to stop transmitting the zero-crossing voltage signal through the transmitting end. In response to the second control command, the transmission of the voltage zero-crossing signal through the transmitting end is stopped.

6. The method for outputting a voltage zero-crossing signal according to claim 5, characterized in that, The method further includes: The receiving end receives the data receiving instruction. In response to the data receiving instruction, the data frame to be stored is received through the receiving end. Store the data frame to be stored.

7. A meter chip, characterized in that, The meter chip has a transmitting end and a receiving end, and the meter chip further includes a UART serial communication circuit as described in any one of claims 1 to 4. The transmitting end is connected to the data selector, and the receiving end is connected to the communication circuit.