CN105223872B - A kind of electric terminal control panel square-wave generator - Google Patents

A kind of electric terminal control panel square-wave generator Download PDF

Info

Publication number
CN105223872B
CN105223872B CN201510677663.1A CN201510677663A CN105223872B CN 105223872 B CN105223872 B CN 105223872B CN 201510677663 A CN201510677663 A CN 201510677663A CN 105223872 B CN105223872 B CN 105223872B
Authority
CN
China
Prior art keywords
mcu
resistance
counter
pins
frequency
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510677663.1A
Other languages
Chinese (zh)
Other versions
CN105223872A (en
Inventor
陈明
田如海
张波
屠博斌
王红亚
王彬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Zhuoao Polytron Technologies Inc
Original Assignee
Zhejiang Zhuoao Polytron Technologies Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Zhuoao Polytron Technologies Inc filed Critical Zhejiang Zhuoao Polytron Technologies Inc
Priority to CN201510677663.1A priority Critical patent/CN105223872B/en
Publication of CN105223872A publication Critical patent/CN105223872A/en
Application granted granted Critical
Publication of CN105223872B publication Critical patent/CN105223872B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/042Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Oscillators With Electromechanical Resonators (AREA)
  • Electric Clocks (AREA)

Abstract

The present invention relates to a kind of electric terminal control panel square-wave generator, it is characterised in that:Including power module, MCU, frequency output circuitry, display and button inputting circuits and memory cell, wherein power module respectively with MCU, frequency output circuitry, display and button inputting circuits connect with memory cell, frequency output circuitry, display and button inputting circuits and memory cell are connected with MCU, and being comprised at least inside the MCU has the first counter (T1) and the second counter (TA), the clock oscillation input pin (Xin) and clock oscillation output pin (Xou) of the MCU connects external crystal oscillator respectively, so that MCU clock sources come from the external crystal oscillator;The matching upset output pin (T1OUT) of the first counter (T1) of the MCU is connected with frequency output circuitry, and the MCU corrects the output frequency of the matching upset output pin (T1OUT) of the first counter (T1) by " interpolation method ".Compared with prior art, the advantage of the invention is that:Accurately average frequency output can be realized, there is preservation data function again.

Description

A kind of electric terminal control panel square-wave generator
Technical field
The present invention relates to a kind of electric terminal control panel square-wave generator.
Background technology
Function generator currently on the market is numerous in variety, and it is low that price has height to have, from hundreds of yuan to thousands of members, price Square wave, triangular wave and sine wave can occur for cheap function generator, and price is high to be occurred " any ripple ".These functions are sent out Raw device principle is complicated, and the distortion factor is low, but operation is also relative complex, is entirely function richness for appliance terminal control panel tool It is remaining, and volume is too big.
Wherein, judgement of the washing machine control panel to water level height is perceived by frequency, and height of water level gets over high water level Frequency is lower, otherwise height of water level more low water level frequency is higher.Water level sensor of washing machine is according to the strong size of hydraulic pressure, is produced Different induction reactance, and different frequencies and is produced due to the change of induction reactance in stagefrequency shakes loop, referred to as water frequency Rate.Washing machine control panel is only acquired to the average value of water frequency, rather than collection instantaneous value;And washing machine control panel pair The waveform of water frequency input is not required, the distortion factor of waveform is not also required.
Washing machine control panel from design debugging, production and product inspection during all use function generator, so need The function generator quantity wanted is relatively more.In different processes such as design debugging, production and the product inspections of washing machine control panel In, different is required to randomizer operation, such as, it is necessary to accurately test each grade of stagefrequency in debugging process is designed, Can accurately fine tuning frequency to function generator requirement;In process of production, efficient production efficiency is particular about, function is occurred Device requires the quick definite value switching frequency of energy, in order to more succinctly quickly enter production status next time, also to find a function generation Device has definite value frequency to preserve function;Multigroup definite value switching frequency is needed during the examination and test of products.And the function in market is sent out now Raw device can not carry out definite value switching to frequency, can not entering by production requirement " because ground is suitable " in operation also without function is preserved Row change.
The content of the invention
The technical problems to be solved by the invention are to provide a kind of appliance terminal control panel side for above-mentioned prior art Wave producer, the square-wave generator can realize accurately average frequency output, there is preservation data function again.
Technical scheme is used by the present invention solves above-mentioned technical problem:A kind of appliance terminal control panel is occurred with square wave Device, it is characterised in that:Including power module, MCU, frequency output circuitry, display and button inputting circuits and memory cell, wherein Power module is connected with MCU, frequency output circuitry, display and button inputting circuits and memory cell respectively, frequency output circuitry, Display and button inputting circuits and memory cell be connecteds with MCU, and including at least having the first counter and the inside the MCU Two counters, the clock oscillation input pin and clock oscillation output pin of the MCU connect respectively external crystal oscillator, So that MCU clock sources come from the external crystal oscillator;The matching upset output pin and rate-adaptive pacemaker of the first counter of the MCU Circuit connects;
The MCU corrects the output frequency of the matching upset output pin of the first counter, specific side by " interpolation method " Formula is as follows:
First have to carry out the input clock source of the first counter pre- frequency dividing setting:By the input clock source of the first counter Pre- frequency dividing be arranged to fx/1, fx is the frequency of external crystal oscillator;
Computing is carried out to the value of the match registers of the first counter:
N+1=fx/2/object_frequency=fx/2object_frequency, wherein object_frequency Any one frequency for needing to export for appliance terminal control panel;Fx is the frequency of external crystal oscillator;If fx/2object_ Frequency business is:Quotient, remainder are:Remainder, then n value is:N=quotient-1;
Computing is carried out to " interpolation time (t1) ":
T1=(remainder/ (fx/2))/X
=(2remainder/X) * (1/fx)
Wherein fx is the frequency of external crystal oscillator, and X is the number for needing to carry out interpolation in advance in 1 second be manually set, on (1/fx) is the time cycle in the first counter input clock source in formula;And " 2remainder/X " is exactly " interpolation " needs to increase Matching value part, i.e. " interpolation " when the first counter the values of match registers be n+2remainder/X;
When MCU starts, pre- frequency dividing setting is carried out to the input clock source of the first counter;Then interpolation time is calculated respectively The value of the match registers of first counter when " interpolation ", the second counter is initialized as time at equal intervals as the 1/X seconds Matching is interrupted, and when producing matching every the counter of 1/X seconds second and interrupting, an interpolation action is carried out to the first counter, i.e., Now the value of the match registers of the first counter is set in the matching of " n+2remainder/X " and open first counter Disconnected, then the first counter produces matching and interrupted, and the at this moment value recovery of the match registers of the first counter original " n " is simultaneously The first counter match is forbidden to interrupt.
As an improvement, the MCU uses model S3F9498 singlechip chip, the external crystal oscillator uses model 10PPM 8MHz crystal oscillators, the frequency output circuitry include the 6th triode, the 7th triode, the 18th resistance, the 19th electricity Resistance, the 21st resistance, the 23rd resistance, the 3rd electric capacity, the 4th electric capacity and lead-out terminal, wherein, MCU the first counter Matching upset output pin connect the 3rd electric capacity first end, first end, the first end of the 21st resistance of the 3rd electric capacity With the first end of the 23rd resistance, the second end of the 3rd electric capacity and the second end of the 4th electric capacity two with lead-out terminal respectively Pin connects, and the second end of the 21st resistance connects the base stage of the 6th triode, the second end connection of the 23rd resistance the The base stage of seven triodes, the emitter stage of hexode are connected after connecting the 18th resistance with+5V power supplys, the transmitting of the 7th triode Pole is grounded after connecting the 19th resistance, and the colelctor electrode of the colelctor electrode of the 6th triode and the 7th triode connects the of the 4th electric capacity One end.
Improve again, the memory cell uses model 24C02 eeprom chip, the SDA pins of the eeprom chip It is connected with MCU P2.7 pins, the SCL and MCU of eeprom chip P2.6 pins connection.
Improve again, it is described display and button inputting circuits include 4 Digital sum pipes, first switch button, second switch button, 3rd shift knob, the 4th shift knob, first resistor, second resistance, 3rd resistor, the 4th resistance, the 5th resistance, the 6th electricity Resistance, the tenth resistance, the 11st resistance, the 14th resistance, the 15th resistance, the 16th resistance, the 17th resistance, the 20th electricity Resistance, the 22nd resistance, the second triode, the 3rd triode, the 4th triode, the 5th triode, the first diode, the two or two Pole pipe, the 3rd diode and the 4th diode, wherein the P15 after the 1st pin the tenth resistance of connection of 4 Digital sum pipes with MCU draws Pin connects, and is connected after the 2nd pin the 11st resistance of connection of 4 Digital sum pipes with MCU P16 pins, the 3rd of 4 Digital sum pipes draw Pin is connected after connecting the 5th resistance with MCU P13 pins, the P12 after the 4th pin the 6th resistance of connection of 4 Digital sum pipes with MCU Pin connects, and is connected after the 5th pin connection first resistor of 4 Digital sum pipes with MCU P11 pins, the 7th of 4 Digital sum pipes draw Pin is connected after connecting the 4th resistance with MCU P24 pins, with MCU's after the 11st pin connection 3rd resistor of 4 Digital sum pipes P17 pins connect, and are connected after the 10th pin of 4 Digital sum pipes connection second resistance with MCU P18 pins, and the of 4 Digital sum pipes 12 pins connect the colelctor electrode of the second triode, and the 9th pin of 4 Digital sum pipes connects the colelctor electrode of the 3rd triode, 4 Digital sums 8th pin of pipe connects the colelctor electrode of the 4th triode, and the 6th pin of 4 Digital sum pipes connects the colelctor electrode of the 5th triode, the Two triodes, the 3rd triode, the emitter stage of the 4th triode and the 5th triode are all connected with+5V power supplys, the second triode Base stage be connected after connecting the 17th resistance with MCU P21 pins, after the base stage of the 3rd triode the 16th resistance of connection with MCU The connection of P22 pins, the base stage of the 4th triode is connected after connecting the 15th resistance with MCU P9 pins, the 5th triode Base stage is connected after connecting the 14th resistance with MCU P25 pins, the first end connection+5V power supplys of the 20th resistance, the 20th electricity The second end connection MCU of resistance P14 pins, the first end connection MCU of the 5th electric capacity P14 pins, the second end of the 5th electric capacity Ground connection, the first end connection MCU of the 22nd resistance P14 pins, the second end of the 22nd resistance connects first and opened respectively The first end of button, second switch button, the 3rd shift knob and the 4th shift knob is closed, the second end of first switch button connects Connect the positive pole of the first diode, the negative pole connection MCU of the first diode P21 pins, the second end connection of second switch button The positive pole of second diode, the negative pole connection MCU of the second diode P22 pins, the second end connection the of the 3rd shift knob The positive pole of three diodes, the negative pole connection MCU of the 3rd diode P9 pins, the second end connection the four or two of the 4th shift knob The positive pole of pole pipe, the negative pole connection MCU of the 4th diode P25 pins
Compared with prior art, the advantage of the invention is that:Accurately average frequency output can be realized, there is preservation number again According to function;In improvement project, moreover it is possible to flexibly realize that multigroup definite value switches according to production requirement, operationally can be according to production It is required that flexibly realize.
Brief description of the drawings
Fig. 1 is the circuit block diagram of appliance terminal control panel square-wave generator in the embodiment of the present invention;
Fig. 2 is MCU partial circuit schematic diagrams in the embodiment of the present invention;
Fig. 3 is frequency output circuitry schematic diagram in the embodiment of the present invention;
Fig. 4 is display and button inputting circuits schematic diagram in the embodiment of the present invention;
Fig. 5 is storage unit circuit schematic diagram in the embodiment of the present invention;
Fig. 6 is output waveform comparison diagram in the embodiment of the present invention.
Embodiment
The present invention is described in further detail below in conjunction with accompanying drawing embodiment.
Appliance terminal control panel square-wave generator provided by the invention, it includes power module, MCU, rate-adaptive pacemaker electricity Road, display and button inputting circuits and memory cell, wherein power module respectively with MCU, frequency output circuitry, display and button Input circuit is connected with memory cell, and frequency output circuitry, display and button inputting circuits and memory cell are connected with MCU, Referring to shown in figure;And being comprised at least inside the MCU has the first counter (T1) and the second counter (TA), the MCU when Clock oscillating circuit input pin (Xin) and clock oscillation output pin (Xou) connect external crystal oscillator, so that MCU respectively Clock source comes from the external crystal oscillator;The matching upset output pin (T1OUT) and frequency of the first counter (T1) of the MCU are defeated Go out circuit connection.
In the present embodiment, the MCU uses model S3F9498 singlechip chip, and the external crystal oscillator uses model It is shown in Figure 2 for 10PPM 8MHz crystal oscillators;The frequency output circuitry include the 6th triode Q6, the 7th triode Q7, 18th resistance R18, the 19th resistance R19, the 21st resistance R21, the 23rd resistance R23, the 3rd electric capacity C3, the 4th electricity Hold C4 and lead-out terminal CN1, wherein, MCU the first counter T1 electric capacity C3 of matching upset output pin T1OUT connections the 3rd First end, the 21st resistance R21 first end and the 23rd resistance R23 first end, the 3rd electric capacity C3 the second end It is connected respectively with lead-out terminal CN1 two pins with the 4th electric capacity C4 the second end, the 21st resistance R21 the second end connects The 6th triode Q6 base stage is connect, the 23rd resistance R23 the second end connects the 7th triode Q7 base stage, hexode Q6 Emitter stage connect the 18th resistance R18 after be connected with+5V power supplys, the 7th triode Q7 emitter stage the 19th resistance of connection It is grounded after R19, the first end of the 6th triode Q6 colelctor electrode and the 7th triode Q7 colelctor electrode the 4th electric capacity of connection;Referring to Shown in Fig. 3.
The memory cell uses model 24C02 eeprom chip, the SDA pins of the eeprom chip and MCU's P2.7 pins connect, the SCL and MCU of eeprom chip P2.6 pins connection, shown in Figure 5.
It is described display and button inputting circuits include 4 Digital sum pipes, first switch button SW1, second switch button SW2, 3rd shift knob SW3, the 4th shift knob SW4, first resistor R1, second resistance R2,3rd resistor R3, the 4th resistance R4, 5th resistance R5, the 6th resistance R6, the tenth resistance R10, the 11st resistance R11, the 14th resistance R14, the 15th resistance R15, 16th resistance R16, the 17th resistance R17, the 20th resistance R20, the 22nd resistance R22, the second triode Q2, the three or three Pole pipe Q3, the 4th triode Q4, the 5th triode Q5, the first diode D1, the second diode D2, the 3rd diode D3 and the 4th Diode D4, wherein the 1st pin of 4 Digital sum pipes is connected after connecting the tenth resistance with MCU P15 pins, the of 4 Digital sum pipes 2 pins be connecteds after connecting the 11st resistance with MCU P16 pins, after the 3rd pin of 4 Digital sum pipes the 5th resistance of connection with MCU The connection of P13 pins, the 4th pin of 4 Digital sum pipes is connected after connecting the 6th resistance with MCU P12 pins, 4 Digital sum pipes Be connected after 5th pin connection first resistor with MCU P11 pins, after the 7th pin of 4 Digital sum pipes the 4th resistance of connection with MCU P24 pins connection, 4 Digital sum pipes the 11st pin connection 3rd resistor after be connected with MCU P17 pins, 4 Digital sum pipes It is connected after 10th pin connection second resistance with MCU P18 pins, the 12nd pin of 4 Digital sum pipes connects the second triode Colelctor electrode, the 9th pin of 4 Digital sum pipes connect the colelctor electrode of the 3rd triode, the 8th pin connection the four or three of 4 Digital sum pipes The colelctor electrode of pole pipe, the 6th pin of 4 Digital sum pipes connect the colelctor electrode of the 5th triode, the second triode, the 3rd triode, The emitter stage of 4th triode and the 5th triode is all connected with+5V power supplys, after the base stage of the second triode connects the 17th resistance It is connected, is connected after base stage the 16th resistance of connection of the 3rd triode with MCU P22 pins, the four or three with MCU P21 pins The base stage of pole pipe is connected after connecting the 15th resistance with MCU P9 pins, after base stage the 14th resistance of connection of the 5th triode It is connected with MCU P25 pins, the first end connection+5V power supplys of the 20th resistance, the second end connection MCU's of the 20th resistance P14 pins, the first end connection MCU of the 5th electric capacity P14 pins, the second end ground connection of the 5th electric capacity, the 22nd resistance First end connects MCU P14 pins, the second end of the 22nd resistance connect respectively first switch button, second switch button, The first end of 3rd shift knob and the 4th shift knob, the second end of first switch button connect the positive pole of the first diode, The negative pole connection MCU of first diode P21 pins, the second end of second switch button connect the positive pole of the second diode, the The negative pole connection MCU of two diodes P22 pins, the positive pole of the 3rd diode of the second end connection of the 3rd shift knob, the 3rd The negative pole connection MCU of diode P9 pins, the second end of the 4th shift knob connects the positive pole of the 4th diode, the four or two pole The negative pole connection MCU of pipe P25 pins, it is shown in Figure 4.
For the present invention in order to realize accurately average frequency output, MCU corrects the first counter T1 by " interpolation method " Output frequency with upset output pin T1OUT, concrete mode are as follows:
First have to carry out the first counter T1 input clock source pre- frequency dividing setting:During by the first counter T1 input Zhong Yuan pre- frequency dividing is arranged to fx/1, and fx is the frequency of external crystal oscillator;
Computing is carried out to the first counter T1 match registers T1DATA value n:
N+1=fx/2/object_frequency=fx/2object_frequency, wherein object_frequency Any one frequency for needing to export for appliance terminal control panel;Fx is the frequency of external crystal oscillator;If fx/2object_ Frequency business is:Quotient, remainder are:Remainder, then n value is:N=quotient-1;
To " interpolation time t1 " carries out computing:
T1=(remainder/ (fx/2))/X
=(2remainder/X) * (1/fx)
Wherein fx is the frequency of external crystal oscillator, and X is the number for needing to carry out interpolation in advance in 1 second be manually set, on (1/fx) is the time cycle in the first counter T1 input clocks source in formula;And " 2remainder/X " is exactly " interpolation " needs to increase The value of the first counter T1 match registers is during the matching value part, i.e. " interpolation " added:n+2remainder/X;
When MCU starts, pre- frequency dividing setting is carried out to the first counter T1 input clock source;When then calculating interpolation respectively Between t1 and when " interpolation " the first counter T1 match registers value, the second counter TA is initialized as into the time at equal intervals is The matching of 1/X seconds is interrupted, and when producing matching every 1/X seconds the second counter TA and interrupting, the first counter is once inserted Value acts, i.e., the value of the match registers of the first counter now is set into " n+2remainder/X " and open first counter Matching interrupt, then the first counter produces matching and interrupted, and at this moment the value of the match registers of the first counter is recovered former Come " n " and forbid the first counter match interrupt.
Understand for the ease of auditor, below according in the present embodiment, " interpolation method " is explained in detail and described:
8MHz crystal oscillator of the MCU clock source from 10PPM, there is high-precision clock source, can just export high-precision Average frequency, square wave output are exported using " T1OUT " PIN, and by internal, the first counter T1 --- 16 digit counters are done Matching upset output, i.e., when T1 counters, from 0 to start counting up value to the match registers T1DATA with the first counter equal When, a matched signal is produced, at this moment the first counter T1 is cleared, the upset output of " T1OUT " PIN level.T1 counters Clock source come from single-chip microcomputer external crystal-controlled oscillation, that is, the first counter T1 clock source maximum is exactly 8MHz, and first counts The match registers T1DATA of device value also can only be natural number n, according to providing the defeated of T1OUT " PINs in MCU specifications The formula for going out instantaneous square wave frequency is 8MHz/ (n+1)/2, as n=0,8MHz/ (0+1)/2=4MHz;When n is respectively 1,2, 3rd, 4 when, output frequency corresponding to T1OUT " PINs is 2MHz, 1MHz, 500KHz, 250KHz respectively;Single-chip microcomputer is not as can be seen here The instantaneous frequency (can not such as export the frequency between 499KHz~251KHz) of energy output linearity, washing machine water frequency range 18K Between~45K, that is to say, that the requirement of water frequency is probably any one value between 18K~45K.It is worth mentioning that laundry Machine control board test is average frequency, is not instantaneous frequency, so in the present embodiment, single-chip microcomputer is using " interpolation method " amendment the The output frequency of the matching upset output pin (T1OUT) of one counter (T1), export what user wanted so as to realize easily Average frequency.
Assuming that the frequency of any output is object_frequency, we calculate the frequency nearest with target frequency first The matching value of rate, the n in 8MHz/ (n+1)/2 is changed into floating number y, makes 8MHz/ (y+1)/2=object_frequency, that Our cans calculate Y value:
Y=8MHz/2/object_frequency-1
=4MHz/object_frequency-1
Y decimal points part is removed, is exactly the matching value n closest to target frequency that we want.Drawn with matching value n The instantaneous frequency come can be higher than target frequency object_frequency, to expect accurate average frequency, just necessary Timing causes one of level to become wider.As shown in fig. 6, before not adding interpolation, and the ripple that matching value is fixed when being n The shape cycle is T entirely, and after adding interpolation t1, some square-wave cycles increase, and become T+t1;It is assumed that our artificial settings 1 second Clock enters row interpolation 250 times, that is, 4ms interpolation is once, and t1 is possible to be inserted on high level, it is also possible to is inserted into low electricity On flat.Assuming that y=n+x;That is x is y fractional part.So we can draw another equation:
8MHz/ (n+x+1)/2=object_frequency
After developing step by step:
=object_frequency is 1. by 4MHz/ (x+ (n+1))
(x+ (n+1))/4MHz=1/object_frequency is 2.
(x/4MHz)+((n+1)/4MHz)=1/object_frequency is 3.
((x/4MHz)+((n+1)/4MHz)) * object_frequency=1s are 4.
(x*object_frequency/4MHz)+((n+1) * object_frequency/4MHz)= 1s·······⑤
Equation 3. in " ((n+1)/4MHz) " be exactly time cycle " T " in Fig. 6, and equation 5. in
" (x*object_frequency/4MHz) " is exactly the time of required compensation in 1S (1 second);Due to this time It is divided into 250 times to compensate, so the interpolation time t1 in Fig. 3 is:
T1=(x*object_frequency/4MHz)/250 is 6.
" interpolation method " first step:We use the first counter T1 --- and the counter of 16 does matching output, first has to The pre- frequency dividing in the first counter T1 input clocks source is configured, it is assumed that pre- frequency dividing be fx/1 (fx is crystal oscillator frequency --- 8MHz), that is to say, that T1 counter input clocks source is exactly 8MHz.We again relax water frequency range 18K~45K, relax To 8K~55K, it is 8MHz/ (n+1)/2=8KHz to seek matching value corresponding to 8K;
N=8MHz/2/8KHz-1=499;It is n=8Mhz/2/55KHz-1=71 (71.727 to seek matching value corresponding to 55K Round);Require that the frequency of output is higher as can be seen here, corresponding matching value requires that the frequency of output is lower with regard to smaller, phase The matching value answered is bigger.The match registers T1DATA of first counter is 16 bit registers, so maximum matching value can not More than (216- 1) (65535), when exporting 8K~55K frequency ranges, corresponding maximum matching value is 499, far smaller than 65535, institute With the first counter T1 --- the pre- frequency dividing in 16 digit counter input clock sources directly selects fx/1 hypothesis to set up, so pre- frequency dividing Be arranged to fx/1;
" interpolation method " second step:Matching value n computing, for arbitrarily exporting a frequency object_frequency, that N computing formula is:
N+1=8MHz/2/object_frequency
=4MHz/object_frequency
If 4MHz/object_frequency business is:Quotient, remainder are:Remainder, then n value is:n =quotient-1;
" interpolation method " the 3rd step:The computing of " interpolation time ", actual remainder here be exactly formula 6. in " x* Object_frequency ", so 6. formula can be rewritten into:
T1=(x*object_frequency/4MHz)/250
=(remainder/4MHz)/250
=(remainder/125)/8MHz
=(remainder/125) * (1/8MHz)
Here " 1/8MHz " is exactly the time cycle in the first counter T1 input clock source, and " remainder/125 " It is exactly that " interpolation " needs increased matching value part, then matching value corresponding to " interpolation " is:n+remainder/125.
When single-chip microcomputer starts, initialization the first counter T1 divide in advance set fx/1 (fx is crystal oscillator frequency --- 8MHz);The matching value n+ as corresponding to the frequency and foregoing description method of initialization output calculate matching value n and " interpolation " Remainder/125, the second counter TA is set to interpolation counter, i.e., the second counter device is initialized as the time at equal intervals 4ms is interrupted, every 4ms --- and when the second counter TA produces interruption, an interpolation action is carried out, i.e., now opens the first meter Number device T1 matching is interrupted, and is sent the result of " n+remainder/125 " in the match registers T1DATA of the first counter, N is replaced as after the first counter T1 generation matching interruptions, then by the first counter T1 match registers TADATA value, and The first counter T1 matching is forbidden to interrupt, until the first counter T1 matching next time is interrupted and opened.Zhou Erfu like this Beginning draws accurately average frequency, is tested through oscillograph, and the precision of frequency was up to for 0.2 ‰ (error is less than 0.2 ‰).
Present invention is mainly used for the use of washing machine and associated appliance terminal on stream.Display in the present invention and Button inputting circuits, due to using 4 Digital sum pipe display frequencies, precision is 0.2 ‰, therefore frequency may be only accurate to ten, institute Using the unit of 4 Digital sum pipe display datas as 10Hz, if 4 Digital sum pipes are shown as " ABCD ", then " AB.CD " KHz is read.The present invention When switching on power, in holding state (charactron is not shown), without rate-adaptive pacemaker.In stand-by mode, directly " SW1 " is pressed Start freedom of entry rate-adaptive pacemaker pattern, the frequency 26.70KHz of numeral method original state, and export corresponding frequencies.Certainly By under rate-adaptive pacemaker pattern, press " SW1 " can realize with the speed increase frequency of " 10Hz " (click the key, can be from 26.70KHz increases to 26.71KHz, always according to the key more than 1 second when, can be with the speed increase of 0.16 second);When pressing When " SW2 ", it is possible to achieve with the decrease of speed frequency of " 10Hz " (click the key, 26.69KHz can be reduced to from 26.70KHz, , can be with the decrease of speed of 0.16 second always according to the key more than 1 second);It can be realized with the rate delivery of " 1KHz " when pressing " SW3 " Increase frequency (click the key, 27.70KHz can be increased to from 26.70KHz, can be with 0.16 second always according to the key more than 1 second Speed increase);When pressing " SW4 ", it is possible to achieve with the decrease of speed frequency of " 1KHz " (click the key, can be from 26.70KHz is reduced to 25.70KHz, can be with the decrease of speed of 0.16 second always according to the key more than 1 second).When button is operating Afterwards, display can change immediately, and output frequency can also change therewith.Operation can realize the optional frequency between 8K~55K according to this Output.When pressing " SW1 " and " SW2 " simultaneously under open state, the present invention comes back to holding state.
The present invention first pins " SW2 " key in the standby state, then presses " SW1 " and enter production model afterwards.In production model Data can set 10 groups of data, every group of 3 data.When pressing " SW4 ", which group data display is currently;Press " SW1 " When, first data of the group can be recalled;When pressing " SW2 ", second data of the group can be recalled;When pressing " SW3 ", it can adjust Go out the 3rd data of the group.When first pinning " SW3 " not put, then pressing " SW4 ", which can select organize data.Certain is selected again organizes certain After individual data, for example after first data of certain group, Chang'an " SW1 " three seconds, the setting of first data of the group can be activated, After setting is activated, charactron flicker, at this moment we can be configured to this data again, and setting up procedure is just as opening The method can that frequency modulation rate is the same during hair changes the frequency to be set, and is set when button does not operate 3 seconds backed off after random data Configuration state simultaneously preserves data.With the setting of same method long-press " SW2 " key second data of activation in 3 seconds;Long-press " SW3 " key 3 The setting of the 3rd data of second activation.In production model, " SW1 " and " SW2 " can be pressed simultaneously can exit production model and Enter holding state.

Claims (4)

  1. A kind of 1. electric terminal control panel square-wave generator, it is characterised in that:Including power module, MCU, rate-adaptive pacemaker electricity Road, display and button inputting circuits and memory cell, wherein power module respectively with MCU, frequency output circuitry, display and button Input circuit is connected with memory cell, and frequency output circuitry, display and button inputting circuits and memory cell are connected with MCU, And being comprised at least inside the MCU has the first counter (T1) and the second counter (TA), the clock oscillation of the MCU is defeated Enter pin (Xin) and clock oscillation output pin (Xou) connects external crystal oscillator, so that MCU clock sources come from this respectively External crystal oscillator;The matching upset output pin (T1OUT) of the first counter (T1) of the MCU is connected with frequency output circuitry;
    The MCU corrects the output frequency of the matching upset output pin (T1OUT) of the first counter (T1) by " interpolation method ", Concrete mode is as follows:
    First have to carry out the input clock source of the first counter (T1) pre- frequency dividing setting:During by the input of the first counter (T1) Zhong Yuan pre- frequency dividing is arranged to fx/1, and fx is the frequency of external crystal oscillator;
    Computing is carried out to the value n of the first counter (T1) match registers (T1DATA):
    N+1=fx/2/object_frequency=fx/2object_frequency, wherein object_frequency are electricity Gas terminal control plate needs any one frequency exported;Fx is the frequency of external crystal oscillator;If fx/2object_frequency Business be:Quotient, remainder are:Remainder, then n value is:N=quotient-1;
    To " interpolation time t1 " carries out computing:
    T1=(remainder/ (fx/2))/X
    =(2remainder/X) * (1/fx)
    Wherein fx is the frequency of external crystal oscillator, and X is the number for needing to carry out interpolation in advance in be manually set 1 second, in above formula (1/fx) is the time cycle in the first counter (T1) input clock source;And " 2remainder/X " is exactly " interpolation " needs to increase Matching value part, i.e. " interpolation " when the first counter (T1) the values of match registers be:n+2remainder/X;
    When MCU starts, pre- frequency dividing setting is carried out to the input clock source of the first counter (T1);Then interpolation time is calculated respectively The value of the match registers of the first counter (T1), the time at equal intervals is initialized as by the second counter (TA) when t1 and " interpolation " Interrupted for the matching of 1/X seconds, when producing matching every the counter of 1/X seconds second (TA) and interrupting, one is carried out to the first counter Secondary interpolation action, i.e., the value of the match registers of the first counter is now set to " n+2remainder/X " and open first meter The matching of number device is interrupted, and then the first counter produces matching and interrupted, and at this moment the value of the match registers of the first counter is recovered " n " originally and the first counter match is forbidden to interrupt.
  2. 2. electric terminal control panel square-wave generator according to claim 1, it is characterised in that:The MCU uses type Number singlechip chip for being S3F9498, the external crystal oscillator use model 10PPM 8MHz crystal oscillators, rate-adaptive pacemaker electricity Road includes the 6th triode (Q6), the 7th triode (Q7), the 18th resistance (R18), the 19th resistance (R19), the 21st Resistance (R21), the 23rd resistance (R23), the 3rd electric capacity (C3), the 4th electric capacity (C4) and lead-out terminal (CN1), wherein, MCU The first counter (T1) matching upset output pin (T1OUT) connect the 3rd electric capacity (C3) first end, the 21st electricity Hinder the first end of (R21) and the first end of the 23rd resistance (R23), the second end of the 3rd electric capacity (C3) and the 4th electric capacity (C4) The second end be connected respectively with two pins of lead-out terminal (CN1), the second end of the 21st resistance (R21) connection the six or three The base stage of pole pipe (Q6), the second end of the 23rd resistance (R23) connect the base stage of the 7th triode (Q7), hexode (Q6) Emitter stage connect the 18th resistance (R18) and be connected afterwards with+5V power supplys, the emitter stage of the 7th triode (Q7) connection the 19th is electric Resistance (R19) is grounded afterwards, and the colelctor electrode of the 6th triode (Q6) and the colelctor electrode of the 7th triode (Q7) connect the 4th electric capacity (C4) First end.
  3. 3. electric terminal control panel square-wave generator according to claim 2, it is characterised in that:The memory cell is adopted With model 24C02 eeprom chip, the SDA pins of the eeprom chip and MCU P2.7 pins connect, eeprom chip SCL and MCU P2.6 pins connect.
  4. 4. electric terminal control panel square-wave generator according to claim 2, it is characterised in that:The display and button Input circuit includes 4 Digital sum pipes, first switch button, second switch button, the 3rd shift knob, the 4th shift knob, the One resistance, second resistance, 3rd resistor, the 4th resistance, the 5th resistance, the 6th resistance, the tenth resistance, the 11st resistance, the tenth Four resistance, the 15th resistance, the 16th resistance, the 17th resistance, the 20th resistance, the 22nd resistance, the second triode, Three triodes, the 4th triode, the 5th triode, the first diode, the second diode, the 3rd diode and the 4th diode, 1st pin of wherein 4 Digital sum pipes is connected after connecting the tenth resistance with MCU P15 pins, the 2nd pin connection of 4 Digital sum pipes It is connected after 11st resistance with MCU P16 pins, the P13 pins after the 3rd pin the 5th resistance of connection of 4 Digital sum pipes with MCU Connect, be connected after the 4th pin the 6th resistance of connection of 4 Digital sum pipes with MCU P12 pins, the 5th pin of 4 Digital sum pipes connects It is connected after connecing first resistor with MCU P11 pins, the P24 pins after the 7th pin the 4th resistance of connection of 4 Digital sum pipes with MCU Connect, be connected after the 11st pin connection 3rd resistor of 4 Digital sum pipes with MCU P17 pins, the 10th pin of 4 Digital sum pipes It is connected after connection second resistance with MCU P18 pins, the colelctor electrode of the 12nd pin the second triode of connection of 4 Digital sum pipes, 4 9th pin of Digital sum pipe connects the colelctor electrode of the 3rd triode, and the 8th pin of 4 Digital sum pipes connects the collection of the 4th triode Electrode, the 6th pin of 4 Digital sum pipes connect the colelctor electrode of the 5th triode, the second triode, the 3rd triode, the four or three pole The emitter stage of pipe and the 5th triode is all connected with+5V power supplys, and the base stage of the second triode is connected after the 17th resistance with MCU's P21 pins connect, and are connected after base stage the 16th resistance of connection of the 3rd triode with MCU P22 pins, the base of the 4th triode Pole is connected after connecting the 15th resistance with MCU P9 pins, with MCU's after base stage the 14th resistance of connection of the 5th triode P25 pins connect, the first end connection+5V power supplys of the 20th resistance, the second end connection MCU of the 20th resistance P14 pins, The first end connection MCU of 5th electric capacity P14 pins, the second end ground connection of the 5th electric capacity, the first end of the 22nd resistance connect MCU P14 pins are connect, the second end of the 22nd resistance connects first switch button, second switch button, the 3rd switch respectively The first end of button and the 4th shift knob, the second end of first switch button connect the positive pole of the first diode, the one or two pole The negative pole connection MCU of pipe P21 pins, the second end of second switch button connects the positive pole of the second diode, the second diode Negative pole connection MCU P22 pins, the second end of the 3rd shift knob connects the positive pole of the 3rd diode, the 3rd diode Negative pole connects MCU P9 pins, and the second end of the 4th shift knob connects the positive pole of the 4th diode, the negative pole of the 4th diode Connect MCU P25 pins.
CN201510677663.1A 2015-10-19 2015-10-19 A kind of electric terminal control panel square-wave generator Active CN105223872B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510677663.1A CN105223872B (en) 2015-10-19 2015-10-19 A kind of electric terminal control panel square-wave generator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510677663.1A CN105223872B (en) 2015-10-19 2015-10-19 A kind of electric terminal control panel square-wave generator

Publications (2)

Publication Number Publication Date
CN105223872A CN105223872A (en) 2016-01-06
CN105223872B true CN105223872B (en) 2017-12-08

Family

ID=54992907

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510677663.1A Active CN105223872B (en) 2015-10-19 2015-10-19 A kind of electric terminal control panel square-wave generator

Country Status (1)

Country Link
CN (1) CN105223872B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5327404A (en) * 1990-11-27 1994-07-05 Vlsi Technology, Inc. On-chip frequency trimming method for real-time clock
US5481507A (en) * 1993-11-29 1996-01-02 Mitsubishi Denki Kabushiki Kaisha Electronic timekeeping device reduced adjustment data storage requirement
CN102004441A (en) * 2010-12-15 2011-04-06 许继集团有限公司 Adaptive crystal oscillator frequency timekeeping method
CN102045042A (en) * 2009-10-19 2011-05-04 京元电子股份有限公司 Frequency signal generating method for testing of semiconductor element
CN102981551A (en) * 2012-11-22 2013-03-20 百利通科技(扬州)有限公司 Temperature compensation system for real-time clock and method
CN103248356A (en) * 2013-05-20 2013-08-14 上海理工大学 Counter based on phase-lock loop pulse interpolation technology and realization method
CN103633996A (en) * 2013-12-11 2014-03-12 中国船舶重工集团公司第七〇五研究所 Frequency division method for accumulating counter capable of generating optional-frequency square wave

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5327404A (en) * 1990-11-27 1994-07-05 Vlsi Technology, Inc. On-chip frequency trimming method for real-time clock
US5481507A (en) * 1993-11-29 1996-01-02 Mitsubishi Denki Kabushiki Kaisha Electronic timekeeping device reduced adjustment data storage requirement
CN102045042A (en) * 2009-10-19 2011-05-04 京元电子股份有限公司 Frequency signal generating method for testing of semiconductor element
CN102004441A (en) * 2010-12-15 2011-04-06 许继集团有限公司 Adaptive crystal oscillator frequency timekeeping method
CN102981551A (en) * 2012-11-22 2013-03-20 百利通科技(扬州)有限公司 Temperature compensation system for real-time clock and method
CN103248356A (en) * 2013-05-20 2013-08-14 上海理工大学 Counter based on phase-lock loop pulse interpolation technology and realization method
CN103633996A (en) * 2013-12-11 2014-03-12 中国船舶重工集团公司第七〇五研究所 Frequency division method for accumulating counter capable of generating optional-frequency square wave

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于FPGA的超高精度任意小数分频器设计;黄守麟;《计算机工程与应用》;20081012;第485-487页 *

Also Published As

Publication number Publication date
CN105223872A (en) 2016-01-06

Similar Documents

Publication Publication Date Title
CN206363618U (en) A kind of lissajous figures apparatus for demonstrating based on CPLD
CN109542161A (en) A kind of clock signal generating apparatus and method
CN202502660U (en) Programmable digital logic circuit basic experiment plate
CN104765335A (en) Frequency pulse selector and selection method
CN105223872B (en) A kind of electric terminal control panel square-wave generator
CN205068062U (en) Electrical apparatus terminal control board side of using wave generator
CN104483716A (en) Metal detector adjusting device
CN105403824B (en) A kind of washing machine control panel senile experiment equipment and experimental method
CN107102210A (en) A kind of capacitance determining method and device based on capacitive touch chip
CN102970093B (en) The synchro system of compatible multiple clock and synchronous method thereof
CN107255748A (en) A kind of data signal measurement and generator
CN201937558U (en) Control device of signal generator
CN207283530U (en) Link signal simulator and system
CN202403774U (en) Multiphase flow simulated experiment signal generation device
CN206038809U (en) A drive signal generating device for capacitive touch panel test
CN104391817A (en) Electronic system synchronous with peripheral equipment
CN205081770U (en) Direct current parameter testing device
CN204761404U (en) Waveform generator based on direct digital frequency synthesis
CN209218065U (en) A simple Baud rate generator
CN106841777A (en) A kind of measurement apparatus of high accuracy frequency domain stability
CN203551739U (en) Simple multifunctional logic testing pen
CN205883269U (en) Signal source and code error tester
CN207817134U (en) A kind of circuit recording network distribution device
CN205899431U (en) Function signal generator based on singlechip
CN206517424U (en) A kind of clock synchronization apparatus

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 315327 Ningbo Province, Hangzhou Bay New District, the town of the East Yuan Xiang Village Industrial Park, No. two weft Road, No. 758

Applicant after: Zhejiang zhuoao Polytron Technologies Inc

Address before: Two road 315327 Zhejiang province Andong town of Cixi City Industrial Zone No. 758 weft

Applicant before: Ningbo ZuoAo Electronics Technology Co., Ltd.

GR01 Patent grant
GR01 Patent grant