AbstractA musical apparatus which outputs music under the control of various musical control instructions where the desired musical control instructions are reliably determined by the movement of an object in an operation space, and where the musical control instructions are varied by changing the state of motion of the object in space.The musical apparatus performs musical control instructions whose contents are based on
the state of motion of an object in motion within a specified operation space. The musical apparatus may have at least one light source which shines light into said operation space, at least one light sensor which receives light which has been reflected by an object in the space so that it has at least two light paths which reach from the light source to the light sensor via the object, so that a detection values is output according to the quantity of light received via a respective one of the light paths, and a musical controller which outputs music and controls a musical function when the correlation between the current values of the detection values of the various paths satisfies a specified relationship.Claims
We claim:
1. An electronic musical system which responds to the motion of an object within a specified space to control a sound function, wherein the electronic musical system comprises:
at least one radiation source that emits radiation into the specified space;
at least one sensor that receives radiation reflected along at least two different paths from an object in the specified space and provides at least one detection value corresponding to a characteristic of radiation received from the two paths; and
a controller for generating a control signal for operating the sound function based on the detection value.
2. The system of claim 1, wherein the at least one radiation source that emits radiation comprises a light source that emits at least one light beam and wherein the at least one sensor that receives radiation from each of the at least two different paths comprises at least two light detectors for detecting light in at least two light paths.
3. The system of claim 1, wherein the sound function is an audio signal.
4. The system of claim 1, wherein the sound function is a tone signal.
5. The system of claim 1, wherein the controller comprises a central processing unit.
6. The system of claim 1, wherein the controller comprises a digital signal processor.
7. The system of claim 1, further comprising a sound source comprising a storage device for storing multiple tone waveform data, the multiple tone waveform data being readable for producing the sound function.
8. The system of claim 1, wherein the characteristic of the radiation comprises magnitude of radiation.
9. A method of controlling music based on the motion of an object within a specified spate, the method comprising:
receiving radiation reflected from an object within the specified space along at least two light paths;
generating information based on a characteristic of radiation received from each of the at least two light paths;
receiving performance data from a performance signal source;
generating an audio signal based on the performance data; and
controlling a characteristic of the audio signal based on the generated information.
10. A method as recited in claim 9, wherein receiving radiation reflected from an object comprises receiving light reflected from an object.
11. The method recited in claimed 9, wherein receiving performance data from a performance signal source comprises receiving performance data from a digital music signal source.
12. The method recited in claim 9, wherein receiving performance data from a performance signal source comprises receiving
performance data from a Musical Instrument Digital Interface ("MIDI") signal.
13. The method recited in claim 9, wherein generating information based on a characteristic of radiation received from each of the at least two paths comprises:
generating at least two detection values, each of which is based on a characteristic of radiation received from each of the at least two paths;
detecting a maximum value of each of the at least two detection values; and
controlling a characteristic of the audio signal based on a correlation between the maximum values of the at least two detection values.
14. The method recited in claim 9, wherein the audio signal is a tone signal.
15. The method recited in claim 9, wherein generating information based on a characteristic of the radiation received from each of the at least two paths comprises generating information based on a quantity of radiation received from each of the at least two paths.
16. The method recited in claim 13, wherein generating at least two detection values, each of which is based on a characteristic of radiation received from each of the at least two paths comprises generating at least two detection values, each of which is based on a quantity of light received from each of the at least two light paths.
17. A method of controlling and outputting music based on the motion of an object within a specified space, the method comprising:
receiving radiation reflected from an object within the specified space,
controlling a characteristic of the received radiation by moving the object within the specified space;
generating a detection value based on the characteristic of the received radiation;
receiving performance data from a performance signal source;
generating an audio signal based on the performance data,
outputting the audio signal; and
controlling the audio signal based on the detection value.
18. A method as recited in claim 17, further comprising emitting radiation into the specified space.
19. A method as recited in claim 18, wherein emitting radiation comprises emitting light and wherein receiving radiation comprises receiving reflected light.
20. A method as recited in claim 17, wherein receiving radiation comprises receiving light reflected from the object within the specified space.
21. A method as recited in claim 17, wherein receiving radiation comprises receiving light reflected along at least two paths from the object and wherein generating a detection value comprises generating a value dependent upon a characteristic of light received along the at least two paths.
22. The method recited in claim 17, wherein the audio signal is a tone signal.
23. The method recited in claim 17, wherein generating a detection value based on a characteristic of the received radiation comprises generating a detection value based on the quantity of the received radiation.
24. The method recited in claim 18, wherein receiving performance data from a performance signal source comprises receiving performance data from a digital music signal source.
25. The method recited in claim 18, wherein receiving performance data from a performance signal source comprises receiving performance data from a Musical Instrument Digital Interface ("MIDI") signal.
26. The method recited in claim 18, further comprising:
detecting a peak value of the detection value; and
controlling a characteristic of the audio signal when the peak value is detected.
27. An electronic musical apparatus which responds to the motion of an object within a specified space to control the music output by said electronic musical apparatus, wherein said electronic musical apparatus comprises:
at least one radiation sensor which receives radiation reflected from an object within said specified space and providing
a detection value corresponding to a characteristic of radiation received by said light sensor,
a threshold detector for detecting a condition in which the detection value passes a predefined threshold;
a signal generator which generates music; and
a musical controller which, upon the detection value passing the threshold, controls the music generated by said signal generator.
28. An apparatus as recited in claim 27, further comprising a radiation source for emitting radiation into the specified space.
29. An apparatus as recited in claim 28, wherein the radiation source comprises a light source and the radiation sensor comprises a light sensor.
30. An apparatus as recited in claim 27, wherein the radiation sensor comprises a lift sensor.
31. An apparatus as recited in claim 27, wherein the characteristic of the radiation comprises the quantity of radiation.
32. A method of controlling and outputting music based on the motion of an object within a specified space, said method comprising:
receiving radiation from an object within the specified space;
generating at least one detection value based on a characteristic of radiation received from the object;
detecting a condition in which the detection value exceeds a predefined threshold; and
outputting music and modifying the outputted music upon the detection value exceeding the predefined threshold.
33. A method as recited in claim 32, further comprising emitting radiation into the specified space.
34. A method as recited in claim 33, wherein the radiation comprises a light.
35. A method as recited in claim 32, wherein the radiation comprises a light.
36. An apparatus as recited in claim 32, wherein the characteristic of the radiation comprises the quantity of radiation.Description
FIELD OF THE INVENTION
The field of the invention is electronic musical apparatuses such as electronic musical instruments, music-related sound generation devices, music-related sound modification devices, and their controllers, including, for example, synthesizers, keyboards, drum machines, effects processors, effects pedals, sequencers and sound modules. More specifically, the electronic musical apparatus embodying the invention is controlled by detecting the location and/or movement of an object (e.g., a hand) within a space by using a light beam, including an infrared light beam.
BACKGROUND OF THE INVENTION
Non-contact musical control devices have been known in the past which issue control instructions by optically detecting the movement of a hand or the like within a specified space. These devices provided a pair consisting of one light source (infrared emitting diode or the like) which shines a light into the space and one light receiving element (infrared sensor or the like) which receives the light of the light source which has been reflected by the hand when said hand proceeds into said space, and if reflected light was received by the light receiver, the device performed a switch-like control which turned the instruction for a specified operation ON when said received light quantity exceeded a certain threshold value, and turned it OFF when it was below the threshold value.
The intensity distribution of the light beam irradiated from the light source in the conventional non-contact musical control devices described above is as shown, for example, in FIG. 26. In this case, the light quantity received by the light receiver will differ, even if the hand is held at the same height from the light receiver, when the hand is held directly above the light source as compared to when it is held to the side. Consequently, in a case where ON/OFF operation instructions are performed according to whether or not the quantity of received light exceeds a specified threshold value, the probability of erroneous operation is high if the operation instruction is performed based purely on the height of the hand as the only scale. In other words, a problem with this type of prior musical control device is that it was difficult for the operator to discern at what proximity to the sensor the switch will be turned ON or OFF. In addition, the type of the operation instruction was limited to whether to perform a certain control, i.e., no more than the binary ON/OFF control of a single specified process could be accomplished.
SUMMARY OF THE INVENTION
Electronic musical apparatuses described herein include electronic musical instruments, music-related sound generation devices, music-related sound modification devices, and their controllers, including, for example, synthesizers, keyboards, drum machines, effects processors, effects pedals, sequencers and sound modules.
A first, separate aspect of the invention is an electronic musical apparatus which executes desired operation instructions more accurately by detecting the characteristics of the movement of an object within an operation space, and further performing a variety of types of operation instructions in response to the state of motion of the object.
A second, separate aspect of the invention is an electronic musical apparatus which is able to distinguish between various types of movement of an object in an operation space.
A third, separate aspect of the invention is an electronic musical apparatus which is able to determine whether an object in moving from right to left, or left to right, in the operation space, and to control a musical function based on the direction of movement of the object.
A fourth, separate aspect of the invention is an electronic musical apparatus which is able to determine whether an object in moving horizontally or vertically relative to the light sensor and to control a musical function based on the direction of movement of the object.
A fifth, separate aspect of the invention is an electronic musical apparatus which controls a first musical function based on the horizontal movement of an object in the operation space and controls a second musical function based on the vertical movement of the object.
A sixth, separate aspect of the invention is an electronic musical apparatus which detects the peak value of the detection value of light reflected off an object in space and controls a musical function based on the peak value.
A seventh, separate aspect of the invention is an electronic musical apparatus which detects a detection value for each light path from light source to the object in space to the light receiver and controls a musical function based on a relationship between the detection values.
A eighth, separate aspect of the invention is an electronic musical apparatus in which the axes on which the light beams of the light sources incline outwardly from one another.
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a drawing showing the hardware configuration of an electronic musical instrument as an example embodiment of the invention.
FIG. 2 is a drawing showing the panel configuration of the device of the example embodiment of FIG. 1.
FIG. 3 is a drawing explaining the data structure of a phrase which is used in the device of the embodiment of FIG. 1.
FIG. 4 is a drawing showing the structure of data which is stored in RAM in the device of the embodiment of FIG. 1.
FIG. 5 is a drawing showing the equal-level curves of detection value RA and detection value RB in the device of the embodiment of FIG. 1, as viewed from the side.
FIG. 6 is a drawing showing the characteristics of detection value RB and detection value RB when an object has passed over the sensor in the horizontal direction in the device of the embodiment of FIG. 1.
FIG. 7 is a drawing showing the characteristics of the values stored in the Amax register and the Bmax register when an object has passed over the sensor in the horizontal direction in the device of the embodiment of FIG. 1.
FIG. 8 is part one of a two-part flow chart of the main routine in the device of the embodiment of FIG. 1.
FIG. 9 is part two of a two-part flow chart of the main routine in the device of the embodiment of FIG. 1.
FIG. 10 is part one of a two-part flow chart of the timer interrupt routine in the device of the embodiment of FIG. 1.
FIG. 11 is part two of a two-part flow chart of the timer interrupt routine in the device of the embodiment of FIG. 1
FIG. 12 is a flow chart showing the processing in the light emitting diode 1A in the device of the embodiment of FIG. 1.
FIG. 13 is a drawing showing a typical example of the display screen during Mode 1 in the device of the embodiment of FIG. 1.
FIG. 14 is a drawing showing a typical example of the display screen during Mode 2 in the device of the embodiment of FIG. 1.
FIG. 15 is a drawing showing a typical example of the display screen during Mode 3 in the device of the embodiment of FIG. 1.
FIG. 16 is a drawing showing a typical example of the display screen during Mode 4 in the device of the embodiment of FIG. 1.
FIG. 17 is a drawing showing a typical example of the display screen during Mode 5 in the device of the embodiment of FIG. 1.
FIG. 18 is a drawing showing a typical example of the display screen during Mode 6 in the device of the embodiment of FIG. 1.
FIG. 19 is a drawing showing a typical example of the display screen during Mode 7 in the device of the embodiment of FIG. 1.
FIG. 20 is a drawing showing a typical example of the display screen during a mode which performs an operation based also on the motion velocity of the object in the device of the embodiment of FIG. 1.
FIG. 21 is a flow chart showing the main routine in another example embodiment of the invention.
FIG. 22 is a flow chart showing the timer interrupt routine in another example embodiment of the invention.
FIG. 23 is a side view of an example configuration of light emitting diodes and a sensor as another example embodiment of the invention.
FIG. 24 is a side view of an example configuration of a light emitting diode and a sensor as yet another example embodiment of the invention.
FIG. 25 is a side view of an example configuration of light emitting diodes and a sensor as still another example embodiment of the invention.
FIG. 26 is a drawing explaining the radiation characteristics of light emitting diodes in an example of the prior art.
LEGEND
1A, 1B infrared light emitting diodes
2, 2A, 2B infrared sensors
3 CPU (Central Processing Unit)
4 main ROM (Read Only Memory)
5 RAM (Random Access Memory)
6 operation elements and displays on panel
7 sequencer
8 sound source
9 effecter
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
The various embodiments of the invention will be explained below with reference to the figures.
A first embodiment of the invention is an electronic musical apparatus which outputs music and performs musical control instructions
based on the state of motion of objects in motion within a specified operation space. The first embodiment includes an optical element which has at least one light source which shines light into said operation space and at least one light sensor which receives light which has been reflected by an object in the operation space so that it has at least two light paths which travel from the light source to the light sensor via the object. The first embodiment outputs a detection value respectively based on the quantity of light received via each of the paths. The embodiment includes a signal generator which generates music and a musical controller which, when the correlation between the current values of the detection values satisfies a specified relationship, controls a musical function of the music being generated.
Since this musical apparatus allows musical control instructions to be performed when the correlation between the detection values of the various paths satisfy a specified relationship (for example, when they reach the same value) based on the detection values of light reflected from an object from at least two paths, the position of the object within the operation space can be more easily and accurately determined as compared to a conventional device having one light source and one light sensor. As a result, the operator can more accurately control the timing of the generation of the musical control instruction by moving and manipulating the object.
For instance, in the first embodiment, the optical element comprises two light sources and a light sensor situated at the midway position between the two light sources on a straight line, and each light source emits chronologically alternating lights and the lights from the respective light sources are received by the light sensor in a time multiplexed fashion. Consequently, two types of detection signals are obtainable. Thus, the operator can more accurately control the timing of the generation of the musical control instruction by moving and manipulating the object because the position at which these detection values are equal is normally in the vicinity of being directly above the light sensors.
The relationship between the detection values which triggers the musical control instruction is not limited only to the case when the detection values become equal in value, but may also be, for example, when the difference between the detection values falls within a specified range, or when the ratio of the detection values reaches a specified value.
FIG. 1 is a hardware configuration diagram wherein the musical apparatus has been applied to an electronic musical instrument as an example embodiment of the invention, wherein two infrared emitting diodes and one infrared sensor are used in an optical sensor component that detects motion of an object (for example, a hand). FIG. 1 depicts the various infrared emitting diodes 1A and 1B (hereinafter, referred to simply as light emitting diodes) and an infrared sensor 2 which detects infrared rays. The light from the light sources described above is not limited to infrared light, but may also be normal visible light or ultraviolet light, etc. CPU 3 (central processing unit) performs general control of the device. The main ROM 4 stores the control programs and various tables. A working RAM 5 stores various registers and flags, etc., described below. The element with reference numeral 6 represents various operation elements and indicators which are arranged on a panel. FIG. 1 also shows a sequencer 7,sound source 8, an effecter 9, and a timer 10, all of which are connected to one another by a bus 11.
The sequencer 7 is capable of simultaneously performing up to eight phrases, and the performance data for 100 phrases are stored in a ROM inside the sequencer (sequencer ROM 71). The sequencer 71 is able to play back one song data apart from these phrases. Song data for ten songs are stored in the sequencer ROM 71.
The sound source 8 has a multi-timbral configuration capable of simultaneously playing "128" voices, and sequencer 7, sound source 8, effecter 9, and bus 11 are connected as shown in the figure.
The timer 10 starts when the beam controller button in FIG. 2, described below, is pressed and turned ON which generates an interrupt every 5 milliseconds to the CPU 3 and causes the timer interrupt routine, described below, to be executed.
An external view drawing of the panel in the device of this example embodiment is shown in FIG. 2. The beam controller, consisting of the two light emitting diodes 1A, 1B and the infrared sensor 2, is situated on the panel. The light emitting diodes 1A, 1B are arranged on a lateral line, as viewed from the front of the panel of the electronic musical instrument, with the infrared sensor 2 situated midway between them. The space above this beam controller in the panel is the operation space for performing operation instructions by moving an object (typically, a hand). This beam controller is turned ON/OFF by pressing a beam controller button 61 situated in its vicinity.
The light emitting diodes 1A, 1B are controlled to turn ON/OFF in a time multiplexed manner so that the timing of their respective light emissions differ from each other and consequently, their infrared beams are not simultaneously irradiated inside the operation space. In addition, the light emitting diodes 1A, 1B are situated so that their beam irradiation directions are inclined outward from one another from the plumb direction to the panel. The equal-level curves of infrared beams irradiated from these light emitting diodes 1A, 1B are shown in FIG. 5. FIG. 5 illustrates the equal-level curves when the electronic musical instrument of this example embodiment is viewed from the front in the lateral direction on the panel surface, wherein it can be seen that the infrared beams of the light emitting diodes 1A, 1B are inclined outward from each other. By inclining the light axes of the two light sources outward from one another, the lights can be radiated so that there is a radiation field in the operation space in which at least portions of the two lights do not overlap, making it possible to make the object motion detector more compact. In addition, they are set inclining outward from each other so that the operation of moving the object in a lateral direction inside the operation space can be accurately detected by shifting it in the lateral direction when the irradiation space of the infrared beams irradiated by the various light emitting diodes 1A, 1B is viewed from the front.
The infrared sensor 2 is an element which receives the infrared beams which have been irradiated from the light emitting diodes 1A, 1B and reflected back by an object in the operating space, and then outputs an electrical quantity according to the level of said received light. Because lighting of the light emitting diodes 1A, 1B is controlled in time multiplexed fashion, the infrared sensor 2 receives the infrared rays (reflected lights) of the light emitting diodes 1A, 1B at chronologically alternating time periods. In this example embodiment, the level of the infrared ray which has been radiated from the light emitting diode 1A and reflected back from the object shall be "detection value RA," while the level of the infrared ray which has been radiated from the light emitting diode 1B and reflected back from the object shall be "detection value RB."
The other operation
elements 64 are operation elements which are used to select the phrase which is to be registered in the PHRASE1 register-PHRASE3 register provided in RAM 5, or for selecting the song data to be played back by the sequencer, and since they employ common selection methods, a detailed explanation is not necessary. In addition, the MODE buttons 651 -657 are operation elements for selecting the mode, which will be described below, enabling selection of any of Modes 1-7. The PLAY button 62 is the button for playing back the selected song data and the STOP button 63 is the button for stopping playback.
The performance data for the phrase stored in ROM 7 inside the sequencer 7 has a data structure like that shown in FIG. 3. In other words, besides the performance data for the phrase, the type of effect desired for that phrase (e.g., chorus, reverb, etc., used in the Mode 3 example described below) also are stored here.
FIG. 4 shows the structure of data stored in RAM, which contain the following types of registers and flags:
MODE register: Contains the number of the current mode (initialized to MODE=1 when power is turned ON).
A register: Contains the current detection value RA as current value A (initialized to 0 when power is turned ON).
B register: Contains the current detection value RB as current value B (initialized to 0 when power is turned ON).
Amax register: Contains the maximum value Amax for detection value RA up to the present (initialized to 0 when power is turned ON).
Bmax register: Contains the maximum value Bmax for detection value RB up to the present (initialized to 0 when power is turned ON).
Maximum Value Write Enable flag: Flag indicating whether write to register Amax and Bmax is enabled or disabled (initialized to ON when power is turned ON). ON indicates write enabled; OFF indicates write disabled.
LR Trigger flag: Flag indicating that an object has passed through the lateral midway point (in the vicinity directly above the infrared sensor 2) above the beam controller moving from left to right, as viewed from the panel face (initialized to ON when power is turned ON).
RL Trigger flag: Flag indicating that an object has passed through the lateral midway point moving from right to left (initialized to OFF when power is turned ON).
PHRASE1 register: Contains the number of the phrase registered as the first phrase.
PHRASE2 register: Contains the number of the phrase registered as the second phrase.
PHRASE3 register: Contains the number of the phrase registered as the third phrase .
The operation of the device of this example embodiment will be explained below.
In the device of this example embodiment, a variety of operation instructions can be executed by moving an object laterally or vertically inside the operating space above the beam controller situated on the panel. The content of these operation instructions can be changed based on whether the object was moved from right to left (as viewed from the panel face), or whether it was moved from left to right, and at about what height the object was at the time (as viewed from the panel surface).
Since the respective beam irradiation directions of the light emitting diodes 1A, 1B of the beam controller are inclined outwardly, when for example, an object (e.g., a hand) is moved in the direction shown by the arrow in FIG. 5 (in the direction from left to right), the respective detection values RA, RB of the light emitting diodes 1A, 1B show characteristics like those shown in FIG. 6. In FIG. 6, the horizontal axis is the position of
the object in the horizontal direction as viewed from the front surface of the beam controller (panel face), and the vertical axis is the values for the detection values RA, RB. First, when discussing the characteristics corresponding with the infrared beam from light emitting diode 1A, since the light reflected to the infrared sensor 2 increases as the object enters the operation space from the left side and approaches the light emitting diode 1A, the detection value RA gradually increases, ultimately reaching a peak value RApeak (the apex area in the characteristic) which corresponds to the height of the object in the vicinity of the position of the light emitting diode 1A, and then, since the object subsequently retreats from the light emitting diode 1A, the detection value RA gradually decreases, resulting in a hill shape like that shown in the figure. Similarly, the characteristic related with the infrared beam from the light emitting diode 1B also has a hill shape whose peak value is RBpeak, except that the position at which the detection value RB reaches its peak value is in the vicinity of light emitting diode 1B. It can be easily understood that similar characteristics are obtained when an object is moved so as to enter the operation space from right to left.
As can be seen from the characteristics in FIG. 6, the position at which the two detection values RA, RB reach the same value is in the vicinity of being directly above the infrared sensor, and the amplitudes (absolute values) of the detection values RA, RB depend on the height at which the object was moved over the panel. Whether the object was moved from right to left, or whether it was moved from left to right, can be determined by analyzing which of the detection values RA or RB reached its peak value first. In the device of the example embodiment, the content of the operation instructions is switched based on these motion characteristics of the object, and the content of those operation instructions is further switched for each mode.
Selection of the mode is accomplished by pressing any one of the MODE buttons 651-65.sub.7. Typical display screens corresponding with Modes 1-7 are shown in FIG. 13 through FIG. 19. The display screen is displayed on a display 66 on the panel. The detailed contents of the operation instructions in each mode will be discussed below. First, an example of a typical display screen format will be explained here, referring to the display screen for Mode 1 shown in FIG. 13, and the detailed contents of Modes 1-7, shown in FIG. 13 through FIG. 19, will be discussed below. In FIG. 13, the display screen displays the detection values RA, RB corresponding to each of the light emitting diodes 1A, 1B in the format "L: OO" and "R: XX," and displays the number of the current mode in the format "MODE=螖." In addition, the content of the operation instruction performed relative to the desired target device (e.g., sequencer, sound source, or effecter, etc. ) when the object is moved from left to right is displayed under "L鈫扲," while the content of the operation instruction performed when the object is moved from right to left is displayed under "L.rarw.R." The contents of these operation instructions are, for example, a stop performance instruction to the sequencer on "L鈫扲" and a start phrase playback instruction on "L.rarw.R." The target device to be controlled by the operation instruction (the phrase number in the example in FIG. 13) which is selected based on the height range of the hand in the vertical direction is shown in the "VERTICAL" column, and the detection value range which corresponds with each height range is displayed in the "VALUE" column. The closer this detection value is to "99," the lower the height (i. e., the closer the object is to the panel face); while the closer it is to "0," the higher the height from the panel face.
The operation of the device of this example embodiment will be explained below, referring to the flow charts in FIG. 8 through FIG. 12. FIG. 8 and FIG. 9 are the flow charts for the main routine. FIG. 10 and FIG. 11 are flowcharts for the timer interrupt routine which is executed every time an interrupt is sent from the timer 10 to the CPU 3, that is, every 5 milliseconds. In addition, FIG. 12 is the processing flow chart for the light emitting diodes.
First, the timer interrupt processing routine shown in FIG. 10 and FIG. 11 will be explained. This timer interrupt routine sequentially detects the detection values RA, RB corresponding to the light emitting diodes 1A, 1B, and then performs update processing for the maximum values Amax, Bmax of the detection values, performs ON/OFF processing for the LR trigger flag and RL trigger flag, and performs ON/OFF processing for the maximum value write enable flag based on these detection values.
When the timer interrupt processing routine is started, the processing pertaining to light emitting diode 1A is performed (step S21) first. The flow chart of this processing is shown in FIG. 12. The light emitting diode 1A is caused to emit light (step S41), the current detection value RA detected by the infrared sensor 2 (i. e., the detection value corresponding to the light reflected from the object pertinent to light emitting diode 1A) is stored in the A register as the current value A (step S42), and the light emitting diode 1A is turned off(step S43). Once the processing pertinent to light
emitting diode 1A is completed, similar processing is performed for light emitting diode 1B (step S22). Thus, the light emission timing for the light emitting diodes 1A, 1B is alternated, making it possible to obtain the detection values RA, RB from these light emitting diodes 1A, 1B in a time multiplexed manner.
Once current values A, B are obtained, it is determined whether the maximum value write enable flag is ON or OFF (step S23). Since it is possible to update the maximum values Amax and Bmax if the flag is ON, it is determined first whether the current value A is greater than the maximum value Amax (step S24). If the current value A is greater than the maximum value Amax, the maximum value Amax is updated by being replaced with the current value A (step S25). If the current value A is less than the maximum value Amax, the maximum value Amax has already reached its peak value, so it is not updated. It is then determined whether or not the current value B is greater than the maximum value Bmax (step S26). If it is greater than the maximum value Bmax, the maximum value Bmax is updated by being replaced with the current value B (step S27); while if the current value B is less than the maximum value Bmax, the maximum value Bmax is not updated.
Next, it is determined whether or not the two current values A, B are equal (step S28). If the two current values A, B are equal, it means that the object (e.g., a hand) is at the lateral mid-way position (in the vicinity of directly above the infrared sensor 2), as can be understood from the characteristic diagram in FIG. 5. In this case, the greater-than/less-than relationship between the maximum values Amax and Bmax is determined (step S29). If Amax鈮