CN101013303A - Industrial timer with power-off protection and timing method - Google Patents

Industrial timer with power-off protection and timing method Download PDF

Info

Publication number
CN101013303A
CN101013303A CN 200710066944 CN200710066944A CN101013303A CN 101013303 A CN101013303 A CN 101013303A CN 200710066944 CN200710066944 CN 200710066944 CN 200710066944 A CN200710066944 A CN 200710066944A CN 101013303 A CN101013303 A CN 101013303A
Authority
CN
China
Prior art keywords
power
chip microcomputer
timer
circuit
interrupt
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.)
Pending
Application number
CN 200710066944
Other languages
Chinese (zh)
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.)
XINYADA SYSTEM ENGINEERING Co LTD HANGZHOU
Original Assignee
XINYADA SYSTEM ENGINEERING Co LTD HANGZHOU
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 XINYADA SYSTEM ENGINEERING Co LTD HANGZHOU filed Critical XINYADA SYSTEM ENGINEERING Co LTD HANGZHOU
Priority to CN 200710066944 priority Critical patent/CN101013303A/en
Publication of CN101013303A publication Critical patent/CN101013303A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Electric Clocks (AREA)
  • Measurement Of Predetermined Time Intervals (AREA)

Abstract

The invention relates to an industrial timer and timing method with power protection, mainly including SCM, signal acquisition conditioning circuit, power protection circuit, timing clock, relay driver and output circuit and LCD module; in which the relay driver and output circuit is used for driving the relay driver, and the LCD module is used for displaying the data from the SCM to the LCD screen; the timing clock is used for the power-fail interrupt and interrupt data preservation. At the power-fail instant, the power protection circuit does the jumping of SCM interrupt port, triggering the interrupt, entering interrupt service procedure, and storing the data required to preserve in the RAM of DS1302, and since the SCM power connects to capacitor C1 of 220 F, making SCM still normal running in a short period of time after power-fail, so to get the power protection function. The invention has beneficial effect: the timer has the advantages of reliable function, simple structure, and low cost, and its application is very extensive.

Description

A kind of industrial timer and timing method with power-off protection
Technical field
The present invention relates to the timer field, mainly is a kind of industrial timer and timing method with power-off protection.
Background technology
Timer is one of control device commonly used in modern industrial and agricultural production and the scientific experiment, can be used in the various occasions that need timing, usually need regularly to export switching value in the commercial production, the start-stop of control motor or other actuating units, the cultivation of agricultural greening and irrigation also need to realize with timer comparatively regularly accurate, this timer also can satisfy timing demand strict in the scientific experiment, and timer helps boosting productivity, and saves labour and production cost.
Timer in the market mostly adopts single charactron as display device, and figure place showing is 4 or 6, much all can not show simultaneously to preset duration and present timing value, and scope regularly is not very wide, often can not satisfy the demands.What this timer adopted is 2 * 16 character mode lcd display screens, multipotency shows 2 row up and down, 16 characters of every row, above delegation be used for showing default timing value, following delegation shows the present timing value, adopts LCDs to increase the friendly of user interface and the dirigibility of operation greatly.Also there are some problems that remain further solution in this timer, and stability and reliability needs further to improve, and the size of product and profile are small and exquisite not enough attractive in appearance, and also there are weak point in the convenience and the dirigibility of user's use.The commercial production scene can run into the phenomenon of sudden power unavoidably, when the unexpected power down of system, can cause loss of vital data and can not recover.In order to avoid the generation of both of these case as far as possible, need add detection of power loss and holding circuit, to improve the anti-interference and the security of system.
Summary of the invention
The present invention will solve above-mentioned existing shortcoming, and a kind of industrial timer and timing method with power-off protection is provided, and is used in outage, stops the timer application of disconnected rugged environment such as frequent.
The present invention solves the technical scheme that its technical matters adopts.The industrial timer of this band power-off protection mainly comprises single-chip microcomputer, signal collection modulation circuit, power-off protecting circuit, timer clock, relay driving and output circuit and LCD MODULE; Its repeat circuit drives and output circuit is used to drive relay, and LCD MODULE is used for wanting data presented to send on the liquid crystal display to single-chip microcomputer and shows; Timer clock is used for power-fail interrupt and preserves interrupting data; Look-at-me is by the external interrupt mouth of not gate, resistance R 1, triode and single-chip microcomputer, and capacitor C 1 links to each other with the energization pins of single-chip microcomputer, and rechargeable battery U3 links to each other with the energization pins of timer clock.
Signals collecting orderliness circuit of the present invention is restarted circuit and is made up of resistance R 2, R3, capacitor C 4 and button RESET1, RESET2 by restarting circuit and peripheral crystal oscillating circuit two parts are formed, and finally links to each other with the RESET mouth of single-chip microcomputer; Peripheral crystal oscillating circuit is made up of capacitor C 2, C3 and crystal oscillator X1, links to each other with external crystal pins X1, the X2 of single-chip microcomputer, is used for single-chip microcomputer and produces required sequential.
Relay of the present invention drives and output circuit is made of power amplification chip, photo-coupler, resistance R 13, R14, R15, triode Q3 and relay output, after single-chip microcomputer sends signal by the p2.0 pin, through the power amplification of power amplification chip, the external relay of the anti-interference rear drive of the optically-coupled of photo-coupler.
This industry of the present invention method regularly mainly comprises the steps:
A), earlier single-chip microcomputer, LCD MODULE and DS1302 timer clock are carried out initialization;
B), read the 30th byte of RAM in the DS1302 timer clock, and its content is judged, if interrupt identification is arranged,
Then the power-fail interrupt program was carried out in explanation, then read the data that are kept in the DS1302 timer clock, and recovered on-the-spot, if skip without interrupt identification;
C), then whether inquiry button is pressed repeatedly, if any which is pressed, and just carries out corresponding operation; After initiating key is pressed, inquire about the DS1302 timer clock repeatedly, and relatively the time in the DS1302 timer clock whether change, every change once just equals the time has increased by one second, so timing numerical value second adds 1, LCD MODULE is also done corresponding demonstration;
D), whether equate with setting value, determine whether to reach setting-up time,, just drive and the output circuit driving actuating of relay by relay as equating as the unequal DS1302 timer clock of just inquiring about once more by instantaneous value relatively.
Power-fail interrupt program of the present invention mainly comprises the steps:
A), outage moment, Vcc becomes low level, this signal drives by triode by not gate again, sends into the middle fracture of single-chip microcomputer;
B), single-chip microcomputer receives look-at-me, promptly enters the power-fail interrupt program, removes the write-protect of DS1302 timer clock earlier, then the 30th byte of the RAM in the DS1302 timer clock writes interrupt identification numerical value;
C), the timing data of preserve to need preserving in the RAM of DS1302 timer clock, and enable write-protect.
The effect that the present invention is useful is: the hardware circuit and the implementation method that with AT89C51 are the general purpose timer of core.This timer adopts the DS1302 chip, has both reached high-performance and low-power consumption, makes full use of the function that RAM that DS1302 carries has realized power-off protection again.This timer has reliable in function, advantage such as simple in structure, cheap, and the application scenario is very extensive.Outage moment is realized the saltus step of the middle fracture level of single-chip microcomputer by power-off protecting circuit; trigger and interrupt; enter interrupt service routine; the data that needs are preserved write among the RAM of DS1302; the power supply of single-chip microcomputer has been owing to connect the capacitor C 1 of 220 μ F, makes after outage in the short time that single-chip microcomputer still can operate as normal, carries out interrupt service routine smoothly; preserve data, thereby realized the function of power-off protection.
Description of drawings
Fig. 1 is a circuit theory synoptic diagram of the present invention;
Fig. 2 is a software flow synoptic diagram of the present invention;
Embodiment
The present invention is further detailed explanation below in conjunction with drawings and Examples.
The industrial timer of this band power-off protection, this timer mainly comprise single-chip microcomputer, signal collection modulation circuit, power-off protecting circuit, timer clock, relay driving and output circuit, LCD MODULE and keyboard interface circuit etc.; Its circuit theory diagrams as shown in Figure 1, single-chip microcomputer is the key process unit of counter, adopts the AT89C51 single-chip microcomputer of Atmel company, it is 8 bit CPUs, data-carrier store in the sheet internal program storer with 4K, the sheet of 128 bytes, 2 16 bit timing devices, 48 I/O interfaces, 5 interrupt sources, its performance characteristics can satisfy the functional requirement of timer fully, and the price of this single-chip microcomputer is more cheap, the cost performance height, both economical rationally as the CPU (central processing unit) of counter.
The function of main functional modules and the course of work are described below among the figure:
The signal collection modulation circuit: this circuit is altogether by restarting circuit and peripheral crystal oscillating circuit two parts are formed.Restart circuit and form, finally link to each other, restart mouth as the outside of single-chip microcomputer, by artificial external trigger with the RESET mouth of single-chip microcomputer by resistance R 2, R3, capacitor C 4 and button RESET1, RESET2.Peripheral crystal oscillating circuit is made up of capacitor C 2, C3 and crystal oscillator X1 (12M), links to each other with external crystal pins X1, the X2 of single-chip microcomputer, for single-chip microcomputer produces required sequential.
Power-off protecting circuit: by U4A74LS04, resistance R 1 (10K), components and parts such as Q1S9014 finally link to each other with the INTO mouth of single-chip microcomputer, as the interrupt source of single-chip microcomputer external interrupt mouth.In addition, capacitor C 1 and rechargeable battery U3 (Power3.6V) also are the parts in the power-off protecting circuit, and they link to each other with the energization pins of single-chip microcomputer and timer clock (DS1302) respectively.Cut off the power supply moment, Vcc becomes low level, and this signal drives by S9014 by not gate 74LS04 again, sends into the middle fracture of AT89C51.Meanwhile, the power supply of single-chip microcomputer has been owing to connect capacitor C 1, makes after outage single-chip microcomputer endure in the short time.
Relay drives and output circuit: by power amplification chip SN75451, and photo-coupler (OPTOIS01), resistance R 13, R14, R15, triode Q3 and relay output constitute.After single-chip microcomputer sends signal by the p2.0 pin, through power amplification, the external relay of the anti-interference rear drive of optically-coupled.
LCDs: LCDDMM.In case after the liquid crystal initialization,, just can want single-chip microcomputer data presented to send on the liquid crystal display and show by linking to each other with the P1 mouth of single-chip microcomputer.In addition, the P3.6 pin of single-chip microcomputer can be controlled the read-write operation of liquid crystal display, the enable bit (enable) of P3.7 control liquid crystal, and that P3.5 controls is restart (reset) of liquid crystal.
Keyboard interface circuit: mainly be to comprise a JKEYBOARD element.RESET1, RESET2 and P3.0 have been comprised, P3.1, P3.3, P3.4 pin.
Timer: the DS1302 timer clock in the circuit diagram just.Its effect is as follows: can carry out initialization to the DS1302 calendar clock behind the program start.Then read the 30th byte of DS1302RAM, and its content is judged, if interrupt identification is arranged, then the power-fail interrupt program was carried out in explanation, then read the data that are kept among the DS1302, and recovered on-the-spot, if skip without interrupt identification.
Four buttons: become line by two pin set of single-chip microcomputer, two pins are formed alignment in addition, utilize the principle of rank scanning to form four buttons, promptly are respectively Decrease, increase, shift and start.Decrease is used for timing is carried out reducing, and increase is just in time opposite, carries out add operation, and the start button is used for beginning regularly.
This industry of the present invention method regularly mainly comprises the steps:
A), earlier single-chip microcomputer, LCD MODULE and DS1302 timer clock are carried out initialization;
B), read the 30th byte of RAM in the DS1302 timer clock, and its content is judged, if interrupt identification is arranged, then the power-fail interrupt program was carried out in explanation, then read the data that are kept in the DS1302 timer clock, and recover on-the-spot, if skip without interrupt identification;
C), then inquire about four buttons repeatedly and whether be pressed, if any which be pressed, just carry out corresponding operation; After initiating key is pressed, inquire about the DS1302 timer clock repeatedly, and whether the time of comparing in the DS1302 timer clock changes, because being unit with the second, increases the time among the timer clock DS1302, so once just equaling the time, every change increased by one second, so timing numerical value second adds 1, LCD MODULE is also done corresponding demonstration;
D), whether equate with setting value, determine whether to reach setting-up time,, just drive and the output circuit driving actuating of relay by relay as equating as the unequal DS1302 timer clock of just inquiring about once more by instantaneous value relatively.
The power-fail interrupt program mainly comprises the steps: the moment of cutting off the power supply, and Vcc becomes low level, and this signal drives by triode S9014 by not gate 74LS04 again, sends into the middle fracture of single chip computer AT 89C51.Meanwhile, the power supply of single-chip microcomputer has been owing to connect capacitor C 1, makes after outage single-chip microcomputer endure in the short time, and through repeatedly experiment, working stability is reliable at normal temperatures to select the electric capacity of 220 μ F for use.After entering the power-fail interrupt program, remove earlier the write-protect of DS1302, then the 30th byte to DS1302RAM writes interrupt identification numerical value, preserves the timing data that needs to preserve then in the RAM of DS1302, and enables write-protect.
In addition to the implementation, the present invention can also have other embodiments.All employings are equal to the technical scheme of replacement or equivalent transformation formation, all drop on the protection domain of requirement of the present invention.

Claims (5)

1, a kind of industrial timer with power-off protection is characterized in that: this timer mainly comprises single-chip microcomputer, signal collection modulation circuit, power-off protecting circuit, timer clock, relay driving and output circuit and LCD MODULE; Its repeat circuit drives and output circuit is used to drive relay, and LCD MODULE is used for wanting data presented to send on the liquid crystal display to single-chip microcomputer and shows; Timer clock is used for power-fail interrupt and preserves interrupting data; Look-at-me is by the external interrupt mouth of not gate, resistance R 1, triode and single-chip microcomputer, and capacitor C 1 links to each other with the energization pins of single-chip microcomputer, and rechargeable battery U3 links to each other with the energization pins of timer clock.
2, the industrial timer of band power-off protection according to claim 1, it is characterized in that: described signals collecting orderliness circuit is by restarting circuit and peripheral crystal oscillating circuit two parts are formed, restart circuit and form, finally link to each other with the RESET mouth of single-chip microcomputer by resistance R 2, R3, capacitor C 4 and button RESET1, RESET2; Peripheral crystal oscillating circuit is made up of capacitor C 2, C3 and crystal oscillator X1, links to each other with external crystal pins X1, the X2 of single-chip microcomputer, is used for single-chip microcomputer and produces required sequential.
3, the industrial timer of band power-off protection according to claim 1; it is characterized in that: described relay drives and output circuit is made of power amplification chip, photo-coupler, resistance R 13, R14, R15, triode Q3 and relay output; after single-chip microcomputer sends signal by the p2.0 pin; through the power amplification of power amplification chip, the external relay of the anti-interference rear drive of the optically-coupled of photo-coupler.
4, a kind of industry method regularly is characterized in that: mainly comprise the steps:
A), earlier single-chip microcomputer, LCD MODULE and timer clock are carried out initialization;
B), read the 30th byte of RAM in the timer clock, and its content is judged if interrupt identification is arranged, then the power-fail interrupt program was carried out in explanation, then read the data that are kept in the timer clock, and recovered on-the-spot, if skip without interrupt identification;
C), then whether inquiry button is pressed repeatedly, if any which is pressed, and just carries out corresponding operation; After initiating key is pressed, inquire about timer clock repeatedly, and relatively the time in the timer clock whether change, every change once just equals the time has increased by one second, so timing numerical value second adds 1, LCD MODULE is also done corresponding demonstration;
D), whether equate with setting value, determine whether to reach setting-up time,, just drive and the output circuit driving actuating of relay by relay as equating as the unequal timer clock of just inquiring about once more by instantaneous value relatively.
5, industry according to claim 4 method regularly, it is characterized in that: described power-fail interrupt program mainly comprises the steps:
A), outage moment, Vcc becomes low level, this signal drives by triode by not gate again, sends into the middle fracture of single-chip microcomputer;
B), single-chip microcomputer receives look-at-me, promptly enters the power-fail interrupt program, removes the write-protect of DS1302 timer clock earlier, then the 30th byte of the RAM in timer clock writes interrupt identification numerical value;
C), the timing data of preserve to need preserving in the RAM of timer clock, and enable write-protect.
CN 200710066944 2007-01-25 2007-01-25 Industrial timer with power-off protection and timing method Pending CN101013303A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200710066944 CN101013303A (en) 2007-01-25 2007-01-25 Industrial timer with power-off protection and timing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200710066944 CN101013303A (en) 2007-01-25 2007-01-25 Industrial timer with power-off protection and timing method

Publications (1)

Publication Number Publication Date
CN101013303A true CN101013303A (en) 2007-08-08

Family

ID=38700859

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200710066944 Pending CN101013303A (en) 2007-01-25 2007-01-25 Industrial timer with power-off protection and timing method

Country Status (1)

Country Link
CN (1) CN101013303A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102566467A (en) * 2010-12-27 2012-07-11 贵州双阳飞机制造厂 Anti-interference method of singlechip microcomputer system
CN110045434A (en) * 2019-04-30 2019-07-23 安徽汉云智能制造有限责任公司 A kind of infrared shooting device
CN110083100A (en) * 2019-05-06 2019-08-02 广东石油化工学院 A kind of SCM Based electronic timer

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102566467A (en) * 2010-12-27 2012-07-11 贵州双阳飞机制造厂 Anti-interference method of singlechip microcomputer system
CN110045434A (en) * 2019-04-30 2019-07-23 安徽汉云智能制造有限责任公司 A kind of infrared shooting device
CN110083100A (en) * 2019-05-06 2019-08-02 广东石油化工学院 A kind of SCM Based electronic timer

Similar Documents

Publication Publication Date Title
CN101013479A (en) Industrial counter with power-off protection and counting method
CN201000602Y (en) Computer shut-down energy-saving circuit
CN100458663C (en) Control method for low-power consumption RAM and RAM control module
CN201867678U (en) Mainboard of computer capable of reducing power consumption during sleep
CN101013303A (en) Industrial timer with power-off protection and timing method
CN201438269U (en) Motion control main board, motion control board and motion controller
CN202605302U (en) Intelligent medicine box
CN102193616A (en) Method for controlling power supply of electronic device for improving battery life
CN201503569U (en) South bridge chip power supply circuit
CN201508547U (en) Handheld USB programming device
CN206788613U (en) A kind of intelligent switch
CN101388565A (en) Low-power consumption standby circuit and standby control method
CN202563026U (en) Detection circuit of solenoid valve of refrigerator
CN114416190B (en) Android device and computer USB linkage dormancy awakening circuit
CN206441163U (en) A kind of low-power consumption microcontroller based on OTP
WO2009019466A4 (en) Energy saving device
CN201251699Y (en) Curtain controller
CN110633002A (en) Processing circuit and power management method thereof
CN205028659U (en) Solid state hard drives with life -span alarm function
CN104867520A (en) Intelligent data storage unit of exciting magnet apparatus based on ferroelectric random access memory and working method therefor
CN204576478U (en) A kind of high speed hard-disk based on Dram
CN201315060Y (en) Power loss data storage circuit of digital positioning device
CN201518551U (en) DMX512 signal acquisition player
CN202973758U (en) Energy-conservation protector of refrigerator
CN209897317U (en) Memory desk lamp based on singlechip

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Open date: 20070808