CN-121984803-A - Automatic coding circuit applied to CAN bus or 485 bus
Abstract
The invention relates to the technical field of communication circuits, in particular to an automatic coding circuit applied to a CAN bus or a 485 bus, which comprises a plurality of communication modules which are connected in series and are connected with each other in a networking mode, wherein each communication module is provided with a transceiver, an operational amplifier, a reference voltage source and an MCU, the in-phase input end of the operational amplifier is connected with a voltage signal of the reference voltage source and an output voltage signal of a previous-stage communication module, the output end of the operational amplifier outputs the voltage signal of the current-stage communication module and transmits the voltage signal to the in-phase input end of a next-stage communication module, the output end of the operational amplifier is electrically connected with the MCU, the MCU is connected with the CAN bus or the 485 bus through the transceiver of the current-stage communication module, and the input end of the operational amplifier of the first-stage communication module is suspended or grounded through a weak pull-down resistor when the network is connected with the MCU. The invention realizes autonomous hardware automatic coding without participation of a host, simplifies the circuit structure, improves coding efficiency and stability, and reduces production and maintenance costs.
Inventors
- ZHONG FAPING
- WANG XIAOLIU
- Peng Minsuan
- GUO JUNTUAN
- TANG HAOYUN
- TIAN BIN
- YU CHANGLE
- LI XIANGXU
- PENG RANHAO
Assignees
- 湖南科霸汽车动力电池有限责任公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260206
Claims (9)
- 1. The automatic coding circuit applied to the CAN bus or the 485 bus is characterized by comprising a plurality of communication modules which are connected in series and are networked, wherein each communication module is provided with a transceiver, an operational amplifier, a reference voltage source and an MCU; The operational amplifier is an in-phase adder, the in-phase input end of the operational amplifier is connected with the voltage signal of the reference voltage source and the output voltage signal of the communication module of the previous stage, the output end of the operational amplifier outputs the voltage signal of the communication module of the current stage and transmits the voltage signal to the in-phase input end of the communication module of the next stage, the output end of the operational amplifier is electrically connected with the ADC sampling IO port of the MCU, and the MCU is electrically connected with the CAN bus or the 485 bus through the transceiver of the communication module of the current stage; when networking, the input end of the operational amplifier of the first-stage communication module is suspended or grounded through a weak pull-down resistor, and the output end of the operational amplifier of the last-stage communication module is suspended.
- 2. The automatic coding circuit applied to the CAN bus or the 485 bus according to claim 1, wherein the non-inverting input end of the operational amplifier is connected with the reference voltage source through a first resistor, and the non-inverting input end of the operational amplifier is connected with the output voltage signal of the communication module of the previous stage through a second resistor; The inverting input end of the operational amplifier is grounded through a third resistor, and the inverting input end of the operational amplifier is also connected with the output end of the operational amplifier through a fourth resistor.
- 3. The automatic encoding circuit applied to the CAN bus or the 485 bus according to claim 2, wherein the first resistor and the second resistor have the same resistance, and the third resistor and the fourth resistor have the same resistance.
- 4. The automatic encoding circuit applied to a CAN bus or 485 bus according to claim 3, wherein the output voltage of the operational amplifier satisfies the formula uout=uin+uref, wherein Uout is the output voltage, uin is the output voltage of the communication module of the previous stage, and Uref is the voltage of the reference voltage source.
- 5. The automatic encoding circuit for CAN bus or 485 bus according to claim 4, wherein the MCU collects the output voltage Uout of the operational amplifier through the ADC sampling IO port, and determines the ID number of the communication module according to the integer multiple relation between the output voltage Uout of the communication module of the previous stage and the voltage Uref of the reference voltage source, and the value of the integer multiple is the value of the corresponding ID number.
- 6. The automatic coding circuit applied to a CAN bus or a 485 bus according to claim 1, wherein the voltage Uref of the reference voltage source is determined according to the maximum node number n required by the CAN bus or the 485 bus networking, and the ADC reference voltage of the MCU is greater than or equal to n times the voltage Uref of the reference voltage source.
- 7. The automatic coding circuit applied to the CAN bus or the 485 bus according to claim 2, wherein the first resistor, the second resistor, the third resistor and the fourth resistor are all 10kΩ -100kΩ, and the first resistor, the second resistor, the third resistor and the fourth resistor are all metal film resistors.
- 8. The automatic coding circuit applied to the CAN bus or the 485 bus according to claim 1, wherein the input offset voltage of the operational amplifier is less than or equal to 1mV, the bandwidth is more than or equal to 100kHz, and the common mode rejection ratio is more than or equal to 80dB.
- 9. The automatic encoding circuit applied to a CAN bus or 485 bus according to claim 1, characterized in that the MCU is configured with an ADC of 12-bit and above resolution.
Description
Automatic coding circuit applied to CAN bus or 485 bus Technical Field The invention relates to the technical field of communication circuits, in particular to an automatic coding circuit applied to a CAN bus or a 485 bus. Background The CAN bus and the 485 bus are both in a two-wire differential bus communication mode, and a plurality of receiving and transmitting nodes CAN be connected to the bus at the same time, so that bus type data transmission is realized. Because the plurality of nodes share bus resources, each receiving and transmitting node needs to have independent ID numbers to realize accurate communication. At present, address coding of each receiving and transmitting node on a CAN bus and a 485 bus on the market mainly has the following problems that firstly, a manual coding mode is adopted, coding efficiency is low, complexity of a production process is increased, coding errors are easy to occur, secondly, a part of automatic coding circuits need a host to participate in control, each slave cannot perform coding simultaneously, the coding needs to be completed sequentially, so that coding time is long, thirdly, in a maintenance stage, a professional manufacturer is required to perform ID number matching when a module is replaced, operation difficulty is high, and flexibility is poor. Therefore, an automatic encoding circuit which does not need to be interfered by a host, can encode all communication modules simultaneously and has a simple and reliable circuit is needed, so that the defects of the existing encoding mode are overcome. Disclosure of Invention The invention aims to provide an automatic coding circuit applied to a CAN bus or a 485 bus, which realizes automatic coding of autonomous hardware without participation of a host, simplifies a circuit structure, improves coding efficiency and stability, and reduces production and maintenance cost. To achieve the purpose, the invention adopts the following technical scheme: An automatic coding circuit applied to a CAN bus or a 485 bus comprises a plurality of communication modules which are connected in series and are networked, wherein each communication module is provided with a transceiver, an operational amplifier, a reference voltage source and an MCU; The operational amplifier is an in-phase adder, the in-phase input end of the operational amplifier is connected with the voltage signal of the reference voltage source and the output voltage signal of the communication module of the previous stage, the output end of the operational amplifier outputs the voltage signal of the communication module of the current stage and transmits the voltage signal to the in-phase input end of the communication module of the next stage, the output end of the operational amplifier is electrically connected with the ADC sampling IO port of the MCU, and the MCU is connected with the CAN bus or the 485 bus through the transceiver of the communication module of the current stage; when networking, the input end of the operational amplifier of the first-stage communication module is suspended or grounded through a weak pull-down resistor, and the output end of the operational amplifier of the last-stage communication module is suspended. Preferably, the non-inverting input end of the operational amplifier is connected with the reference voltage source through a first resistor, and the non-inverting input end of the operational amplifier is connected with the output voltage signal of the communication module of the previous stage through a second resistor; The inverting input end of the operational amplifier is grounded through a third resistor, and the inverting input end of the operational amplifier is also connected with the output end of the operational amplifier through a fourth resistor. Preferably, the first resistor and the second resistor have the same resistance, and the third resistor and the fourth resistor have the same resistance. Preferably, the output voltage of the operational amplifier satisfies a formula uout=uin+uref, where Uout is the output voltage, uin is the output voltage of the communication module of the previous stage, and Uref is the voltage of the reference voltage source. Preferably, the MCU collects the output voltage Uout of the operational amplifier through the ADC sampling IO port, and determines the ID number of the communication module according to the integer multiple relation between the output voltage Uout of the previous stage and the voltage Uref of the reference voltage source, where the value of the integer multiple is the value of the corresponding ID number. Preferably, the voltage Uref of the reference voltage source is determined according to the maximum node number n required by the CAN bus or 485 bus networking, and the ADC reference voltage of the MCU is greater than or equal to n times the voltage Uref of the reference voltage source. Preferably, the resistance ranges of the first resistor, the second resisto