Disclosure of Invention
In order to solve the defects in the prior art, the utility model provides a circuit for identifying the type of the switch measuring board card, which selects a logic chip without protocol interaction, and inputs different values to the data input end of the logic chip by selecting and welding the resistor of an external input loop, so that the automatic identification of different types of board cards can be realized by reading the output of the logic chip without manual presetting by an MCU.
The utility model adopts the following technical scheme.
A circuit for identifying a type of a switch card, comprising: the device comprises a board card type welding unit, a parallel input serial output logic unit, an MCU control unit and a constant voltage source;
the board card type welding unit comprises 8 input circuits, one end of each input circuit is connected with the parallel input serial output logic unit, and the other end of each input circuit is connected with the constant voltage source or the ground;
the parallel input serial output logic unit comprises a logic chip and is respectively connected with the board card type welding unit, the MCU control unit and the constant voltage source;
the MCU control unit is respectively connected with the parallel input serial output logic unit and the constant voltage source.
Preferably, each input circuit of the board card type welding unit comprises 2 series resistors, one end of each resistor is connected with the input circuit end of the logic chip, and the other end of each resistor is connected with the constant voltage source or the ground.
Preferably, the resistance of the input circuit of the board card type welding unit adopts a resistance RC0603JR-070RL.
Preferably, the parallel input serial output logic unit further includes an anti-interference capacitor, the constant power supply terminal of the logic chip is grounded through the anti-interference capacitor, and the output enable terminal OutEn of the logic chip is connected to the ground terminal.
Preferably, the logic chip further comprises a Serial data output end SA, a Serial input/parallel input end Serial
And serial data output end SAAnd Serial input/parallel input port Serial->
And the parallel connection is grounded.
Preferably, the logic chip further includes a parallel input data loading end LatchClk, a shift output data clock end ShiftClk, and a data output end QH, and the parallel input data loading end LatchClk, the shift output data clock end ShiftClk, and the data output end QH are respectively connected to the MCU.
Preferably, the logic chip is a 74HC589 chip.
Preferably, the anti-interference capacitor is ceramic capacitor GRM188R71H104KA93D, and the capacitance value is 0.1 mu F.
Preferably, the MCU further includes a first output latch clk, a second output ShiftClk, and a data input QH, and the first output latch clk, the second output ShiftClk, and the data input QH are all connected to the logic chip.
Preferably, the MCU control unit further comprises a constant power supply end and a ground end, and the constant power supply end and the ground end of the MCU control unit are respectively connected with the constant power supply end and the ground end of the logic chip.
Preferably, the MCU control unit further comprises a control chip, and the control chip adopts MK60DN256ZVLQ10.
Preferably, the constant voltage source is a 3.3V voltage source.
Compared with the prior art, the utility model provides a circuit capable of identifying the type of the switching value board, the related circuit has simple structure, only a logic chip is needed to be added on the switching value board to be identified, and according to the type of the board required by an application scene, the welding input resistor is connected to the D0-D7 ends of the input of 74HC589, and the D0-D7 data output by the logic chip is read through three GPIO ports provided by the MCU chip on the switching value board, so that the identification of the type of the board can be realized; the identification circuit occupies little MCU resource, has simple circuit structure, is not limited by interactive protocol, does not need to manually preset the type of the board card, and is simple and reliable;
for the application scene that 8-bit data cannot completely represent the type of the board card, only the number of logic chips and corresponding external input resistors is increased, the increased logic chips are connected in parallel to the control unit through an external loop, so that the type of the board card can be identified by switching on and off, the number of GPIO ports used by the control unit MCU is effectively saved, and the expansion of the type of the board card is realized through a simple and reliable circuit structure.
Detailed Description
In order to make the objects, technical solutions and advantages of the present utility model more apparent, the technical solutions of the present utility model will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present utility model. The embodiments described herein are merely some, but not all embodiments of the utility model. All other embodiments, which can be made by those skilled in the art without making any inventive effort, are within the scope of the present utility model.
As shown in fig. 1, the present utility model provides a circuit for identifying the type of a switching value board card, which comprises a board card type welding unit 1, a parallel input serial output logic unit 2, an MCU control unit 3 and a constant voltage source;
the board card type welding unit 1 comprises 8 input circuits, wherein one end of each input circuit is connected with the parallel input serial output logic unit 2, and the other end of each input circuit is connected with a constant voltage source or grounded;
the parallel input serial output logic unit 2 comprises at least one logic chip, and the parallel input serial output logic unit 2 is respectively connected with the card type welding unit 1, the MCU control unit 3 and the constant voltage source;
the MCU control unit 3 is respectively connected with the parallel input serial output logic unit and the constant voltage source.
Specifically, each input circuit of the board card type welding unit 1 includes 2 series resistors, and one end of each resistor is connected to the input circuit end, and the other end is connected to a constant power supply or ground.
Furthermore, the board card type welding unit 1 can input 0/1 data value to the logic chip of the parallel input serial output logic unit 2, and when one end of the resistor is connected with a constant power supply, the value of the input logic chip is 1; when one end of the resistor is grounded, the value of the input logic chip is 0.
Preferably, the resistance selected by the input circuit is a standard universal resistance RC0603JR-070RL, and the resistance value is 0Q.
The parallel input serial output logic unit 2 also comprises an anti-interference capacitor, and a constant power end of the logic chip is grounded through the anti-interference capacitor to realize a filtering function;
preferably, the logic chip is a 74HC589 chip.
Preferably, the anti-interference capacitor is ceramic capacitor GRM188R71H104KA93D, and the capacitance value is 0.1 mu F.
The logic chip further includes an output enable terminal OutEn, and the output enable terminal OutEn is connected to a ground terminal, i.e., an output fixing enable.
The logic chip also comprises a Serial data output end SA, a Serial input/parallel input end Serial
And Serial data output SA, serial input/parallel input Serial of logic chip>
And is connected to the ground;
the logic chip further comprises a parallel input data loading end LatchClk, a shift output data clock end Shift Clk and a data output end QH, and the parallel input data loading end LatchClk, the shift output data clock end Shift Clk and the data output end QH of the logic chip are all connected to the MCU control unit.
The logic chip also comprises data input ends D0-D7, 8 input circuits of the board card type welding unit are respectively connected with the parallel input serial output logic unit through the data input ends D0-D7, input data are loaded into a data latch area of the logic chip, namely, parallel loading of D0-D7 data is realized, and the data are output through a data output end QH in series;
the MCU control unit 3 further comprises a first output end LatchClk, a second output end Shift Clk and a data input end QH, and the first output end LatchClk, the second output end Shift Clk and the data input end QH are all connected with the logic chip.
The first output terminal LatchClk is powered on to output a low pulse, and the second output terminal Shift Clk can read one data at the data input terminal QH every time a clock pulse is output.
The MCU control unit 3 further comprises a constant power end and a ground end, and the constant power end and the ground end of the MCU control unit 3 are respectively connected with the constant power end and the ground end of the logic chip.
The MCU control unit 3 further comprises a control chip, and the control chip is preferably MK60DN256ZVLQ10.
Wherein, the logic chip and the constant power end of the MCU control unit 3 are connected with a constant voltage source.
Preferably, the constant voltage source is a 3.3V voltage source.
Further, if the type of the board to be identified cannot be completely represented by 8-bit data, the capacity expansion can be achieved by increasing the number of the logic chips 74HC589 in the parallel-in serial-out logic unit 2.
As shown in fig. 2, a schematic circuit structure diagram of identifying the type of the switching value board card after the expansion logic chip is newly added, at this time, the board card type welding unit 1 is newly added with 8 input circuits, and the parallel input serial output logic unit 2 expands and increases 1 74HC589 logic chips; the data loading end LatchClk and the shift output data clock end Shift Clk of the newly added and expanded 74HC589 logic chip can be connected with the original logic chip in parallel and share one clock; the MCU control unit 3 can read the data of the switch board type only by adding a GPIO pin for connecting the data output end QH of the newly added expansion chip, and other structures are not needed to be added.
The working principle of the utility model is as follows:
according to the type of the board card, corresponding 8 paths of input resistors are welded, one end of each resistor is grounded or is constantly powered, and the other end of each resistor is connected with the data input ends D0-D7 of the logic chip;
after power-on, one output end LatchClk of the MCU control unit outputs a low pulse to a logic chip data loading end LatchClk, and D0-D7 data are loaded into a logic chip data latch area;
after the data is stable, an output end Shift Clk of the MCU control unit outputs 8 clock pulses to a data clock end Shift Clk of the logic chip;
and one input end QH of the MCU control unit reads data once at the rising edge of each pulse, so that the automatic identification of the type of the switching value board card is finished, and the support is provided for the switching value on the subsequent processing board card.
Further, the device of the present utility model was described by the following experiment, and 016.1 single boards in the factory were used. Two 74HC589 logic chips are used, which are respectively denoted by 74HC589-1 and 74HC 589-2; the 74HC589-1 data input is denoted as D10-D17, and the 74HC589-2 data input is denoted as D20-D27; the 74HC589-1 data output is denoted as QH1 and the 74HC589-1 data output is denoted as QH2.
As shown in tables 1 and 2:
table 1:
table 2:
as shown in examples of tables 1 and 2, the specific identification method is as follows:
after power-on, the MCU outputs LatchClk low pulse, and at the moment, D10-D17 and D20-D27 are loaded into the logic chip data latch area. D10-D17 and D20-D27 are selectively welded by a board card type welding unit, and the specific steps are as follows:
74HC589-2: one end of the resistor D20-D26 is connected with the ground terminal, the other end is connected with the input ends D0-D6 of the 74HC589-2 chip, and the input value is 0 at the moment; d27 is connected to the constant power supply terminal, and the other end is connected to the input terminal D7 of the 74HC589-2 chip, and the input value is 1 at this time.
74HC589-1: one end of the resistor D10-D14 is connected with the ground end, the other end is connected with the input end D0-D4 of the 74HC589-1 chip, and the input value is 0 at the moment; the D15-D16 is connected with a constant power supply end, the other end is connected with the input ends D5-D6 of the 74HC589-1 chip, and the input value is 1 at the moment; one end of the D17 resistor is connected with the ground terminal, and the other end of the D17 resistor is connected with the input end D7 of the 74HC589-1 chip, and the input value is 0 at the moment.
After 500ms, the MCU sequentially outputs 8 Shift Clk pulses to the 74HC589 logic chip, and reads two data of QH1 and QH2 at the rising edge of each pulse, and reads 16 bits of data in total.
According to the naming rule of the inner plate card of the factory, the read 16-bit data are expressed as follows in sequence:
the single board type is 12 bits in total, the 74HC589-2 chips D20-D27 are taken as 8 high bits (D0 is taken as high bits, D7 is taken as low bits, and the following is also taken), and the 74HC589-1 chips D10-D13 are taken as 4 low bits. The single board type is 2 bits altogether, and 74HC589-1 chips D14-D15 are taken. The data check bits are 2 bits in total, and 74HC589-1 chips D16-D17 are taken.
As shown in tables 1 and 2, D20-D27 and D10-D13 are 0b10000 after being read by MCU, which represents 016 single board; d14 to D15 are 0b01 after being read by the MCU, and represent the welding 1; d16 to D17 are 0b10 after being read by the MCU.
Wherein, after the sum of each two bits of D20-D27 and D10-D15 is added, the two bits after the sum are 0b10, and the two bits are consistent with the D16-D17 in assembly welding, thus indicating that the ID of the single board is correct.
The above only uses one board card of the factory as an illustration of the board card type representation process, and the read data can be freely combined for representation according to different naming rules of board card types of different factories.
Compared with the prior art, the utility model does not need other complex communication protocols, protocols and other constraints in the process of identifying the type of the switch measuring board card, and has simple and reliable circuit structure. And the board card type identification can be realized only by three GPIO ports of the MCU chip, if the capacity is required to be expanded, each 74HC589 logic chip is added, the MCU chip only needs to provide one extra GPIO port, the resources of the MCU chip are rarely occupied, the bus is not occupied, and the extra burden of the MCU is reduced.
Finally, it should be noted that the above embodiments are only for illustrating the technical solution of the present utility model and not for limiting the same, and although the present utility model has been described in detail with reference to the above embodiments, it should be understood by those skilled in the art that: modifications and equivalents may be made to the specific embodiments of the utility model without departing from the spirit and scope of the utility model, which is intended to be covered by the claims.