CROSS-REFERENCE TO RELATED APPLICATION The present application claims priority under 35 U.S.C.§ 119(e) from U.S. Ser. No. 60/545,656, entitled “Portable LED Curing Light,” filed on Feb. 18, 2004. U.S. Ser. No. 60/545,656 was filed by at least one inventor common to the present application, and is hereby incorporated by reference.
FIELD OF THE INVENTION The present invention relates to a light used for curing light-activated compound materials. In particular, the present invention relates to a portable rechargeable curing light for dental applications.
BACKGROUND OF THE INVENTION Light-activated compounds are well known and used in a variety of commercial applications. For example, such compounds are widely used in a variety of dental procedures including restoration work and teeth filling after root canals and other procedures requiring drilling. Several well-known dental compounds have been sold, for example, under the trade names of BRILLIANT LINE, Z-100, TPH, CHARISMA and HERCULITE & BRODIGY.
Dental compounds typically comprise liquid and powder components mixed together to form a paste. Curing of the compound requires the liquid component to evaporate, causing the composite to harden. In the past, curing has been accomplished by air drying, which has had the disadvantage of requiring significant time. This time can greatly inconvenience the patient. More recently, use of composite materials containing light-activated accelerators has become popular in the field of dentistry as a means for decreasing curing times. According to this trend, curing lights have been developed for dental curing applications. An example of such a curing light is illustrated by U.S. Pat. No. 5,975,895, issued Nov. 2, 1999 to Sullivan.
Conventional dental curing lights have employed tungsten filament halogen lamps that incorporate a filament for generating light, a reflector for directing light, and often a filter for limiting transmitted wavelengths. For example, a blue filter may be used to limit transmitted light to wavelengths in the region of 400 to 500 nanometers (nm). Light is typically directed from the filtered lamp to a light guide, which directs the light emanating from an application end of the guide to a position adjacent to the material to be cured.
Filters are generally selected in accordance with the light activation properties of selected composite compound materials. For example, blue light may be found to be effective to excite composite accelerators such as camphoroquinine, which has a blue light absorption peak of approximately 470 nanometers (nm). Once excited, the camphoroquinine accelerator in turn stimulates the production of free radicals in a tertiary amine component of the composite, causing polymerization and hardening.
A problem with conventional halogen-based lights is that the lamp, filter and reflector degrade over time. This degradation is particularly accelerated, for example, by the significant heat generated by the halogen lamp. For example, this heat may cause filters to blister and cause reflectors to discolor, leading to reductions in light output and curing effectiveness. While heat may be dissipated by adding a fan unit to the light, the fan may cause other undesired effects (for example, undesirably dispersing a bacterial aerosol that may have been applied by the dentist to the patient's mouth). Alternate lamp technologies using Xenon and other laser light sources have been investigated, but these technologies have tended to be costly, consumed large amounts of power and generated significant heat. Laser technologies have also required stringent safety precautions.
Light Emitting Diodes (LEDs) offer a good alternative to halogen curing light sources, having excellent cost and life characteristics. Generating little heat, they also present less risk of irritation or discomfort to the patient. However, in the past, LEDs have been capable of generating only modest optical power levels. As a result, many prior art curing lights have required arrays of LEDs to generate sufficient optical power levels for curing applications (see, e.g., U.S. Pat. No. 6,331,111 to Cao).
More recently, the electrical and optical power outputs for LEDs have improved substantially. For example, LEDs are currently capable of producing powers in excess of 1 watt at efficiencies in excess of 45 percent to generate more than 100 lumens per watt (see, e.g., Eric Learner, “Solid-state illumination is on the horizon, but challenges remain”, Laser Focus World, November 2002). Accordingly, it would be desirable to produce a compact, portable LED curing light for use in dental curing applications.
SUMMARY OF THE INVENTION A portable LED curing light is disclosed, with application to curing of dental materials and other related applications. The light includes a one-piece handle assembly including a slim probe portion with an angled light-producing end that is suitable, for example, to be positioned within a dental patient's mouth for curing a dental material positioned in a tooth of the patient. A replaceable lens for focusing light emitted by an LED light source is removably attached at the light-producing end. The handle also includes a battery and associated electronics for operating the light, including an operating switch, an audible indicator and at least one visual indicator. The handle is coupled with a base for storage and recharging of the battery. The base positions the handle at an inclined position, and provides a drain for draining moisture away from the handle.
Upon operation of the switch, the light may be operated for a predetermined curing cycle, after which power is automatically removed (“sleep mode”). An audible beep is produced at predetermined intervals during the curing cycle so that a desired curing time can be determined and achieved. Circuitry in the handle monitors the status of battery voltage and handle temperature. Based on predetermined thresholds, if either battery voltage is determined to be too low or handle temperature is determined to be too high, the circuitry prevents operation of the switch from initiating a next curing cycle. If the light is currently operating in a current curing cycle at a time at which either battery voltage is determined to be too low or handle temperature is determined to be too high, the light continues to operate through completion of the duty cycle. The visual indicator indicates when either battery voltage is determined to be too low or handle temperature is determined to be too high.
BRIEF DESCRIPTION OF THE DRAWING A more complete understanding of the invention may be obtained by reference to the appended drawing in which:
FIGS.1(a)-1(f) provide orthographic and perspective views of a handle of the disclosed LED curing light;
FIG. 2 provides an exploded view of the curing light handle;
FIGS.3(a)-3(d) provide orthographic and perspective views of a heat sink for dissipating heat in the curing light handle;
FIGS.4(a)-4(d) provides several views of a ball lens affixed to the curing light handle for focusing light emitted by the LED;
FIG. 5 illustrated features of a left housing case of the curing light handle;
FIG. 6 illustrates features of a right housing case of the curing light handle;
FIG. 7 presents a schematic diagram of a circuit for operating the curing light handle;
FIG. 8 presents a schematic diagram of a circuit for charging a battery in the base;
FIGS.9(a),9(b) provides exploded views of components of a base for receiving the curing light handle; and
FIGS.10(a)-10(g) provides orthographic and perspective views of the base;
In the various figures, like reference numerals wherever possible designate like or similar elements of the invention.
DETAILED DESCRIPTION FIGS.1(a)-1(f) present several views illustrating ahandle100 of an exemplary LED curing light embodying the principles of the present invention.FIG. 1(a) presents a perspective view of thehandle100. FIGS.1(b) and1(d) respectively present top and bottom elevation views of thehandle100. FIGS.1(c) and1(f) respectively present right side and left side views of thehandle100, andFIG. 1(e) presents a front view of thehandle100.
Thehandle100 includes a grippingportion10 for an operator to hold thehandle100. The grippingportion10 encloses, for example, electrical circuit and battery components of the handle100 (not shown), and provides access to aswitch button cover11 for operating the curing light. Thehandle100 also houses at least one visual indicator12 (for example, comprising an LED) for indicating a current state or status of the curing light.
Extending from the gripping portion of thehandle100 is aprobe portion13 of thehandle100 that has a diameter reduced from a diameter of the grippingportion10, and includes anangled bend14 near adistal end15 of theprobe portion14 in order that thedistal end15 may be conveniently positioned, for example, within a dental patient's mouth. This configuration enables alens assembly16 at thedistal end15 of the probe to be placed in close proximity to a patient's tooth, so that light emitted at thedistal end15 of theprobe portion13 may be used to cure a dental material that has been applied to the tooth.
FIG. 2 provides an exploded view of the curinglight handle100, includingright housing case101, aleft housing case102, an LED/heat sink subassembly20, and anoptical choke16aand aball lens16bpositioned in proximity to anLED21. Theball lens16bis configured to be removable and replaceable.Optical choke16aand aball lens16bare selected so that theLED21 produces a focused light output at thedistal end15 of theprobe portion13.FIG. 2 also illustrates a curing lightcircuit board assembly30, electrically coupled to each of theLED21, abattery41, and abattery charging terminal42 of thehandle100. Aswitch button cover11 made of neoprene or some like material covers anoperating switch31 mounted on thecircuit board30, and protrudes through thecases101,102 to provide external means for operating the curing light. An indicator cover12aand alight pipe12bare positioned over an indicator LED on thecircuit board assembly30. Indicator cover12aprotrudes from thecircuit board assembly30 through thecases101,102. Audio circuitry (not shown) for producing an audible indicator (for example, a “beep”) is also positioned oncircuit board assembly30.
FIGS.3(a)-3(d) present several views illustrating aheat sink22 of the LED/heat sink subassembly20, for dissipating heat primarily generated by theLED21 ofFIG. 2.FIG. 3(a) presents a perspective view of theheat sink22. FIGS.3(b) and3(d) respectively present top and bottom elevation views of theheat sink22, andFIG. 3(c) presents a side view of theheat sink22.
Theheat sink22 conforms to an inner volume of theprobe portion13 ofFIG. 1, and substantially fills this inner volume. Preferably formed in a single piece, it extends through theangled bend14 of theprobe portion13 ofFIG. 1 in order to be directly and thermally coupled to theLED21 ofFIG. 2. Theheat sink22 includes, for example,lateral grooves23 on opposing sides ofheat sink22 for directing electrical wires from theLED21 ofFIG. 2 to thecircuit board assembly30 ofFIG. 2.Heat sink22 is also includesnotches24 on opposing sides ofheat sink22 at adistal end25 of the heat sink in order to locatably couple theLED21 at thedistal end25 Theheat sink22 preferably comprises a highly thermally conductive material such ascopper101.
FIGS.4(a)-4(d) provide several views of aball lens16baffixed to the curing light handle for focusing light emitted by the LED.FIG. 4(a) presents a perspective view of theball lens16b. FIGS.4(b) and1(c) respectively present top and bottom elevation views of theball lens16b, andFIG. 4(c) presents a section view through section A-A ofFIG. 4(c).
Theball lens16b, in conjunction with theoptical choke16aillustrated inFIG. 2, further focuses a light beam emitted by theLED21 ofFIG. 2.Ball lens16bandoptical choke16aare selected so that a majority of the emitted light energy is concentrated over an area that is sufficient for curing dental composites in a patient's mouth.
FIGS.5(a)-5(d) and6(a),6(b) respectively illustrate features ofleft housing case102 and aright housing case101, respectively. Theright housing case101 and lefthousing case102 may be mated for example by ultrasonic welding. An energy director102aof theleft housing case102 includes an outwardly extending v-shaped edge102b(see, e.g., Section F-F ofFIG. 5(a),5(b)) that may be positively located and mated to a corresponding groove (not shown) in the right housing case (see, e.g., Section B-B ofFIG. 6). In addition, the v-shaped edge of the energy director is periodically relieved by an inwardly extending v-shapedgroove102c(see, e.g., Detail G ofFIG. 5(c)) that in order to receive aweld lock101bof the left housing case (see, e.g., Detail H ofFIG. 6(b)). In this manner, the left housing case and right housing case can be easily, precisely and fixedly aligned for mating during the ultrasonic welding process. Once ultrasonically welded, the left housing case and right housing case form a rigid, one-piece housing for the handle.
FIG. 7 presents a schematic diagram of acircuit700 for operating the curing light handle. Thecircuit700 is preferably powered by a conventional lithium battery (illustrated asbattery41 ofFIG. 2), but may alternatively be powered by a conventional nickel cadmium battery, or alternatively, by a nickel metal hydride battery.
Switch701signals switching controller702 viamicrocontroller703 to turn onLED21 for a predetermined curing cycle (for example, sixty seconds).Microcontroller703 is coupled tocrystal oscillator704 to provide timed control functions. After completion of the curing cycle,microcontroller703 removes power fromLED21 to allow the curing light to enter a sleep mode.
During operation ofLED21,microcontroller703 periodically outputs a signal onpin1 of microcontroller703 (for example, every ten seconds) to causespeaker705 to produce a regularly timed audible beep. These beeps may be used by a dentist or other operator of thehandle100 ofFIG. 1 to determine an elapsed time, and thereby to apply the curing light to cure a dental material for a desired curing time. A chargingcircuit706 and fuse707 regulate battery charging and prevent the battery from being overcharged.
Microcontroller703 is further programmed to periodically test for adequate battery voltage and excessive operating temperature (for example, every five seconds). For example,microcontroller703 determines the adequacy of battery voltage Vdd by measuring and comparing Vdd as supplied to thecircuit700 to a fixed voltage reference measured acrossdiodes708,709.Microcontroller703 further determines operating temperature by measuring a voltage drop across a resistive component ofthermistor710 relative to Vdd. As the voltage drop across the thermistor is a function of Vdd, a dimensionless ratio of these two voltages may be produced to determine a relative measure of operating temperature.
If either battery voltage is determined to be inadequate and/or operating temperature is determined to be excessive,microcontroller703 does not permit a new operating cycle to begin in response to an operation ofswitch701. If an operating cycle is in progress when battery voltage is determined to be inadequate and/or operating temperature is determined to be excessive,microcontroller703 allows the currently operating cycle to complete before preventing initiation of subsequent operating cycles. While battery voltage and operating temperature are at proper levels for operation,microcontroller703 controls a voltage atpin6 to light indicatingLED711.
In order to provide for change and upgrading of its operating program,microcontroller703 may further be coupled toprogramming connector712.
FIG. 8 presents a schematic diagram of acharging circuit800 for chargingbattery41 ofFIG. 2 by means ofbase200 ofFIGS. 9, 10. As illustrated inFIG. 8,linear regulator801 regulates a voltage supplied to the charging circuit800 (for example, from a commercial power source). So long as adequate commercial power is supplied,green LED802 lights to provide an indication that commercial power is present. As significant current is drawn at lead J2 for recharging the battery, a voltage drop acrossresistors803,804 activatesamplifiers805,806 to cause current flow throughtransistor807 in order to light thered LED808 to indicate that the battery is recharging.
FIGS.9(a),9(b) respectively provide exploded views of components of abase200 for receiving the curing light handle from above and below thebase200. The components ofbase200 include amain housing201, alower housing202, acircuit board203 including a batterycharger pin assembly203aand apower receptacle203b, and aweight204 for stabilizing the circuit board.FIG. 10 provides orthographic and perspective views of the base. The components201-204 may be assembled together using a variety of conventional fastening means (for example, by means of retainingpins205 which may be ultrasonically welded, glued or thread mounted toreceptacles206.
FIGS.10(a)-10(g) further illustrate thebase200.FIG. 10(a) presents a perspective view of thebase200. FIGS.10(b) and10(c) respectively present top and bottom elevation views of thebase200. FIGS.10(e) and10(g) respectively present right side and left side views of thebase200.FIG. 10(f) presents a front view of thebase200, andFIG. 10(g) provides a rear view of thebase200.
Main housing201 includes aconical portion201ahaving arecess201bfor receiving the gripping portion of the handle for storage and re-charging of the handle. Theconical portion201aandrecess201bare co-axially oriented slightly away from avertical angle201c(for example, approximately 10 to 15 degrees). Aslit201dextends through the conical201aportion into therecess201b, and terminates at alowest portion201eof a base of theconical portion201ain order to enable moisture collecting within the interior of therecess201bto drain away through the slit. At least two charging pins in chargingpin assembly203aofFIG. 9 extend upward from the recess near the base of theconical portion201afor contact withbattery charging terminal42 ofFIG. 2 at the ofhandle100. The chargingterminal42 includes at least two, electrically isolated conductive rings (not shown). When the handle is inserted into the recess, each pin makes electrical contact with one of the conductive rings, regardless of the radial orientation of the handle in the recess.
Appendix 1 provides a program listing illustrating for example the manner in which microcontroller U2 ofFIG. 7 is operated to measure battery voltage and thermistor temperature, and therefrom to control operation of the curing cycle and lighting of the visual status indicator.
The foregoing describes the invention in terms of embodiments foreseen by the inventor for which an enabling description was available, notwithstanding that insubstantial modifications of the invention, not presently foreseen, may nonetheless represent equivalents thereto.
| APPENDIX 1 |
|
|
| ;********************************************************************** |
| ; Program for the LED curing light * |
| ; Microcontroller used is the 8 pin PIC12F675. * |
| ; * |
| ;********************************************************************** |
| ; * |
| ; Filename: | LEDcure_Vx.asm |
| * |
| ; Date: | February 20, 2003 * |
| ; File Version: | 03032716 (YYMMDDHH) * |
| ; Author: | Douglas J. Mansor * |
| ; Company: | Coltene/Whaledent, Inc. * |
| ; * |
| ; * |
| ;********************************************************************** |
| ; * |
| ; Files required: | p12f675.inc * |
| ; * |
| ; * |
| ; * |
| ;********************************************************************** |
| ; * |
| ; Notes: * |
| ; * |
| ; * |
| ; * |
| ; * |
| ;********************************************************************** |
| ; |
| list | p=12f675 | ; list directive to define processor |
| #include | <p12f675.inc> | ; processor specific variable |
| definitions |
| ; |
| errorlevel −302 | ; suppress message 302 from list |
| file |
| ; |
| ——CONFIG _CP_ON & _WDT_OFF & _MCLRE_OFF & _PWRTE_OFF & _LP_OSC & |
| _BODEN_OFF |
| ; ‘——CONFIG’ directive is used to embed configuration word within .asm |
| file. |
| ; The lables following the directive are located in the respective .inc |
| file. |
| ; See data sheet for additional information on configuration word |
| settings. |
| ; |
| ; |
| ;***** VARIABLE DEFINITIONS |
| w_temp | EQU | 0x50 | ; variable used for context |
| saving |
| status_temp | EQU | 0x51 | ; variable used for context saving |
| ; |
| STATE | EQU | 0x20 | ;STATE machine indicator |
| OVERTEMP | EQU | H‘0000’ | ;Hot bit in STATE |
| UNDERVOLTAGE | EQU | H‘0001’ | ;Low voltage bit in STATE |
| LIGHTON | EQU | H‘0002’ | ;Light on bit in STATE |
| ; |
| TIME | EQU | 0x21 | ;Timer overflow count, 10s count |
| THERH | EQU | 0x22 | ;High temperature byte |
| THERL | EQU | 0x23 | ;Low temperature byte |
| VOFFH | EQU | 0x24 | ;Battery voltage with light off, |
| high byte |
| VOFFL | EQU | 0x25 | ;Battery voltage with light off, low |
| byte |
| VONH | EQU | 0x26 | ;Battery voltage with light on, high |
| byte |
| VONL | EQU | 0x27 | ;Battery voltage with light on, low |
| byte |
| ACCUMH | EQU | 0x30 | ;Accumulator, high byte |
| ACCUML | EQU | 0x31 | ;Accumulator, low byte |
| ACCUMB | EQU | 0x32 | ;Accumulator B. Counts cycles |
| of beep. |
| TEMP1 | EQU | 0x33 | ;Temporary register storage 1 |
| TEMP2 | EQU | 0x34 | ;Temporary register storage 2 |
| LOOPCTR1 | EQU | 0x35 | ;For counting Mainloops |
| LOOPCTR2 | EQU | 0x36 | ;For counting loops |
| VMINL | EQU | 0x80 | ;coresponds to 3.5V with 1.44V Ref. |
| LOOPS | EQU | 0x20 | ;delay 32 × 256 loops |
| TENS | EQU | 0x6 | ;Light ON time in 10s |
| intervals |
| SEC5 | EQU | 0x5F | ;for 5s timing. 32768kHz osc = |
| 122.07us cyc |
| ; | 256 * 160 * 122.07031us |
| = 5s, 160d = A0h |
| ; | FFh − A0h = 5Fh |
| TMR1SETH | EQU | 0D7h | ;The high byte of timer1 preset for |
| 10s |
| TMR1SETL | EQU | 0FFh | ;The low byte of timer1 preset for |
| 10s |
| ; for prescaler = 1:8 and Fosc = 32768 Hz |
| ; |
| ; |
| ;********************************************************************** |
| ORG | 0x000 | ; processor reset vector |
| goto | main | ; go to beginning of program |
| ; |
| ; |
| ORG | 0x004 | ; interrupt vector location |
| movwf | w_temp | ; save off current W register |
| movf | STATUS,w | ; move status register into W |
| movwf | status_temp | ; save off contents of STATUS |
| register |
| ; |
| ; |
| ; INTERRUPT code can go here or be located as a call subroutine |
| elsewhere |
| ;——————————————— |
| clrf | PIR1 | ;Clear IRQ flags |
| movlw | 0C0h | ;Enable peripheral IRQs |
| movwf | INTCON | ;& disableTimer 0 IRQ and |
| external IRQ |
| ; Verify STATE |
| btfsc | STATE,LIGHTON | ;Is the Light on? |
| goto | IRQ_ok | ;The light is on and being |
| call | stopall | ;The Timer isn't supposed to |
| goto | IRQ_return | ;stop it and exit IRQ |
| movlw | TMR1SETH | ;load with 10240 counts at 976.562us |
| movwf | TMR1H | ;before next IRQ |
| movlw | TMR1SETL |
| movwf | TMR1L |
| decfsz | TIME,1 | ;bump 60s time keeper |
| ; Maximum on time has been reached. |
| call | stopall | ;subroutine to turn off big |
| LED and stop timer |
| not60yet: |
| call | beepone | ;execute a beep |
| bcf | PIR1,TMR1IF | ;Clear the Timer 1 IRQ flag |
| ; |
| IRQ_return: |
| ;——————————————— |
| movf | status_temp,w | ; retrieve copy of STATUS register |
| movwf | STATUS | ; restore pre-isr STATUS register |
| swapf | w_temp,f | |
| swapf | w_temp,w | ; restore pre-isr W register |
| retfie | ; return from interrupt |
| ; |
| main: |
| ; |
| ;----------INITIALIZE------------- |
| ; setup GPIO, 2,3 (pins 5,4) as input, |
| ; 0,1,4,5 (pins 7,6,3,2) as output, |
| ; analog mode off |
| movwf | CMCON | ;digital I0 (Turn off the |
| movlw | 039h | ;Set GP<5:4:3:0> as inputs (0=out, |
| movwf | TRISIO | ;and set GP<2:1> as outputs |
| movlw | 00h | ;Don't turn on any weak |
| movwf | WPU | ;GP3 doesn't have a pullup |
| movlw | 87h | ;Disable weak pullups and GP2 |
| movwf | OPTION_REG | ;setup OPTION register. Enable |
| clrf | IOCB | ;Disable Interrupts for input |
| movlw | 01h | ;Enable A/D 0 (pin7) & A/D |
| movwf | ANSEL | ;Disable the other A/D inputs |
| movlw | 01h |
| movwf | PIE1 | ;Enabletimer 1 overflow interrupt |
| bsf | GPIO,2 | ;turn on the weak pullup |
| movlw | 81h | ;Right justify output, Vdd = |
| movwf | ADCON0 | ;select AD0, Turn on A/D power |
| movlw | 0C0h | ;Enable peripheral IRQs |
| movwf | INTCON | ;& disableTimer 0 IRQ and |
| external IRQ | |
| ; | and port change |
| IRQ |
| clrf | PIR1 | ;Clear IRQ flags |
| clrf | TMR1L |
| clrf | TMR1H |
| movlw | 31h | ;1:8 prescale,timer 1 ON |
| movwf | T1CON | ;andtimer 1 gate enabled |
| clrf | STATE |
| clrf | TIME |
| ; |
| ; |
| beginhere: |
| ; This is where the program will actually start. |
| ; Some setup items will occur before getting into the main loop |
| ; |
| ; Clear first half of RAM (Should disable IRQ first?-----------) |
| movlw | 20h | ;initialize pointer |
| movwf | FSR | ;to point at RAM |
| NEXT: clrf | INDF | ;clear the INDF register |
| incf | FSR,1 | ;increment the pointer |
| btfss | FSR,6 | ;maybe done? |
| goto | NEXT | ;no, keep at it |
| bsf | GPIO,1 | ;Green off |
| bsf | GPIO,2 | ;big LED off |
| ; | movlw | LOOPS | ;reset the loop counter |
| ; | movwf | LOOPCTR2 | ;to “LOOPS” value |
| ;Setup Timer 0 for Temperature and voltage checking |
| movlw | SEC5 | ;get the preset value |
| movwf | TMR0 | ;intotimer 0 |
| btfss | GPIO,3 | ;test GP3 for a low condition |
| goto | buttondown | ;perform button down sequence |
| ; | incfsz | LOOPCTR1,1 | ;don't check temp & Vcc very |
| often |
| ; | goto | Mainloop | ;delay 256 loops (might need more) |
| ; | decfsz | LOOPCTR2,1 | ;delay up to 65768 loops |
| ; | goto | Mainloop | ;more loops |
| ; | movlw | LOOPS | ;reset the loop counter |
| ; | movwf | LOOPCTR2 | ;to “LOOPS” value |
| ; Check the 5 second timer for Temperature and voltage checking |
| movf | TMR0,0 | ;Get thecurrent timer 0value |
| addlw |
| 1 | ;bump the count to get off |
| sublw | SEC5 | ;SEC5-TMR0. sets carry unless |
| btfss | STATUS,C | ;skip next if no carry (carry; C = |
| goto | Mainloop | ;go loopy |
| movlw | SEC5 | ;get the preset value |
| movwf | TMR0 | ;intotimer 0 |
| ; | clrwdt | ;Clear the prescaler |
| btfsc | STATE,LIGHTON | ;check if light is on |
| goto | lightison |
| call | convert1_off | ;since light is off, read off |
| battery voltage |
| ; Test that battery voltage is high enough |
| btfsc | VOFFH,1 | ;Test bit 1 of off voltage. |
| goto | low_battery | ;flag the low battery signal |
| btfss | VOFFH,0 | ;check the 0 bit of off |
| goto | high_batt | ;ifbit 0 = 1, must test the low |
| movlw | VMINL | ;get the minimum Vcc limit |
| subwf | VOFFL,0 | ;compare with the minimum |
| btfsc | STATUS,C | ;if C = 0 then voltage is OK |
| goto | low_battery |
| ;clear the low battery flag and light green light |
| bcf | STATE,UNDERVOLTAGE | ;voltage OK |
| bsf | STATE,UNDERVOLTAGE | ;voltage too low |
| call | convert1_on | ;read light-on battery voltage |
| ; Test that battery voltage is high enough |
| btfsc | VONH,1 | ;Test bit 1 of on voltage. |
| goto | low_battery | ;flag the low battery signal |
| btfss | VONH,0 | ;check the 0 bit of on |
| goto | high_batt | ;ifbit 0 = 1, must test the low |
| movlw | VMINL | ;Get the minimum Vcc limit |
| subwf | VONL,0 | ;compare with the minimum |
| btfsc | STATUS,C | ;if C = 0 then voltage is OK |
| goto | low_battery | ;If low |
| goto | high_batt | ;If high |
| Mainloopskp1: |
| ; Check diode temperature |
| call | convert0 | ;read temperature |
| call | Checkstate |
| goto | Mainloop |
| btfsc | GPIO,3 | ;is the button still down? |
| btfsc | GPIO,3 | ;check button a third time |
| goto | Mainloop | ;if not still down |
| ; Only turn on the big LED if STATE = 0 |
| clrw | | |
| iorwf | STATE,0 | ;check if STATE = 0 |
| btfsc | STATUS,Z | ;zero flag is 0 if STATE /= 0 |
| goto | turnon | ;go turn on the big LED |
| btfss | STATE,LIGHTON | ;is the big LED on? |
| goto | release_wait | ;if not, can't turn it on |
| call | stopall | ;lights off,timer stop, flags |
| bcf | GPIO,2 | ;turn on the big LED |
| bsf | STATE,LIGHTON | ;set the LED ON flag |
| movlw | TMR1SETH | ;load with 10240 counts at 976.562us |
| movwf | TMR1H | ;before next IRQ |
| movlw | TMR1SETL |
| movwf | TMR1L |
| movlw | TENS | ;prep TIME for count of 10s periods |
| movwf | TIME | ;set the time counter |
| bcf | PIR1,TMR1IF | ;clear any pending IRQ flag |
| bsf | STATUS, RP0 | ;Bank 1 |
| bsf | PIE1, TMR1IE | ;be sure timer 1 IRQ is |
| bsf | INTCON,GIE | ;global IRQ enabled |
| bsf | INTCON,PEIE | ;peripherial IRQ enabled |
| bcf | STATUS, RP0 | ;Bank 0 |
| bsf | T1CON,TMR1ON | ;enable timer |
| ; | movlw | LOOPS | ;reset the loop counter |
| ; | movwf | LOOPCTR2 | ;to “LOOPS” value |
| ; | clrf | LOOPCTR1 | ;To count idle loops & sync w/beeps |
| ; Synchronize the 5 second timer |
| movlw | SEC5 | ;get the preset value |
| movwf | TMR0 | ;into timer 0 |
| clrwdt | ;Clear the prescaler |
| call | beepone | ;execute a beep |
| btfss | GPIO,3 | ;test GP3 for high |
| goto | release_wait | ;loop if still low |
| btfss | GPIO,3 | ;test GP3 for high |
| goto | release_wait | ;loop if still low |
| btfss | GPIO,3 | ;test GP3 for high |
| goto | release_wait | ;loop if still low |
| goto | Mainloop | ;go back to main looping when |
| goto | loophere | ;Tightloop, wait for reset or IRQ |
| ; |
| ; |
| ; --------SUBROUTINES------------ |
| beepone: |
| clrf | ACCUMB | ;Clear the LS count location |
| bsf | GPIO,1 | ;1 start by pulling the |
| bcf | GPIO,1 | ;1 clear the output |
| decfsz | ACCUMB,1 | ;1 bump the counter and test, |
| goto | beeploop | ;2 keep at it |
| ; | call | convert1_on | ;read Vcc with light on |
| call | Checkstate | ;control the green LED state |
| ; reset the 5 second timer before it goes off |
| movlw | SEC5 | ;get the preset value |
| movwf | TMR0 | ;into timer 0 |
| ; | clrwdt | ;Clear the prescaler |
| ; |
| ; | movlw | LOOPS | ;reset the loop counter |
| ; | movwf | LOOPCTR2 | ;to “LOOPS” value |
| ; | clrf | LOOPCTR1 | ;To count idle loops & sync w/beeps |
| return | ; when done 255 cycles |
| * 7 inst cycles = .218s |
| ; |
| convert0: |
| ; A/D conversion on input AD0 to measure temperature of thermistor |
| ; Result is left in ADRESH and ADRESL |
| bcf | GPIO,1 | ;pull the other side of |
| the reference low | |
| ; | lights the green LED |
| also |
| bsf | ADCON0,1 | ;Start the conversion |
| btfsc | ADCON0,1 | ;check for done |
| goto | convert0_wait | ;keep checking til done |
| call | Checkstate | ;control the green LED state |
| movf | ADRESH,0 | ;Save temperature in THERH, THERL |
| movwf | THERH |
| btfss | THERH,0 | ;check for overtemp (>90C) |
| bsf | STATE,0 | ;set over temperature |
| btfsc | THERH,1 | ;check high order bit |
| bcf | STATE,0 | ;clear over temperature |
| ; |
| ; |
| ; |
| convert1_off: |
| ; A/D conversion on input AD1 to measure battery voltage |
| ; with the light off. |
| ; Result is left in VOFFH and VOFFL |
| bsf | STATUS, RP0 | ;Bank 1 |
| bsf | TRISIO,1 | ;Change GP/AD1 from output to |
| bsf | ANSEL,ANS1 | ;make AD1 active |
| bcf | TRISIO,0 | ;change GP0 (pin 7) from input |
| bcf | GPIO,0 | ;pullpin 7 low (GP0) |
| bsf | ADCON0,CHS0 | ;select pin 6, AD1 for |
| bsf | ADCON0,GO | ;Start the conversion |
| btfsc | ADCON0,NOT_DONE | ;check for done |
| goto | convert1_off_wait | ;keep checking til done |
| movf | ADRESH,0 | ;Save temperature in THERH, THERL |
| movwf | VOFFH | ;get the high bits |
| movf | ADRESL,0 | ;A/D low byte and TRISIO are inbank |
| movwf | VOFFL | ;get the low byte |
| bcf | TRISIO,1 | ;change pin 6 back to output |
| bsf | TRISIO,0 | ;change GP0 (pin 7) back to |
| bcf | ANSEL,ANS1 | ;inactivate AD1 |
| bcf | STATUS, RP0 | ;Bank 0 |
| bcf | ADCON0,CHS0 | ;reselect AD0 |
| ; |
| convert1_on: |
| ; A/D conversion on input AD1 to measure battery voltage |
| ; with the light on. |
| ; Result is left in VONH and VONL |
| bsf | STATUS, RP0 | ;Bank 1 |
| bsf | TRISIO,1 | ;Change GP/AD1 from output to |
| bcf | TRISIO,0 | ;change GP0 (pin 7) from input |
| bsf | ANSEL,ANS1 | ;make AD1 active |
| bcf | STATUS, RP0 | ;Bank 0 |
| bcf | GPIO,0 | ;pullpin 7 low (GP0) |
| bsf | ADCON0,CHS0 | ;select pin 6, AD1 for |
| bsf | ADCON0,GO | ;Start the conversion |
| btfsc | ADCON0,NOT_DONE | ;check for done |
| goto | convert1_on_wait | ;keep checking til done |
| movf | ADRESH,0 | ;Save temperature in VONH, VONL |
| movwf | VONH |
| bcf | TRISIO,1 | ;change pin 6 back to output |
| bsf | TRISIO,0 | ;change GP0 (pin 7) back to |
| bcf | ANSEL,ANS1 | ;inactivate AD1 |
| bcf | STATUS, RP0 | ;Bank 0 |
| bcf | ADCON0,CHS0 | ;reselect AD0 |
| bcf | TEMP1,1 | ;default to green-on. |
| btfsc | STATE,OVERTEMP | ;is diode too hot? |
| bsf | TEMP1,1 | ;green-off if hot. |
| btfsc | STATE,UNDERVOLTAGE | ;is battery too low? |
| bsf | TEMP1,1 | ;green-off if battery is |
| btfsc | TEMP1,1 |
| goto | CKstate_set |
| ; |
| ; |
| stopall: |
| ; Turn off the big LED |
| bsf | GPIO,2 | ;turn big LED off |
| bcf | T1CON,TMR1ON | ;stoptimer 1 |
| bcf | PIR1,TMR1IF | ;clear the IRQ flag |
| bcf | STATE,LIGHTON | ;clear the LED ON flag |
| call | Checkstate | ;set/reset the green LED |
| call | beepone | ;execute a beep |