Sayzer,

I have the code where it goes on for a certain amount and off for half a second but I would like to press a button and the entire sound command turns off, like a regular alarm clock. Relating to the alarm clock the buzzer would go on until you press a button, once you press the buzzer will stop sounding. the following is my code:

INCLUDE "MODEDEFS.BAS"
DEFINE OSC 4

OSCCON = %01100110
ADCON1 = %11111111 'PINS TO DIGITAL OUTPUTS

INPUT PORTB.2 'START BUTTON
INPUT PORTB.4 'STOP BUTTON
OUTPUT PORTB.0 'LED
OUTPUT PORTB.1 'PIEZO

PORTB.1 = 0
PORTB.0 = 0

CONT_SOUND:
IF PORTB.2 == 0 THEN 'turns the alarm on
CONTINUESOUND:
Sound PORTB.1, [1,255] 'Sound command
GoSub CHECKING_STOP
ENDIF

GoTo CONTINUESOUND

CHECKING_STOP:
IF PORTA.4 == 0 Then
Toggle PORTB.0 'LED indication that it has made it to the loop
PORTB.1 = 0
EndIF

Return

STOP_BUZZER:
PORTB.1 = 0
TOGGLE PORTB.0
GoTo CONT_SOUND
End