SOUND

Top  Previous  Next

Action

Sends pulses to a port pin.

 

 

Syntax

SOUND pin, duration, frequency [,NOINT]

 

 

Remarks

Pin

Any I/O pin such as P1.0 etc.

duration

The number of pulses to send. Byte, integer/word or constant.

(1- 32768).

Frequency

The time the pin is pulled low and high.

NOINT

An option to disable interrupts during the sound statement.

 

When you connect a speaker or a buzzer to a port pin (see hardware) , you can use the SOUND statement to generate some tones.

The NOINT will clear the global interrupts so no interrupts can occur during the sound statement. When the sound statement has completed the interrupt register is restored.

 

The port pin is switched high and low for frequency uS. The pin will be in the low state when the sound statement ends.

This loop is executed duration times.

 

 

See also

SOUNDEXT

 

 

Example

SOUND P1.1 , 10000, 10                'BEEP

End