Syntax:
Tone Frequency, DurationCommand Availability:
Available on all microcontrollers.
Explanation:
This command will produce the specified tone for the specified duration.
Frequency is measured in Hz, and Duration is in 10 ms units.
Please note that this command may not produce the exact frequency specified. While it is accurate enough for error beeps and small pieces of monophonic music, it should not be used for anything that requires a highly precise frequency.
Example:
'Sample program to produce a constant A note (440 Hz)
'on PORTB bit 1.
#chip 16F877A, 20
#define SoundOut PORTB.1
Do
Tone 440, 1000 ' <<< the Tone instruction
LoopKey line: Tone 440, 1000 — plays a 440 Hz tone (concert pitch A) for 1000 x 10 ms, or 10 seconds, then the loop repeats it.
See Also:

