Method according to the timetable auto-switching play channel
Technical field
The present invention relates to include in the product of information receiver, CPU, timing device and human-computer interaction interface, be meant a kind of method especially according to the timetable auto-switching play channel.
Background technology
Present various home appliance is tending towards the fusion of function, as: adorn clock on the radio, adorn personal digital assistant (PDA, Personal Digital Assistant) etc. on the mobile phone.Learn from other's strong points to offset one's weaknesses between the equipment, thereby can bring into play bigger effect.
Equipment real-time such as radio, aural receiver is very strong, and every day, the content of playing when per are all inequality, and a lot of content do not arrange to replay yet, and in a single day the listener misses to lose and be difficult to remedy like this.But, the program of broadcasting, TV station broadcasts generally all has fixing timetable, and very punctual mostly, so the radio of band alarm clock occurred, can remind the listener can in time listen to when program broadcasts like this.But the shortcoming of this method is: wireless accent platform is very inconvenient, the listener is if action inconvenient old man or children, or forgotten the frequency range that will select, perhaps just be busy with other thing, probably after some is in a rush and be unable to catch up with the beginning of program.
Also have a kind of PDA, can utilize PDA to carry out numeral and transfer platform, so both increased the recreational of PDA product, make wireless accent platform become simple again with function of radio receiver.And also have a timer in this PDA equipment, after arriving the schedule time, can produce an interruption and wake PDA up and make it work.But this equipment just carries out simple the combination with PDA with radio, does not make full use of the intelligent advantage of PDA, realizes that PDA is to wireless automatic control.Timer and radio in the equipment are not directly got in touch, and can't turn on radio when waking PDA up, according to user's the function of radio being transferred automatically platform that sets in advance, so still can not cause many inconvenience to the user.
Summary of the invention
In view of this, fundamental purpose of the present invention provides a kind of method according to the timetable auto-switching play channel, makes it can be by timetable that pre-sets and channel, opens automatically and information receiver is switched to predetermined channel.
For achieving the above object, technical scheme of the present invention specifically is achieved in that
A kind of method according to the timetable auto-switching play channel is applied to include at least in the equipment of CPU, storer, timing device and information receiver, and this method may further comprise the steps:
A. obtain reminder time and wave band by human-computer interaction interface;
B. deposit reminder time and wave band in be arranged in the storer data list, this data list includes reminder time, wave band and their corresponding relation at least;
C. obtain the current time, the scan-data tabulation, removing reminder time is current time data before, whether the judgment data tabulation is empty, if, then return step a, otherwise, steps d entered;
D. with remaining data according to time sequence, take out nearest reminder time, timing device is set according to nearest reminder time;
E. timing device work enters step f after arriving nearest reminder time;
F. obtain pairing wave band of this nearest reminder time;
G. obtain the current wave band that is positioned of information receiver, judge whether this nearest reminder time pairing wave band is identical with the current wave band that is positioned of information receiver, if return step c, otherwise, return step c after switching to pairing wave band of nearest reminder time.
The described data list of this method is when equipment obtains reminder time and wave band for the first time, is created in storer by CPU.
Human-computer interaction interface described in this method step a is a touch-screen.
Human-computer interaction interface described in this method step a is a keyboard.
The described step a of this method further comprises: obtain a plurality of reminder times and wave band repeatedly by human-computer interaction interface.
The described timing device of this method is a counter, and then the basis described in the steps d nearest reminder time is provided with timing device and specifically comprises:
D1. closing counter interrupts;
D2. get the current time, nearest reminder time deducted the current time obtain excess time, date of excess time is write the date register of counter, with excess time the time, divide the clock register that writes counter;
D3. open and enter step e after counter interrupts;
Described step e specifically may further comprise the steps:
E1. counter subtracts one;
E2. judge whether counter is 0, interrupt, enter step f, otherwise return step e1 if produce a counter.
Further comprise step f1 behind the described step f of this method: judge whether information receiver works, if, enter step g, otherwise, open information receiver, enter step g.
This method further comprises: an earphone is set, then further comprises step f2 behind the step f: judged whether that earphone connects, if, enter step g, otherwise, report to the police, return step f2.
The present invention has following characteristics:
The user can be provided with a plurality of wave bands and reminder time at any time arbitrarily.
When arriving set reminder time, set wave band can be opened and forward to equipment automatically by this method: when the arriving reminding time, and the user is using, and when other wave band, can switch to set wave band by force; When arriving reminding during the time, CPU is in dormant state, will wake CPU up, and whether check simultaneously has earphone, if no, send alarm sound, and wait for the connection of earphone, if having, then further whether fox message receiving trap state is opened, and if not, then it is opened.
After the switching that completes successfully set wave band, equipment can be reset data list and timing device, opens equipment automatically and is transformed into set wave band when arriving nearest reminder time.
By such scheme as can be seen, a kind of method provided by the present invention according to the timetable auto-switching play channel, be skillfully constructed, simplicity of design, practical, realize easily, and applicable to plurality of devices, under the situation that need not add other device, can realize opening and switching automatically the function of broadcasting channel, for the user brings great convenience according to the timetable that presets.
Description of drawings
Fig. 1 is provided with the process flow diagram of data list sum counter for the inventive method embodiment;
Fig. 2 is the process flow diagram of the inventive method embodiment interrupt service routine;
Fig. 3 is the CPU of PDA in the inventive method embodiment equipment and the logic connection diagram of FM receiver part.
Embodiment
Below in conjunction with drawings and the specific embodiments the present invention is described in further detail again:
With a PDA equipment that can receive frequency modulation broadcasting is example, this equipment has the function by PDA operation frequency modulation broadcasting, adopt the MC68VZ328 CPU of Motorola Inc. (Motorola), and in PDA, there is a counter to can be used as timing device, after arriving the schedule time, can produces the CPU that a counter interrupts waking up among the PDA and make it work.
Realize can finishing by following steps for this equipment according to the timetable auto-switching play channel:
At first, wave band and the reminder time that listen to is provided with in equipment; Promptly the counter to data list in the device memory and equipment pre-sets.Referring to shown in Figure 1, specifically realize by following step:
Step a: obtain reminder time and wave band by human-computer interaction interface; Touch-screen that is the user by PDA or keyboard input will be selected the wave band and reminder time of listening to, and can once import a plurality of wave bands and reminder time.
Step b: deposit reminder time and wave band in data list, this data list includes reminder time, wave band and their corresponding relation at least; Be that CPU deposits reminder time and the wave band that the user imports in place in the storer data list correspondingly.If use for the first time, then CPU at first creates a data tabulation in storer, then reminder time and wave band are deposited in wherein, if the user has imported a plurality of wave bands and reminder time, then CPU can deposit reminder time and the wave band that obtains in data list repeatedly from human-computer interaction interface.
Step c: may further comprise the steps:
C1. obtain the current time, the data before the current time are removed reminder time and are in scan-data tabulation, promptly by the scan-data tabulation, the data in the data list are compared with the current time, get rid of current time reminder time and wave band before;
C2. whether the judgment data tabulation is empty, if, then return step a, wait for the new reminder time and the input of wave band, otherwise, enter steps d.
Steps d: earlier with remaining data according to time sequence, take out nearest reminder time, timing device is set according to nearest reminder time; Timing device in this equipment is a counter, to its concrete setting up procedure is:
D1. closing counter earlier interrupts;
D2. get the current time, changed into the relative time of current time nearest reminder time; Promptly deduct the current time, obtain the remaining time, more remaining fate is write the date memory of counter, when remaining, divide the clock storer that writes counter with nearest reminder time;
D3. reopen counter and interrupt, finish.
Arrive this, setting completed for the data list sum counter.
Then, the counter of equipment begins to carry out the interrupt routine of counter, that is:
Step e: counter is constantly carried out and is subtracted 1 operation, until by 0 o'clock, produces a counter and interrupts, and makes CPU carry out interrupt service routine.The effect of this counter interrupt instruction is no matter whether CPU was in running order at that time, all CPU is entered pressure and carries out interrupt service routine described below.
At last, CPU carries out interrupt service routine, and detailed process is referring to shown in Figure 2:
Step f: obtain pairing wave band of this nearest reminder time; Promptly from data list, access pairing wave band of this reminder time, be designated as A.
Behind step f, further judge:
F1. whether there is earphone to connect, if, enter step f2, otherwise, report to the police and return f1 and continue to judge, up to the connection of earphone;
F2. judge whether the radio part is play, if, enter step g, otherwise, step g entered behind the unlatching radio.
Step g: obtain the current in progress wave band of radio part, be designated as B, judge whether A=B, if, then return step c, otherwise, step c returned after switching to wave band A.
Like this, equipment is tabulated to data again and is put in order and be provided with, and enabling counting device interrupt routine is waited for the generation of counter interruption next time then, enters interrupt service routine, and circulation so repeatedly is till data list is sky.
Because cyclic process each time all can be upgraded again, the sorting data tabulation, thereby prevented losing and confusion of data, and when obtaining new reminder time and wave band at every turn, equipment also can carry out the arrangement step to tables of data, the user just can import new reminder time and wave band at any time like this, and can not influence the operate as normal of equipment.
Method for the switching FM wave band described in the present embodiment step g can be finished by 4 road signal wires, its logical organization as shown in Figure 3:
Have a wireless PDA of FM in the present embodiment, its radio part 301 comprises 4 control lines handling CS, DIN, CLK and DOUT signal with the main interface of the CPU302 of PDA.
The CS signal uses mainly as chip selection signal, and promptly as an external unit, this chip selection signal is exactly the enable signal of this outside equipment to PDA radio part 301.When its level when being high, gating radio part 301, and operate on it, when its level when being low, radio part 301 still can operate as normal, but all cannot realize its any operation of carrying out.
The DIN signal mainly is to use as data input signal, when chip selection signal be a height and at CLK signal negative edge the time, the CPU302 of PDA is delivered to radio part 301 to control data by DIN, thereby reaches the purpose of regulating and controlling radio 301.
The CLK signal mainly is to use as the clock signal of data, and when chip selection signal when being high, the synchronous clock that provides of CLK signal is provided in the transmission of the signal of its DIN and DOUT.
The DOUT signal mainly is the signal use as data, when chip selection signal is effective, by the negative edge of CLK signal, in the CPU302 of PDA, the CPU302 of PDA just can learn the duty that radio part 301 is present to radio part 301 like this data transfer.
Having the wireless PDA equipment of FM in the present embodiment uses very easy, wave band and time that the user only needs input will select to listen in use get final product, the input of wave band and time is one group of user interface (UI, User Interface), therefore common user promptly can operate easily.
Below just for the example that can receive the PDA of frequency modulation broadcasting, certain method of the present invention is not limited to the equipment among the embodiment, also can be applicable to other as: include the aural receiver of CPU, storer, timing device and human-computer interaction interface, the equipment such as radio of medium wave and other wave band.