A kind of variable breathing indicating lamp device and control method thereofTechnical field
The present invention relates to a kind of pilot lamp, particularly relate to computer breathing indicating lamp device and control method thereof that a kind of user can change color and frequency voluntarily arbitrarily.
Background technology
Pilot lamp is a vitals of main frame, is used to refer to different conditions such as computing machine operate as normal, standby.The main frame pilot lamp generally uses the common double colored lights at present, and green light is bright during the main frame operate as normal, and amber light is bright during the main frame standby.Like this, on the one hand, owing to pilot lamp is a pointolite, illuminate to be limited in scope, indicating effect is not obvious; On the other hand, as most important pilot lamp on the cabinet, the light of main frame pilot lamp is too dull, makes whole main frame seem ice-cold, torpescence, shortage vitality.
Occur computer in the market and breathed pilot lamp, this breath light has thoroughly changed the traditional concept of computer pilot lamp, it glimmers with the progressive rhythm formula of uniqueness and indicates the current ruuning situation of computer, just as a people is undisturbedly breathing, has increased the rhythm of life to computer.
But color, the state of breathing pilot lamp at present are single, and have all been pre-determined by computer vendors, and the user does not select when buying.In use, even the user has been weary of color, the respiratory rate of the pilot lamp that remains unchanged for a long period of time, the user also can't change.And, user even can't select to close breath light.
And breathe the flicker control that pilot lamp glimmers, and generally all realizing, as utilize the flicker of pulse signal control pilot lamp by simple circuit, after hardware circuit design was intact, the flicker of pilot lamp was just definite, and the user can't arbitrarily change.
Summary of the invention
The technical problem to be solved in the present invention is the shortcoming and defect at above technology, has proposed a kind of novel transformable host computer and has breathed indicating lamp device and control method thereof.
The objective of the invention is to be achieved through the following technical solutions:
A kind of variable breathing indicating lamp device comprises control circuit board and pilot lamp, and described pilot lamp has a multicolor luminous body, is electrically connected with described control circuit board; Described control circuit board comprises microprocessor unit, is used for to the electric source filter circuit of control circuit board power supply with in order to realize the conversion chip of PC and microprocessor communication; Power supply on the PC motherboard provides power supply by described electric source filter circuit to control circuit board, and microprocessor is realized communicating by letter by conversion chip and PC.
Described microprocessor unit comprises a single-chip microcomputer, crystal oscillating circuit and the necessary auxiliary capacitor of single-chip microcomputer and the resistance of work clock is provided for single-chip microcomputer.
Described control circuit board also comprises first socket, second socket, the 3rd socket, and pin PDG, PDY that first socket is corresponding with mainboard connect, to obtain the work state information of main frame; Second socket is connected with the 5V power supply of PC main frame, powers to circuit board; The 3rd socket is connected with the serial ports of PC mainboard, and the realization main frame is communicated by letter with single-chip microcomputer.
Described luminophor is a Tricolor LED.Described light emitting diode has four pins, one of them common anode, three negative electrodes, and three each corresponding a kind of colors of negative electrode, and be connected with three I/O ports of single-chip microcomputer respectively.
Described pilot lamp also comprises lamp cover and lampshade, and the lamp cover is a lighttight column type sleeve, and light emitting diode is arranged in the lamp cover, and lampshade is the translucent diffused light type cover body of circular flat, is installed in the outer face of lamp cover.
A kind of control method of variable breathing indicating lamp device, this control method comprises:
Pilot lamp instep 20 main frame is provided with behind the running software to be preserved the data file that parameter is set of user last time by the PC end and sends the corresponding command to the I/O of control circuit port;
After step 30 control circuit receives order, come the change and the operation of tutorial light state by the program in the microprocessor on the control circuit board.
The control method of described variable breathing indicating lamp device also comprises:
Step 10 user is provided with the indication parameter that software is reset pilot lamp by the pilot lamp that is installed on the PC end, and is used for storing the data file that the user is provided with parameter with what this parameter was kept at that PC end is provided with.
Wherein,step 10 also comprises: step 101 main frame is when normal operating conditions, if the user is provided with software by PC end pilot lamp and resets pilot lamp, then PC holds pilot lamp that software is set and can send corresponding order by the microprocessor serial ports in variable breathing indicating lamp device, thereby causes that the microprocessor serial ports produces interruption; Step 102 microprocessor program can respond interruption, reads the command code that PC sends to serial ports, then decoding; Step 103 microprocessor program at first stores parameter is set, and judges the type that parameter is set then; Step 104 is according to the type of parameter, and the control pilot lamp enters corresponding indicating status.
Wherein, describedstep 20 comprises: after step 201 pilot lamp is provided with the running software program, at first microprocessor serial ports in the variable breathing indicating lamp device is carried out the serial ports initialization, comprise parameters such as serial ports, serial communication mode, baud rate are set; After the initialization of step 202 serial ports, program reads the pilot lamp parameter that the user was provided with last time in a data file of PC end preservation, sends to serial ports of computers and with pilot lamp the corresponding command code of parameter is set.
Wherein, step 30 comprises: after the described microprocessor of step 301 receives order, operation at first is provided with parameter to microprocessor serial ports and pilot lamp in the variable breathing indicating lamp device and carries out initialization, and the serial ports initialization comprises serial communication mode, the isoparametric setting of baud rate; Step 302 is judged the duty of main frame then by two pin signals of PDG, PDY on the inquiry mainboard; The duty that step 303 is different according to main frame, program read the parameter that is provided with of default or storage, and pilot lamp enters corresponding indicating status.
Wherein, the indicating status of described pilot lamp, the user can by PC end software is set button setting is set: when main frame during in normal operating conditions, the user can select pilot lamp to breathe or Chang Liang by the button that is provided with that pilot lamp is provided with on the software interface, breathe if select, then the user also can be provided with the color and the respiratory rate of breathing pilot lamp, if select Chang Liang, then the user can be provided with the color of normal bright pilot lamp; When main frame entered holding state, pilot lamp was by the time interval circulation flicker of setting, and the user can be provided with the color of flashing indicator light; When main frame entered off-mode, pilot lamp was closed.
Wherein, the respiratory rate of described pilot lamp realizes by the program in the microprocessor, the PWM ripple of the microprocessor I/O mouth output duty cycle circulation change that this programmed control is connected with pilot lamp.The dutycycle of described varying cyclically PWM ripple is meant dutycycle from 0 to 100%, again from 100% to 0 circulation change.
By above scheme as can be known, use user when of the present invention can by in the computing machine subsidiary one the setting that software is revised pilot lamp easily voluntarily is set, comprise the respiratory function of opening, closing pilot lamp, change breathe pilot lamp color, respiratory rate etc.; Like this, breathing pilot lamp can more rich and varied than the past, more have vitality, thereby satisfies the demand that the user is more personalized, change.
Description of drawings
Fig. 1 is the variable breathing indicating lamp structure of a present invention synoptic diagram;
Fig. 2 is a control circuit schematic diagram of the present invention;
Fig. 3 is a PC main program flow chart of the present invention;
Fig. 4 is a single-chip microcomputer main program flow chart of the present invention
Fig. 5 is a breather program flow diagram of the present invention.
Embodiment
Below, the description by specific embodiment and the present invention is described in further detail with reference to the accompanying drawings.
Embodiment 1:
As shown in Figure 1, the structure division of apparatus of the present invention mainly contains three parts compositions:lamp cover 1, high brightness frosted Tricolor LED (LED) 2 and lampshade 3.Control circuit board does not draw in the drawings, and it is connected withLED.Lamp cover 1 is a column type sleeve, and is light tight, andlight emitting diode 2 is placed in the lamp cover 1.Lampshade 3 is translucent diffused light type lampshades of a circular flat, and it is in the outside of lamp cover 1.When indicating lamp device was installed on the mainframe box panel, the outside surface oflampshade 3 and case front panel front surface were in same plane, andlamp cover 1 andlight emitting diode 2 are in case front panel.According to the practical design situation, indicating lamp device also can not comprise lamp cover 1.Because the physical characteristics of the material of translucent diffusedlight type lampshade 3 itself, thelight transmission lampshade 3 thatlight emitting diode 2 is launched produces uniform halation.In addition, pilot lamp also can be located on the display.
Variable pilot lamp is by the pilot lamp in the main frame software to be set to realize with the control circuit board that is contained in the computer mainframe box front panel.The pilot lamp of opening in the main frame is provided with software, pilot lamp can occur the interface is set, and can reset the state of pilot lamp, comprises color and respiratory rate etc.The color of pilot lamp has blueness, redness, green, option such as orange, and the respiratory rate of pilot lamp has soon, waits normally, slowly option.
The change of led status is by pilot lamp software to be set to send the corresponding command, carried out by control circuit, and the control circuit principle as shown in Figure 2.Wherein single-chip microcomputer U1 is the core of control circuit, and the change of led status and operation are promptly operated by the program in the single-chip microcomputer.
The single-chip microcomputer U1 that the present invention selects for use is the AT89C2051 of MCS51 series, also can select to have other singlechip chips of similar functions.The control circuit part mainly is made up of this chip, and crystal oscillator provides work clock for single-chip microcomputer, and some other auxiliary capacitor and resistance are necessary ingredients of Single Chip Microcomputer (SCM) system, and magnetic bead L1 andcapacitor C 4, C5 are to power filter.Main frame pilot lamp PLED is a Tricolor LED LED, the change that realizes breathing the pilot lamp different colours.This three-color LED light has four pins, one of them common anode, three negative electrodes.Three respectively corresponding red, blue, green three kinds of different colors of negative electrode.3 I/O ports of single chip computer AT 89C2051 are connected with 3 negative electrodes of PLED respectively, also can be connected with the negative electrode of PLED with other I/O ports of single-chip microcomputer.Each of light emitting diode is anodal to be connected with positive source by a resistance.
Because PC is different with the level of single-chip microcomputer,, use chip U2 to carry out level conversion in order to realize the serial communication between them.U2 can adopt the MAX232 chip, and its T1IN, R1OUT pin are connected with TXD, the RXD pin of single-chip microcomputer respectively, R1IN, T1OUT respectively with the TXD of PC serial ports,, the RXD pin connects.By chip MAX232, transmit data by serial ports between single-chip microcomputer and the PC.In addition, single-chip microcomputer and PC also can communicate by USB interface.
Have three sockets on the circuit board, the pin that J1 is corresponding with mainboard connects, and wherein two pins of PDG, PDY have reflected the different operating state of main frame; J2 is connected withmain frame 5V power supply, powers to circuit board; J3 is connected with the serial ports of mainboard, and the realization main frame is communicated by letter with single-chip microcomputer.
The PC end provides a pilot lamp of writing with VC that software interface is set, and the different buttons that is provided with is provided on the interface, and the user can be by clicking the state that these buttons change pilot lamp.Software operation automatically after start is set, and the user can close this software, also can oneself move this software.For the pilot lamp of preserving the user is provided with state, PC end provides a data file to preserve the parameter that is provided with of user last time.
The pilot lamp that software interface provides for the user is provided with function: when main frame during in normal operating conditions, the user can select pilot lamp to breathe or Chang Liang, breathe if select, then the user also can be provided with the color and the respiratory rate of breathing pilot lamp, if select Chang Liang, then the user can be provided with the color of normal bright pilot lamp.When main frame enters holding state, pilot lamp flicker (circulate bright 2 seconds, went out 2 seconds), the user can be provided with the color of flashing indicator light.When main frame entered off-mode, pilot lamp was closed.
The program flow diagram that pilot lamp is provided with software as shown in Figure 3.After the program run, at first carry out the serial ports initialization, comprise parameters such as serial ports, serial communication mode, baud rate are set.After the serial ports initialization, program reads the last pilot lamp parameter that is provided with of user from data file, sends to serial ports of computers and with pilot lamp the corresponding command code of parameter is set, after single-chip microcomputer receives order, pilot lamp can enter corresponding state, and this state is the state that the user was provided with last time.
If the user resets led status by software interface, program can receive a message from operating system, thereby learns that the user has reset parameter, so program reads the new parameter that is provided with, and Parameters Transformation will be set for corresponding command code, send to serial ports.Program stores the newly-installed pilot lamp parameter of user into data file simultaneously.Close software or shutdown, EOP (end of program).
Single-chip microcomputer (slave computer) program flow diagram as shown in Figure 4.At first carry out serial ports and pilot lamp parameter initialization is set, the serial ports initialization comprises serial communication mode, the isoparametric setting of baud rate.Judge the duty of main frame then by two pin signals of PDG, PDY on the inquiry mainboard.The duty different according to main frame, pilot lamp enters corresponding indicating status.
If main frame is in normal operating conditions, program reads the parameter that is provided with of default or storage, and pilot lamp enters corresponding breathing or normal bright state.If the user resets pilot lamp by PC end software, then PC holds software to send corresponding order to serial ports, thereby causes that microcontroller serial port produces interruption, and Single Chip Microcomputer (SCM) program can respond interruption, reads the command code that PC sends to serial ports, then decoding.Program is at first stored parameter is set, and judges the type that parameter is set then.If color parameter, then no matter current pilot lamp is to breathe, or Chang Liang, and pilot lamp can become the color that the user is provided with; If frequency parameter, then pilot lamp can be breathed with the frequency that the user is provided with; If normal bright parameter, pilot lamp can be closed breathing, enters normal bright state.
If main frame is in holding state, program reads the color parameter of storage, and pilot lamp enters corresponding blink states.If the user resets the color that pilot lamp glimmers by PC end software, then because PC end software can send corresponding the order to serial ports, microcontroller serial port can produce interruption, the Single Chip Microcomputer (SCM) program response is interrupted, read PC and send to the command code of serial ports, indicator light colors is obtained in decoding then.Behind the color parameter that storage is provided with, pilot lamp can be with the newly-installed chromatic flicker of user.
If main frame is in off-mode, pilot lamp is closed.
The process flow diagram of the subroutine of realization pilot lamp respiratory function as shown in Figure 5 in Single Chip Microcomputer (SCM) program.The PWM ripple of the single-chip processor i/o mouth output duty cycle circulation change that its major control is connected with pilot lamp, thus make pilot lamp as the breathing flicker that circulates.The dutycycle of varying cyclically PWM ripple makes dutycycle from 0 to 100%, again from 100% to 0 circulation change.Like this, the electric current of pilot lamp correspondingly also can be from small to large, circulation change from big to small, so pilot lamp more just can be as the breathing flicker that circulates.
It should be noted that at last: above embodiment is the unrestricted technical scheme of the present invention in order to explanation only, although the present invention is had been described in detail with reference to the foregoing description, those of ordinary skill in the art is to be understood that: still can make amendment or be equal to replacement the present invention, and not breaking away from any modification or partial replacement of the spirit and scope of the present invention, it all should be encompassed in the middle of the claim scope of the present invention.